"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[6125],{57418:(e,t,o)=>{o.r(t),o.d(t,{default:()=>O});var i=o(69307),n=o(9818),s=o(67221),c=o(82580),r=o(65736),m=o(55609),a=o(86020),l=o(10431),u=o(14599),p=o(46530),g=o(31815);const d=e=>{let{isWCSInstalled:t}=e;const{layoutString:o}=(0,p.useLayoutContext)();return(0,i.createElement)("div",{className:"woocommerce-list__item-inner woocommerce-services-item"},(0,i.createElement)("div",{className:"woocommerce-list__item-before"},(0,i.createElement)("img",{className:"woocommerce-services-item__logo",src:g,alt:"WooCommerce Service Logo"})),(0,i.createElement)("div",{className:"woocommerce-list__item-text"},(0,i.createElement)("span",{className:"woocommerce-list__item-title"},(0,r.__)("WooCommerce Shipping","woocommerce"),(0,i.createElement)(a.Pill,null,(0,r.__)("Recommended","woocommerce"))),(0,i.createElement)("span",{className:"woocommerce-list__item-content"},(0,r.__)("Print USPS and DHL Express labels straight from your WooCommerce dashboard and save on shipping.","woocommerce"),(0,i.createElement)("br",null),(0,i.createElement)(m.ExternalLink,{href:"https://woo.com/woocommerce-shipping/"},(0,r.__)("Learn more","woocommerce")))),(0,i.createElement)("div",{className:"woocommerce-list__item-after"},(0,i.createElement)(m.Button,{isSecondary:!0,onClick:()=>{(0,u.recordEvent)("tasklist_click",{task_name:"shipping-recommendation",context:`${o}/wc-settings`}),(0,l.navigateTo)({url:(0,l.getNewPath)({task:"shipping-recommendation"},"/",{})})}},t?(0,r.__)("Activate","woocommerce"):(0,r.__)("Get started","woocommerce"))))};var M=o(15883);const L="woocommerce_admin_reviewed_default_shipping_zones",h="woocommerce_admin_created_default_shipping_zones",S="woocommerce-settings-shipping-tour-floater-wrapper",N="woocommerce-settings-smart-defaults-shipping-tour-floater",E="table.wc-shipping-zones",_='a[href*="woocommerce-services-settings"]',j=e=>{var t;const o=e.map((e=>{var t,o;const i=null===(t=document)||void 0===t||null===(o=t.querySelector(e))||void 0===o?void 0:o.getBoundingClientRect();if(!i)throw new Error("Shipping tour: Couldn't find element with selector: "+e);return i})),i=(null===(t=document.querySelector(`.${S}`))||void 0===t?void 0:t.getBoundingClientRect())||{top:0,left:0},n=Math.min(...o.map((e=>e.top))),s=Math.min(...o.map((e=>e.left))),c=Math.max(...o.map((e=>e.right)))-s,r=Math.max(...o.map((e=>e.bottom)))-n,m=n-i.top;return{left:s-i.left,top:m,width:c,height:r}},y=e=>{let{dims:t}=e;return(0,i.createElement)("div",{style:{position:"relative",pointerEvents:"none",...t},className:N})},w=[["th.wc-shipping-zone-sort","tfoot.wc-shipping-zone-worldwide tr > td.wc-shipping-zone-region"],["th.wc-shipping-zone-methods","tfoot.wc-shipping-zone-worldwide tr > td.wc-shipping-zone-methods"]],T=e=>{var t,o;let{step:n}=e;const s=(0,i.useRef)(null);(0,i.useLayoutEffect)((()=>{var e;null!==(e=s.current)&&void 0!==e&&e.parentElement&&s.current.parentElement.insertBefore(s.current,document.querySelector("table.wc-shipping-zones"))}),[]);const c=null!==(t=w[n])&&void 0!==t?t:w[w.length-1],[r,m]=(0,i.useState)(j(c));(0,i.useEffect)((()=>{m(j(c));const e=new ResizeObserver((()=>{m(j(c))})),t=document.querySelector(E);if(!t)throw new Error("Shipping tour: Couldn't find shipping settings table element with selector: table.wc-shipping-zones");return e.observe(t),()=>{e.disconnect()}}),[c]);const a=null===(o=document.querySelector(E))||void 0===o?void 0:o.parentElement;if(!a)throw new Error("Shipping tour: Couldn't find shipping settings table parent element with selector: table.wc-shipping-zones");return(0,i.createPortal)((0,i.createElement)("div",{ref:s,className:S,style:{position:"absolute"}},(0,i.createElement)(y,{dims:r})),a)},I=e=>{let{showShippingRecommendationsStep:t}=e;const{updateOptions:o}=(0,n.useDispatch)(s.OPTIONS_STORE_NAME),{show:c}=(()=>{const{hasCreatedDefaultShippingZones:e,hasReviewedDefaultShippingOptions:t,isLoading:o}=(0,n.useSelect)((e=>{const{hasFinishedResolution:t,getOption:o}=e(s.OPTIONS_STORE_NAME);return{isLoading:!t("getOption",[h])&&!t("getOption",[L]),hasCreatedDefaultShippingZones:"yes"===o(h),hasReviewedDefaultShippingOptions:"yes"===o(L)}}));return{isLoading:o,show:window.wcAdminFeatures["shipping-setting-tour"]&&!o&&e&&!t}})(),[m,l]=(0,i.useState)(0),{createNotice:p}=(0,n.useDispatch)("core/notices"),g={placement:"auto",options:{effects:{spotlight:{interactivity:{enabled:!1}},liveResize:{mutation:!0,resize:!0}},callbacks:{onNextStep:e=>{l(e+1),(0,u.recordEvent)("walkthrough_settings_shipping_next_click",{step_name:g.steps[e].meta.name})},onPreviousStep:e=>{l(e-1),(0,u.recordEvent)("walkthrough_settings_shipping_back_click",{step_name:g.steps[e].meta.name})}}},steps:[{referenceElements:{desktop:`.${N}`},meta:{name:"shipping-zones",heading:(0,r.__)("Shipping zones","woocommerce"),descriptions:{desktop:(0,i.createElement)(i.Fragment,null,(0,i.createElement)("span",null,(0,r.__)("Specify the areas you'd like to ship to! Give each zone a name, then list the regions you'd like to include. Your regions can be as specific as a zip code or as broad as a country. Shoppers will only see the methods available in their region.","woocommerce")),(0,i.createElement)("br",null),(0,i.createElement)("span",null,(0,r.__)("We've added some shipping zones to get you started — you can manage them by selecting Edit or Delete.","woocommerce")))}}},{referenceElements:{desktop:`.${N}`},meta:{name:"shipping-methods",heading:(0,r.__)("Shipping methods","woocommerce"),descriptions:{desktop:(0,i.createElement)(i.Fragment,null,(0,i.createElement)("span",null,(0,r.__)("Add one or more shipping methods you'd like to offer to shoppers in your zones.","woocommerce")),(0,i.createElement)("br",null),(0,i.createElement)("span",null,(0,r.__)("For example, we've added the “Free shipping” method for shoppers in your country. You can edit, add to, or remove shipping methods by selecting Edit or Delete.","woocommerce")))}}}],closeHandler:async(e,t,i)=>{(await o({[L]:"yes"})).success||(p("error",(0,r.__)("There was a problem marking the shipping tour as completed.","woocommerce")),(0,u.recordEvent)("walkthrough_settings_shipping_updated_option_error")),"close-btn"===i?(0,u.recordEvent)("walkthrough_settings_shipping_dismissed",{step_name:e[t].meta.name}):"done-btn"===i&&(0,u.recordEvent)("walkthrough_settings_shipping_completed")}};return document.querySelector(_)&&g.steps.push({referenceElements:{desktop:_},meta:{name:"woocommerce-shipping",heading:(0,r.__)("WooCommerce Shipping","woocommerce"),descriptions:{desktop:(0,r.__)("Print USPS and DHL labels straight from your Woo dashboard and save on shipping thanks to discounted rates. You can manage WooCommerce Shipping in this section.","woocommerce")}}}),t&&g.steps.push({referenceElements:{desktop:"div.woocommerce-recommended-shipping-extensions"},meta:{name:"shipping-recommendations",heading:(0,r.__)("WooCommerce Shipping","woocommerce"),descriptions:{desktop:(0,r.__)("If you’d like to speed up your process and print your shipping label straight from your Woo dashboard, WooCommerce Shipping may be for you! ","woocommerce")}}}),(0,i.useEffect)((()=>{c&&(0,u.recordEvent)("walkthrough_settings_shipping_view")}),[c]),c?(0,i.createElement)("div",null,(0,i.createElement)(T,{step:m}),(0,i.createElement)(a.TourKit,{config:g})):null},O=()=>{const{activePlugins:e,installedPlugins:t,countryCode:o,isJetpackConnected:r,isSellingDigitalProductsOnly:m}=(0,n.useSelect)((e=>{var t;const o=e(s.SETTINGS_STORE_NAME).getSettings("general"),{getActivePlugins:i,getInstalledPlugins:n,isJetpackConnected:r}=e(s.PLUGINS_STORE_NAME),m=e(s.ONBOARDING_STORE_NAME).getProfileItems().product_types;return{activePlugins:i(),installedPlugins:n(),countryCode:(0,c.so)(null===(t=o.general)||void 0===t?void 0:t.woocommerce_default_country),isJetpackConnected:r(),isSellingDigitalProductsOnly:1===(null==m?void 0:m.length)&&"downloads"===m[0]}}));return e.includes("woocommerce-services")&&r||"US"!==o||m?(0,i.createElement)(I,{showShippingRecommendationsStep:!1}):(0,i.createElement)(i.Fragment,null,(0,i.createElement)(I,{showShippingRecommendationsStep:!0}),(0,i.createElement)(M.ShippingRecommendationsList,null,(0,i.createElement)(d,{isWCSInstalled:t.includes("woocommerce-services")})))}},15883:(e,t,o)=>{o.r(t),o.d(t,{ShippingRecommendationsList:()=>E,default:()=>_});var i=o(69307),n=o(65736),s=o(9818),c=o(14812),r=o(67221),m=o(72672),a=o(55609),l=o(34704),u=o(86020),p=o(83849),g=o.n(p);const d=(0,i.createContext)(""),M=e=>{let{children:t,onDismiss:o=(()=>null)}=e;const{updateOptions:c}=(0,s.useDispatch)(r.OPTIONS_STORE_NAME),m=(0,i.useContext)(d),l=()=>{o(),c({[m]:"yes"})};return(0,i.createElement)(a.CardHeader,null,(0,i.createElement)("div",{className:"woocommerce-dismissable-list__header"},t),(0,i.createElement)("div",null,(0,i.createElement)(u.EllipsisMenu,{label:(0,n.__)("Task List Options","woocommerce"),renderContent:()=>(0,i.createElement)("div",{className:"woocommerce-dismissable-list__controls"},(0,i.createElement)(a.Button,{onClick:l},(0,n.__)("Hide this","woocommerce")))})))},L=e=>{let{children:t,className:o,dismissOptionName:n}=e;return(0,s.useSelect)((e=>{const{getOption:t,hasFinishedResolution:o}=e(r.OPTIONS_STORE_NAME),i=o("getOption",[n]),s="yes"===t(n);return i&&!s}))?(0,i.createElement)(a.Card,{size:"medium",className:g()("woocommerce-dismissable-list",o)},(0,i.createElement)(d.Provider,{value:n},t)):null};var h=o(74617),S=o(31815);const N=e=>{let{onSetupClick:t,pluginsBeingSetup:o}=e;const{createSuccessNotice:c}=(0,s.useDispatch)("core/notices"),m=(0,s.useSelect)((e=>e(r.PLUGINS_STORE_NAME).isJetpackConnected()));return(0,i.createElement)("div",{className:"woocommerce-list__item-inner woocommerce-services-item"},(0,i.createElement)("div",{className:"woocommerce-list__item-before"},(0,i.createElement)("img",{className:"woocommerce-services-item__logo",src:S,alt:""})),(0,i.createElement)("div",{className:"woocommerce-list__item-text"},(0,i.createElement)("span",{className:"woocommerce-list__item-title"},(0,n.__)("WooCommerce Shipping","woocommerce"),(0,i.createElement)(u.Pill,null,(0,n.__)("Recommended","woocommerce"))),(0,i.createElement)("span",{className:"woocommerce-list__item-content"},(0,n.__)("Print USPS and DHL Express labels straight from your WooCommerce dashboard and save on shipping.","woocommerce"),(0,i.createElement)("br",null),(0,i.createElement)(a.ExternalLink,{href:"https://woo.com/woocommerce-shipping/"},(0,n.__)("Learn more","woocommerce")))),(0,i.createElement)("div",{className:"woocommerce-list__item-after"},(0,i.createElement)(a.Button,{isSecondary:!0,onClick:()=>{t(["woocommerce-services"]).then((()=>{const e=[];m||e.push({url:(0,h.getAdminLink)("plugins.php"),label:(0,n.__)("Finish the setup by connecting your store to WordPress.com.","woocommerce")}),c((0,n.__)("🎉 WooCommerce Shipping is installed!","woocommerce"),{actions:e})}))},isBusy:o.includes("woocommerce-services"),disabled:o.length>0},(0,n.__)("Get started","woocommerce"))))},E=e=>{let{children:t}=e;return(0,i.createElement)(L,{className:"woocommerce-recommended-shipping-extensions",dismissOptionName:"woocommerce_settings_shipping_recommendations_hidden"},(0,i.createElement)(M,null,(0,i.createElement)(c.Text,{variant:"title.small",as:"p",size:"20",lineHeight:"28px"},(0,n.__)("Recommended shipping solutions","woocommerce")),(0,i.createElement)(c.Text,{className:"woocommerce-recommended-shipping__header-heading",variant:"caption",as:"p",size:"12",lineHeight:"16px"},(0,n.__)('We recommend adding one of the following shipping extensions to your store. The extension will be installed and activated for you when you click "Get started".',"woocommerce"))),(0,i.createElement)("ul",{className:"woocommerce-list"},i.Children.map(t,(e=>(0,i.createElement)("li",{className:"woocommerce-list__item"},e)))),(0,i.createElement)(a.CardFooter,null,(0,i.createElement)(a.Button,{className:"woocommerce-recommended-shipping-extensions__more_options_cta",href:"https://woo.com/product-category/woocommerce-extensions/shipping-methods/?utm_source=shipping_recommendations",target:"_blank",isTertiary:!0},(0,n.__)("See more options","woocommerce"),(0,i.createElement)(a.VisuallyHidden,null,(0,n.__)("(opens in a new tab)","woocommerce")),(0,i.createElement)(m.Z,{size:18}))))},_=()=>{const[e,t]=(()=>{const[e,t]=(0,i.useState)([]),{installAndActivatePlugins:o}=(0,s.useDispatch)(r.PLUGINS_STORE_NAME);return[e,i=>e.length>0?Promise.resolve():(t(i),o(i).then((()=>{t([])})).catch((e=>((0,l.a)(e),t([]),Promise.reject()))))]})();return(0,s.useSelect)((e=>e(r.PLUGINS_STORE_NAME).getActivePlugins())).includes("woocommerce-services")?null:(0,i.createElement)(E,null,(0,i.createElement)(N,{pluginsBeingSetup:e,onSetupClick:t}))}},31815:e=>{e.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjAgMTIwIj48cGF0aCBmaWxsPSIjN2Q1N2E0IiBkPSJNMCAwaDEyMHYxMjBIMHoiLz48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNjcuNDggNTMuNTVjLTEuMTktLjI2LTIuMzMuNDItMy40MyAyLjAzLS44NyAxLjI2LTEuNDUgMi41Ni0xLjc0IDMuOTEtLjE2Ljc3LS4yNCAxLjU4LS4yNCAyLjQxIDAgLjk3LjE5IDEuOTYuNTggMi45OS40OCAxLjI2IDEuMTMgMS45NiAxLjkzIDIuMTIuOC4xNiAxLjY5LS4xOSAyLjY2LTEuMDYgMS4yMi0xLjA5IDIuMDYtMi43MiAyLjUxLTQuODguMTYtLjc3LjI0LTEuNTguMjQtMi40MSAwLS45Ny0uMTktMS45Ni0uNTgtMi45OS0uNDgtMS4yNS0xLjEyLTEuOTYtMS45My0yLjEyem0yMC42MiAwYy0xLjE5LS4yNi0yLjMzLjQyLTMuNDMgMi4wMy0uODcgMS4yNi0xLjQ1IDIuNTYtMS43NCAzLjkxLS4xNi43Ny0uMjQgMS41OC0uMjQgMi40MSAwIC45Ny4xOSAxLjk2LjU4IDIuOTkuNDggMS4yNiAxLjEzIDEuOTYgMS45MyAyLjEyLjguMTYgMS42OS0uMTkgMi42Ni0xLjA2IDEuMjItMS4wOSAyLjA2LTIuNzIgMi41MS00Ljg4LjE2LS43Ny4yNC0xLjU4LjI0LTIuNDEgMC0uOTctLjE5LTEuOTYtLjU4LTIuOTktLjQ4LTEuMjU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