woocommerce/packages/woocommerce-admin/dist/chunks/shipping-recommendations.js
2021-12-10 12:03:04 +00:00

1 line
8.7 KiB
JavaScript

(window.__wcAdmin_webpackJsonp=window.__wcAdmin_webpackJsonp||[]).push([[48],{507:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var i=c(7);function o(e){const{createNotice:t}=Object(i.dispatch)("core/notices");e.error_data&&e.errors&&Object.keys(e.errors).length?Object.keys(e.errors).forEach(c=>{t("error",e.errors[c].join(" "))}):e.message&&t(e.code?"error":"success",e.message)}},537:function(e,t,c){"use strict";var i=Object.assign||function(e){for(var t,c=1;c<arguments.length;c++)for(var i in t=arguments[c])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,c=e.size,o=void 0===c?24:c,n=e.onClick,j=(e.icon,e.className),M=function(e,t){var c={};for(var i in e)0<=t.indexOf(i)||Object.prototype.hasOwnProperty.call(e,i)&&(c[i]=e[i]);return c}(e,["size","onClick","icon","className"]),u=["gridicon","gridicons-external",j,(t=o,!(0!=t%18)&&"needs-offset"),!1,!1].filter(Boolean).join(" ");return s.default.createElement("svg",i({className:u,height:o,width:o,onClick:n},M,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),s.default.createElement("g",null,s.default.createElement("path",{d:"M19 13v6c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h6v2H5v12h12v-6h2zM13 3v2h4.586l-7.793 7.793 1.414 1.414L19 6.414V11h2V3h-8z"})))};var o,n=c(5),s=(o=n)&&o.__esModule?o:{default:o};e.exports=t.default},587:function(e,t,c){},588:function(e,t,c){},589:function(e,t){e.exports="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjAgMTIwIj48cGF0aCBmaWxsPSIjN2Q1N2E0IiBkPSJNMCAwaDEyMHYxMj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xLjU5IDMuOTMgMS41OSA2LjQ3LS4wMSAzLjM4LS44NiA2LjQ4LTIuNTYgOS4zMnptMjAuNjIgMGMtMS45NiAzLjI4LTQuNTQgNC45Mi03LjcyIDQuOTItLjU4IDAtMS4xNy0uMDctMS43OC0uMTktMi4zMi0uNDgtNC4wNy0xLjc1LTUuMjYtMy44MS0xLjA2LTEuOC0xLjU5LTMuOTctMS41OS02LjUyIDAtMy4zOC44NS02LjQ3IDIuNTYtOS4yNyAyLTMuMjggNC41Ny00LjkyIDcuNzItNC45Mi41OCAwIDEuMTcuMDcgMS43OC4xOSAyLjMyLjQ4IDQuMDcgMS43NSA1LjI2IDMuODEgMS4wNiAxLjc3IDEuNTkgMy45MyAxLjU5IDYuNDcgMCAzLjM4LS44NiA2LjQ4LTIuNTYgOS4zMnoiLz48L3N2Zz4K"},590:function(e,t,c){},616:function(e,t,c){"use strict";c.r(t);var i=c(0),o=c(2),n=c(7),s=c(20),j=c(11),M=c(537),u=c.n(M),r=c(3),m=c(507),a=c(21),L=c(6),l=c.n(L);c(587);const N=Object(i.createContext)(""),O=({children:e,onDismiss:t=(()=>null)})=>{const{updateOptions:c}=Object(n.useDispatch)(j.OPTIONS_STORE_NAME),s=Object(i.useContext)(N),M=()=>{t(),c({[s]:"yes"})};return Object(i.createElement)(r.CardHeader,null,Object(i.createElement)("div",{className:"woocommerce-dismissable-list__header"},e),Object(i.createElement)("div",null,Object(i.createElement)(a.EllipsisMenu,{label:Object(o.__)("Task List Options",'woocommerce'),renderContent:()=>Object(i.createElement)("div",{className:"woocommerce-dismissable-list__controls"},Object(i.createElement)(r.Button,{onClick:M},Object(o.__)("Hide this",'woocommerce')))})))},g=({children:e,className:t,dismissOptionName:c})=>Object(n.useSelect)(e=>{const{getOption:t,hasFinishedResolution:i}=e(j.OPTIONS_STORE_NAME),o=i("getOption",[c]),n="yes"===t(c);return o&&!n})?Object(i.createElement)(r.Card,{size:"medium",className:l()("woocommerce-dismissable-list",t)},Object(i.createElement)(N.Provider,{value:c},e)):null;var S=c(13),y=(c(588),c(589)),E=c.n(y);var T=({onSetupClick:e,pluginsBeingSetup:t})=>{Object(S.f)("wcAdminAssetUrl","");const{createSuccessNotice:c}=Object(n.useDispatch)("core/notices"),s=Object(n.useSelect)(e=>e(j.PLUGINS_STORE_NAME).isJetpackConnected());return Object(i.createElement)("div",{className:"woocommerce-list__item-inner woocommerce-services-item"},Object(i.createElement)("div",{className:"woocommerce-list__item-before"},Object(i.createElement)("img",{className:"woocommerce-services-item__logo",src:E.a,alt:""})),Object(i.createElement)("div",{className:"woocommerce-list__item-text"},Object(i.createElement)("span",{className:"woocommerce-list__item-title"},Object(o.__)("Woocommerce Shipping",'woocommerce'),Object(i.createElement)(a.Pill,null,Object(o.__)("Recommended",'woocommerce'))),Object(i.createElement)("span",{className:"woocommerce-list__item-content"},Object(o.__)("Print USPS and DHL Express labels straight from your WooCommerce dashboard and save on shipping.",'woocommerce'),Object(i.createElement)("br",null),Object(i.createElement)(r.ExternalLink,{href:"https://woocommerce.com/woocommerce-shipping/"},Object(o.__)("Learn more",'woocommerce')))),Object(i.createElement)("div",{className:"woocommerce-list__item-after"},Object(i.createElement)(r.Button,{isSecondary:!0,onClick:()=>{e(["woocommerce-services"]).then(()=>{const e=[];s||e.push({url:Object(S.e)("plugins.php"),label:Object(o.__)("Finish the setup by connecting your store to Jetpack.",'woocommerce')}),c(Object(o.__)("🎉 WooCommerce Shipping is installed!",'woocommerce'),{actions:e})})},isBusy:t.includes("woocommerce-services"),disabled:t.length>0},Object(o.__)("Get started",'woocommerce'))))};c(590);const d=({children:e})=>Object(i.createElement)(g,{className:"woocommerce-recommended-shipping-extensions",dismissOptionName:"woocommerce_settings_shipping_recommendations_hidden"},Object(i.createElement)(O,null,Object(i.createElement)(s.Text,{variant:"title.small",as:"p",size:"20",lineHeight:"28px"},Object(o.__)("Recommended shipping solutions",'woocommerce')),Object(i.createElement)(s.Text,{className:"woocommerce-recommended-shipping__header-heading",variant:"caption",as:"p",size:"12",lineHeight:"16px"},Object(o.__)('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'))),Object(i.createElement)("ul",{className:"woocommerce-list"},i.Children.map(e,e=>Object(i.createElement)("li",{className:"woocommerce-list__item"},e))),Object(i.createElement)(r.CardFooter,null,Object(i.createElement)(r.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},Object(o.__)("See more options",'woocommerce'),Object(i.createElement)(r.VisuallyHidden,null,Object(o.__)("(opens in a new tab)",'woocommerce')),Object(i.createElement)(u.a,{size:18}))));t.default=()=>{const[e,t]=(()=>{const[e,t]=Object(i.useState)([]),{installAndActivatePlugins:c}=Object(n.useDispatch)(j.PLUGINS_STORE_NAME);return[e,i=>e.length>0?Promise.resolve():(t(i),c(i).then(()=>{t([])}).catch(e=>(Object(m.a)(e),t([]),Promise.reject())))]})();return Object(n.useSelect)(e=>e(j.PLUGINS_STORE_NAME).getActivePlugins()).includes("woocommerce-services")?null:Object(i.createElement)(d,null,Object(i.createElement)(T,{pluginsBeingSetup:e,onSetupClick:t}))}}}]);