File "shipping-recommendations.js"

Full Path: /home/amervokv/ecomlive.net/wp-content/plugins/woocommerce/assets/client/admin/chunks/shipping-recommendations.js
File size: 15.09 KB
MIME-type: text/plain
Charset: utf-8

"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[6125],{75426:(e,o,i)=>{i.r(o),i.d(o,{default:()=>O});var t=i(9818),s=i(67221),n=i(27232),c=i(65736),r=i(55609),m=i(86020),a=i(10431),l=i(14599),u=i(46530),d=i(31815),p=i(81514);const g=({isWCSInstalled:e})=>{const{layoutString:o}=(0,u.useLayoutContext)();return(0,p.jsxs)("div",{className:"woocommerce-list__item-inner woocommerce-services-item",children:[(0,p.jsx)("div",{className:"woocommerce-list__item-before",children:(0,p.jsx)("img",{className:"woocommerce-services-item__logo",src:d,alt:"WooCommerce Service Logo"})}),(0,p.jsxs)("div",{className:"woocommerce-list__item-text",children:[(0,p.jsxs)("span",{className:"woocommerce-list__item-title",children:[(0,c.__)("WooCommerce Shipping","woocommerce"),(0,p.jsx)(m.Pill,{children:(0,c.__)("Recommended","woocommerce")})]}),(0,p.jsxs)("span",{className:"woocommerce-list__item-content",children:[(0,c.__)("Print USPS and DHL Express labels straight from your WooCommerce dashboard and save on shipping.","woocommerce"),(0,p.jsx)("br",{}),(0,p.jsx)(r.ExternalLink,{href:"https://woocommerce.com/woocommerce-shipping/",children:(0,c.__)("Learn more","woocommerce")})]})]}),(0,p.jsx)("div",{className:"woocommerce-list__item-after",children:(0,p.jsx)(r.Button,{isSecondary:!0,onClick:()=>{(0,l.recordEvent)("tasklist_click",{task_name:"shipping-recommendation",context:`${o}/wc-settings`}),(0,a.navigateTo)({url:(0,a.getNewPath)({task:"shipping-recommendation"},"/",{})})},children:e?(0,c.__)("Activate","woocommerce"):(0,c.__)("Get started","woocommerce")})})]})};var h=i(98293),j=i(69307);const M="woocommerce_admin_reviewed_default_shipping_zones",L="woocommerce_admin_created_default_shipping_zones",S="woocommerce-settings-shipping-tour-floater-wrapper",N="woocommerce-settings-smart-defaults-shipping-tour-floater",_="table.wc-shipping-zones",y='a[href*="woocommerce-services-settings"]',w=e=>{const o=e.map((e=>{const o=document?.querySelector(e)?.getBoundingClientRect();if(!o)throw new Error("Shipping tour: Couldn’t find element with selector: "+e);return o})),i=document.querySelector(`.${S}`)?.getBoundingClientRect()||{top:0,left:0},t=Math.min(...o.map((e=>e.top))),s=Math.min(...o.map((e=>e.left))),n=Math.max(...o.map((e=>e.right)))-s,c=Math.max(...o.map((e=>e.bottom)))-t,r=t-i.top;return{left:s-i.left,top:r,width:n,height:c}},x=({dims:e})=>(0,p.jsx)("div",{style:{position:"relative",pointerEvents:"none",...e},className:N}),T=[["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"]],E=({step:e})=>{var o;const i=(0,j.useRef)(null);(0,j.useLayoutEffect)((()=>{i.current?.parentElement&&i.current.parentElement.insertBefore(i.current,document.querySelector("table.wc-shipping-zones"))}),[]);const t=null!==(o=T[e])&&void 0!==o?o:T[T.length-1],[s,n]=(0,j.useState)(w(t));(0,j.useEffect)((()=>{n(w(t));const e=new ResizeObserver((()=>{n(w(t))})),o=document.querySelector(_);if(!o)throw new Error("Shipping tour: Couldn’t find shipping settings table element with selector: "+_);return e.observe(o),()=>{e.disconnect()}}),[t]);const c=document.querySelector(_)?.parentElement;if(!c)throw new Error("Shipping tour: Couldn’t find shipping settings table parent element with selector: "+_);return(0,j.createPortal)((0,p.jsx)("div",{ref:i,className:S,style:{position:"absolute"},children:(0,p.jsx)(x,{dims:s})}),c)},I=({showShippingRecommendationsStep:e})=>{const{updateOptions:o}=(0,t.useDispatch)(s.OPTIONS_STORE_NAME),{show:i,isUspsDhlEligible:r}=(()=>{const{hasCreatedDefaultShippingZones:e,hasReviewedDefaultShippingOptions:o,businessCountry:i,isLoading:c}=(0,t.useSelect)((e=>{const{hasFinishedResolution:o,getOption:i}=e(s.OPTIONS_STORE_NAME);return{isLoading:!o("getOption",[L])&&!o("getOption",[M])&&!o("getOption",["woocommerce_default_country"]),hasCreatedDefaultShippingZones:"yes"===i(L),hasReviewedDefaultShippingOptions:"yes"===i(M),businessCountry:(0,n.so)(i("woocommerce_default_country"))}}));return{isLoading:c,show:window.wcAdminFeatures["shipping-setting-tour"]&&!c&&e&&!o,isUspsDhlEligible:"US"===i}})(),[a,u]=(0,j.useState)(0),{createNotice:d}=(0,t.useDispatch)("core/notices"),g={placement:"auto",options:{effects:{spotlight:{interactivity:{enabled:!1}},liveResize:{mutation:!0,resize:!0},autoScroll:!0},callbacks:{onNextStep:e=>{u(e),(0,l.recordEvent)("walkthrough_settings_shipping_next_click",{step_name:g.steps[e-1].meta.name})},onPreviousStep:e=>{u(e),(0,l.recordEvent)("walkthrough_settings_shipping_back_click",{step_name:g.steps[e+1].meta.name})}}},steps:[{referenceElements:{desktop:`.${N}`},meta:{name:"shipping-zones",heading:(0,c.__)("Shipping zones","woocommerce"),descriptions:{desktop:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{children:(0,c.__)("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,p.jsx)("br",{}),(0,p.jsx)("span",{children:(0,c.__)("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,c.__)("Shipping methods","woocommerce"),descriptions:{desktop:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{children:(0,c.__)("Add one or more shipping methods you’d like to offer to shoppers in your zones.","woocommerce")}),(0,p.jsx)("br",{}),(0,p.jsx)("span",{children:(0,c.__)("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,i,t)=>{(await o({[M]:"yes"})).success||(d("error",(0,c.__)("There was a problem marking the shipping tour as completed.","woocommerce")),(0,l.recordEvent)("walkthrough_settings_shipping_updated_option_error")),"close-btn"===t?(0,l.recordEvent)("walkthrough_settings_shipping_dismissed",{step_name:e[i].meta.name}):"done-btn"===t&&(0,l.recordEvent)("walkthrough_settings_shipping_completed")}};return document.querySelector(y)&&r&&g.steps.push({referenceElements:{desktop:y},meta:{name:"woocommerce-shipping",heading:(0,c.__)("WooCommerce Shipping","woocommerce"),descriptions:{desktop:(0,c.__)("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")}}}),e&&g.steps.push({referenceElements:{desktop:"div.woocommerce-recommended-shipping-extensions"},meta:{name:"shipping-recommendations",heading:(0,c.__)("WooCommerce Shipping","woocommerce"),descriptions:{desktop:(0,c.__)("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,j.useEffect)((()=>{i&&(0,l.recordEvent)("walkthrough_settings_shipping_view")}),[i]),i?(0,p.jsxs)("div",{children:[(0,p.jsx)(E,{step:a}),(0,p.jsx)(m.TourKit,{config:g})]}):null},O=()=>{const{activePlugins:e,installedPlugins:o,countryCode:i,isJetpackConnected:c,isSellingDigitalProductsOnly:r}=(0,t.useSelect)((e=>{const o=e(s.SETTINGS_STORE_NAME).getSettings("general"),{getActivePlugins:i,getInstalledPlugins:t,isJetpackConnected:c}=e(s.PLUGINS_STORE_NAME),r=e(s.ONBOARDING_STORE_NAME).getProfileItems().product_types;return{activePlugins:i(),installedPlugins:t(),countryCode:(0,n.so)(o.general?.woocommerce_default_country),isJetpackConnected:c(),isSellingDigitalProductsOnly:1===r?.length&&"downloads"===r[0]}}));return e.includes("woocommerce-shipping")||e.includes("woocommerce-tax")||e.includes("woocommerce-services")&&c||"US"!==i||r?(0,p.jsx)(I,{showShippingRecommendationsStep:!1}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(I,{showShippingRecommendationsStep:!0}),(0,p.jsx)(h.ShippingRecommendationsList,{children:(0,p.jsx)(g,{isWCSInstalled:o.includes("woocommerce-services")})})]})}},98293:(e,o,i)=>{i.r(o),i.d(o,{ShippingRecommendationsList:()=>N,default:()=>_});var t=i(65736),s=i(9818),n=i(69307),c=i(14812),r=i(67221),m=i(24081),a=i(55609),l=i(4174),u=i(86020),d=i(80225),p=i(81514);const g=(0,n.createContext)(""),h=({children:e,onDismiss:o=(()=>null)})=>{const{updateOptions:i}=(0,s.useDispatch)(r.OPTIONS_STORE_NAME),c=(0,n.useContext)(g),m=()=>{o(),i({[c]:"yes"})};return(0,p.jsxs)(a.CardHeader,{children:[(0,p.jsx)("div",{className:"woocommerce-dismissable-list__header",children:e}),(0,p.jsx)("div",{children:(0,p.jsx)(u.EllipsisMenu,{label:(0,t.__)("Task List Options","woocommerce"),renderContent:()=>(0,p.jsx)("div",{className:"woocommerce-dismissable-list__controls",children:(0,p.jsx)(a.Button,{onClick:m,children:(0,t.__)("Hide this","woocommerce")})})})})]})},j=({children:e,className:o,dismissOptionName:i})=>(0,s.useSelect)((e=>{const{getOption:o,hasFinishedResolution:t}=e(r.OPTIONS_STORE_NAME),s=t("getOption",[i]),n="yes"===o(i);return s&&!n}))?(0,p.jsx)(a.Card,{size:"medium",className:(0,d.Z)("woocommerce-dismissable-list",o),children:(0,p.jsx)(g.Provider,{value:i,children:e})}):null;var M=i(74617),L=i(31815);const S=({onSetupClick:e,pluginsBeingSetup:o})=>{const{createSuccessNotice:i}=(0,s.useDispatch)("core/notices"),n=(0,s.useSelect)((e=>e(r.PLUGINS_STORE_NAME).isJetpackConnected()));return(0,p.jsxs)("div",{className:"woocommerce-list__item-inner woocommerce-services-item",children:[(0,p.jsx)("div",{className:"woocommerce-list__item-before",children:(0,p.jsx)("img",{className:"woocommerce-services-item__logo",src:L,alt:""})}),(0,p.jsxs)("div",{className:"woocommerce-list__item-text",children:[(0,p.jsxs)("span",{className:"woocommerce-list__item-title",children:[(0,t.__)("WooCommerce Shipping","woocommerce"),(0,p.jsx)(u.Pill,{children:(0,t.__)("Recommended","woocommerce")})]}),(0,p.jsxs)("span",{className:"woocommerce-list__item-content",children:[(0,t.__)("Print USPS and DHL Express labels straight from your WooCommerce dashboard and save on shipping.","woocommerce"),(0,p.jsx)("br",{}),(0,p.jsx)(a.ExternalLink,{href:"https://woocommerce.com/woocommerce-shipping/",children:(0,t.__)("Learn more","woocommerce")})]})]}),(0,p.jsx)("div",{className:"woocommerce-list__item-after",children:(0,p.jsx)(a.Button,{isSecondary:!0,onClick:()=>{e(["woocommerce-services"]).then((()=>{const e=[];n||e.push({url:(0,M.getAdminLink)("plugins.php"),label:(0,t.__)("Finish the setup by connecting your store to WordPress.com.","woocommerce")}),i((0,t.__)("🎉 WooCommerce Shipping is installed!","woocommerce"),{actions:e})}))},isBusy:o.includes("woocommerce-services"),disabled:o.length>0,children:(0,t.__)("Get started","woocommerce")})})]})},N=({children:e})=>(0,p.jsxs)(j,{className:"woocommerce-recommended-shipping-extensions",dismissOptionName:"woocommerce_settings_shipping_recommendations_hidden",children:[(0,p.jsxs)(h,{children:[(0,p.jsx)(c.Text,{variant:"title.small",as:"p",size:"20",lineHeight:"28px",children:(0,t.__)("Recommended shipping solutions","woocommerce")}),(0,p.jsx)(c.Text,{className:"woocommerce-recommended-shipping__header-heading",variant:"caption",as:"p",size:"12",lineHeight:"16px",children:(0,t.__)('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,p.jsx)("ul",{className:"woocommerce-list",children:n.Children.map(e,(e=>(0,p.jsx)("li",{className:"woocommerce-list__item",children:e})))}),(0,p.jsx)(a.CardFooter,{children:(0,p.jsxs)(a.Button,{className:"woocommerce-recommended-shipping-extensions__more_options_cta",href:"https://woocommerce.com/product-category/woocommerce-extensions/shipping-methods/?utm_source=shipping_recommendations",target:"_blank",isTertiary:!0,children:[(0,t.__)("See more options","woocommerce"),(0,p.jsx)(a.VisuallyHidden,{children:(0,t.__)("(opens in a new tab)","woocommerce")}),(0,p.jsx)(m.Z,{size:18})]})})]}),_=()=>{const[e,o]=(()=>{const[e,o]=(0,n.useState)([]),{installAndActivatePlugins:i}=(0,s.useDispatch)(r.PLUGINS_STORE_NAME);return[e,t=>e.length>0?Promise.resolve():(o(t),i(t).then((()=>{o([])})).catch((e=>((0,l.a)(e),o([]),Promise.reject()))))]})(),i=(0,s.useSelect)((e=>e(r.PLUGINS_STORE_NAME).getActivePlugins()));return i.includes("woocommerce-services")||i.includes("woocommerce-shipping")||i.includes("woocommerce-tax")?null:(0,p.jsx)(N,{children:(0,p.jsx)(S,{pluginsBeingSetup:e,onSetupClick:o})})}},31815:e=>{e.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjAgMTIwIj48cGF0aCBmaWxsPSIjN2Q1N2E0IiBkPSJNMCAwaDEyMHYxMjBIMHoiLz48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNjcuNDggNTMuNTVjLTEuMTktLjI2LTIuMzMuNDItMy40MyAyLjAzLS44NyAxLjI2LTEuNDUgMi41Ni0xLjc0IDMuOTEtLjE2Ljc3LS4yNCAxLjU4LS4yNCAyLjQxIDAgLjk3LjE5IDEuOTYuNTggMi45OS40OCAxLjI2IDEuMTMgMS45NiAxLjkzIDIuMTIuOC4xNiAxLjY5LS4xOSAyLjY2LTEuMDYgMS4yMi0xLjA5IDIuMDYtMi43MiAyLjUxLTQuODguMTYtLjc3LjI0LTEuNTguMjQtMi40MSAwLS45Ny0uMTktMS45Ni0uNTgtMi45OS0uNDgtMS4yNS0xLjEyLTEuOTYtMS45My0yLjEyem0yMC42MiAwYy0xLjE5LS4yNi0yLjMzLjQyLTMuNDMgMi4wMy0uODcgMS4yNi0xLjQ1IDIuNTYtMS43NCAzLj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