← Back
Editing: tax-recommendations.js
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[2981],{85703:(e,t,o)=>{o.d(t,{A:()=>c});var n=o(51609),s=o(70226);function i(e,t){let o,s,c=[];for(let n=0;n<e.length;n++){const i=e[n];if("string"!==i.type){if(void 0===t[i.value])throw new Error(`Invalid interpolation, missing component node: \`${i.value}\``);if("object"!=typeof t[i.value])throw new Error(`Invalid interpolation, component node must be a ReactElement or null: \`${i.value}\``);if("componentClose"===i.type)throw new Error(`Missing opening component token: \`${i.value}\``);if("componentOpen"===i.type){o=t[i.value],s=n;break}c.push(t[i.value])}else c.push(i.value)}if(o){const r=function(e,t){const o=t[e];let n=0;for(let s=e+1;s<t.length;s++){const e=t[s];if(e.value===o.value){if("componentOpen"===e.type){n++;continue}if("componentClose"===e.type){if(0===n)return s;n--}}}throw new Error("Missing closing component token `"+o.value+"`")}(s,e),l=i(e.slice(s+1,r),t),a=(0,n.cloneElement)(o,{},l);if(c.push(a),r<e.length-1){const o=i(e.slice(r+1),t);c=c.concat(o)}}return c=c.filter(Boolean),0===c.length?null:1===c.length?c[0]:(0,n.createElement)(n.Fragment,null,...c)}function c(e){const{mixedString:t,components:o,throwErrors:n}=e;if(!o)return t;if("object"!=typeof o){if(n)throw new Error(`Interpolation Error: unable to process \`${t}\` because components is not an object`);return t}const c=(0,s.A)(t);try{return i(c,o)}catch(e){if(n)throw new Error(`Interpolation Error: unable to process \`${t}\` because of error \`${e.message}\``);return t}}},70226:(e,t,o)=>{function n(e){return e.startsWith("{{/")?{type:"componentClose",value:e.replace(/\W/g,"")}:e.endsWith("/}}")?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.startsWith("{{")?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}function s(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(n)}o.d(t,{A:()=>s})},99985:(e,t,o)=>{o.d(t,{d:()=>a});var n=o(14908),s=o(85703),i=o(98846),c=o(83306),r=o(27723),l=o(39793);const a=({textProps:e,message:t,eventName:o="",eventProperties:a={},targetUrl:m,linkType:d="wc-admin",target:u,onClickCallback:p})=>{const g=t.match(/{{Link}}(.*?){{\/Link}}/),h=g?g[1]:"",x="external"===d&&"_blank"===u;return(0,l.jsx)(n.Text,{...e,children:(0,s.A)({mixedString:t,components:{Link:(0,l.jsx)(i.Link,{onClickCapture:()=>{p?p():(0,c.recordEvent)(o,a)},onClick:()=>{if("external"!==d)return window.location.href=m,!1},href:m,type:d,target:x?"_blank":void 0,"aria-label":x?`${h} (${(0,r.__)("opens in a new tab","woocommerce")})`:void 0})}})})}},90165:(e,t,o)=>{function n(e=""){return e?e.split(":")[0]:null}function s(e,t,o=!1,n){return function(e,t=!1,o,n){const s=[];return n?((e.product_types||[]).forEach(e=>{n[e]&&n[e].product&&(t||!o.includes(n[e].slug))&&s.push(n[e])}),s):s}(t,o,n,e).map(e=>e.id||e.product)}o.d(t,{Dr:()=>s,gI:()=>n}),o(18537)},14227:(e,t,o)=>{o.d(t,{N:()=>m,R:()=>d});var n=o(56427),s=o(86087),i=o(20195),c=o(98846),r=o(27723),l=o(4921),a=o(39793);const m=({onDismiss:e=()=>null,children:t})=>(0,a.jsxs)(n.CardHeader,{children:[(0,a.jsx)("div",{className:"woocommerce-dismissable-list__header",children:t}),(0,a.jsx)("div",{children:(0,a.jsx)(c.EllipsisMenu,{label:(0,r.__)("Task List Options","woocommerce"),renderContent:()=>(0,a.jsx)("div",{className:"woocommerce-dismissable-list__controls",children:(0,a.jsx)(n.Button,{onClick:e,children:(0,r.__)("Hide this","woocommerce")})})})})]}),d=({children:e,className:t,isDismissed:o})=>{const c=(0,s.useRef)(null),m=(0,s.useRef)(o);return(0,s.useEffect)(()=>{o&&!m.current&&((0,i.speak)((0,r.__)("Recommendation hidden.","woocommerce"),"assertive"),c.current?.focus()),m.current=o},[o]),(0,a.jsx)("div",{ref:c,tabIndex:-1,className:"woocommerce-dismissable-list__wrapper",children:!o&&(0,a.jsx)(n.Card,{size:"medium",className:(0,l.A)("woocommerce-dismissable-list",t),children:e})})}},75:(e,t,o)=>{o.d(t,{Bo:()=>s,El:()=>r,Ud:()=>c,_:()=>l});var n=o(15703);const s=["woocommerce-services"],i=["US","CA","AU","GB","AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE"],c=(e,t=!0)=>{const{woocommerce_store_address:o,woocommerce_default_country:n,woocommerce_store_postcode:s}=e;return t?Boolean(o&&n&&s):Boolean(o&&n)},r=()=>{window.location.href=(0,n.getAdminLink)("admin.php?page=wc-settings&tab=tax§ion=standard&wc_onboarding_active_task=tax")},l=e=>!!e&&i.includes(e.trim().toUpperCase())},54102:(e,t,o)=>{o.r(t),o.d(t,{default:()=>b});var n=o(56427),s=o(47143),i=o(86087),c=o(27723),r=o(14908),l=o(40314),a=o(15703),m=o(83306),d=o(45154),u=o(60215),p=o(14227),g=o(75),h=o(99985),x=o(90165),_=o(70288),w=o(1455),v=o.n(w),f=o(39793);const A=({pluginSlug:e,isPluginInstalled:t,isPluginActive:o,pluginsBeingSetup:i,onInstallClick:r,onActivateClick:l,title:a,description:d,productUrl:u,logo:p})=>{const{createSuccessNotice:g}=(0,s.useDispatch)("core/notices");return(0,f.jsxs)("div",{className:"woocommerce-list__item-inner woocommerce-tax-recommendation-item",children:[(0,f.jsx)("div",{className:"woocommerce-list__item-before",children:p}),(0,f.jsxs)("div",{className:"woocommerce-list__item-text",children:[(0,f.jsx)("span",{className:"woocommerce-list__item-title",children:a}),(0,f.jsxs)("span",{className:"woocommerce-list__item-content",children:[d,(0,f.jsx)("br",{}),(0,f.jsx)(n.ExternalLink,{href:u,onClick:()=>{(0,m.recordEvent)("settings_tax_recommendation_click",{extension:a})},children:(0,c.__)("Learn more","woocommerce")})]})]}),(0,f.jsx)("div",{className:"woocommerce-list__item-after",children:o?(0,f.jsx)(n.Button,{variant:"secondary","aria-disabled":"true","aria-label":(0,c.sprintf)((0,c.__)("%s is already active","woocommerce"),a),children:(0,c.__)("Active","woocommerce")}):(0,f.jsx)(n.Button,{variant:t?"primary":"secondary",onClick:()=>{const o={context:"settings",selected_plugin:e};(0,m.recordEvent)("tax_partner_click",o),(0,m.recordEvent)("settings_tax_recommendation_setup_click",{plugin:e,action:t?"activate":"install"});const n=t?"tax_partner_activate":"tax_partner_install";(t?l:r)([e]).then(()=>{(0,m.recordEvent)(n,{...o,success:!0}),g(t?(0,c.sprintf)((0,c.__)("%s activated!","woocommerce"),a):(0,c.sprintf)((0,c.__)("%s is installed!","woocommerce"),a),{})},()=>{(0,m.recordEvent)(n,{...o,success:!1})})},isBusy:i.includes(e),disabled:i.length>0,children:t?(0,c.__)("Activate","woocommerce"):(0,c.__)("Install","woocommerce")})})]})},k=({children:e})=>{const{isDismissed:t,onDismiss:o}=((e,t)=>{const[o,n]=(0,i.useState)(t);return{isDismissed:o,hasResolved:!0,onDismiss:()=>{n(!0),v()({path:"/wc-admin/tax/recommendations/dismiss",method:"POST"}).catch(e=>{n(!1),(0,u.R)(e)})}}})(0,(0,_.Qk)("taxRecommendationsHidden",!1));return(0,f.jsxs)(p.R,{className:"woocommerce-recommended-tax-extensions",isDismissed:t,children:[(0,f.jsxs)(p.N,{onDismiss:o,children:[(0,f.jsx)(r.Text,{variant:"title.small",as:"p",size:"20",lineHeight:"28px",children:(0,c.__)("Recommended tax solutions","woocommerce")}),(0,f.jsx)(r.Text,{className:"woocommerce-recommended-tax__header-heading",variant:"caption",as:"p",size:"12",lineHeight:"16px",children:(0,c.__)("Explore tax extensions that can help automate calculations and compliance for your store.","woocommerce")})]}),(0,f.jsx)("ul",{className:"woocommerce-list",children:i.Children.map(e,e=>(0,f.jsx)("li",{className:"woocommerce-list__item",children:e}))}),(0,f.jsx)(n.CardFooter,{children:(0,f.jsx)(h.d,{message:(0,c.__)("Visit {{Link}}the WooCommerce Marketplace{{/Link}} to find more tax solutions.","woocommerce"),targetUrl:(0,a.getAdminLink)("admin.php?page=wc-admin&tab=extensions&path=/extensions&category=operations"),linkType:"wc-admin",eventName:"settings_tax_recommendation_visit_marketplace_click"})})]})},j=(e,t,o)=>e.find(e=>o.includes(e)||t.includes(e))??e[0],b=()=>{const[e,t,o]=(()=>{const[e,t]=(0,i.useState)([]),{installPlugins:o,activatePlugins:n}=(0,s.useDispatch)(l.pluginsStore);return[e,n=>e.length>0?Promise.resolve():(t(n),o(n).then(()=>{t([])}).catch(e=>((0,u.R)(e),t([]),Promise.reject()))),o=>e.length>0?Promise.resolve():(t(o),n(o).then(()=>{t([])}).catch(e=>((0,u.R)(e),t([]),Promise.reject())))]})(),{activePlugins:n,installedPlugins:r,countryCode:a}=(0,s.useSelect)(e=>{const t=e(l.settingsStore).getSettings("general"),{getActivePlugins:o,getInstalledPlugins:n}=e(l.pluginsStore);return{activePlugins:o()??[],installedPlugins:n()??[],countryCode:(0,x.gI)(t.general?.woocommerce_default_country)}},[])??{activePlugins:[],installedPlugins:[],countryCode:""},p=[{id:"woocommerce-tax",title:(0,c.__)("WooCommerce Tax","woocommerce"),description:(0,c.__)("Free, one-click tool to automate essential sales tax on every WooCommerce order.","woocommerce"),productUrl:"https://woocommerce.com/products/tax/",pluginSlugs:["woocommerce-services","woocommerce-tax"],logo:(0,f.jsx)("img",{className:"woocommerce-tax-recommendation-item__logo",src:d,alt:""})},{id:"anrok-tax",title:(0,c.__)("Anrok","woocommerce"),description:(0,c.__)("Advanced tax compliance for growing brands selling within the US and around the globe.","woocommerce"),productUrl:"https://woocommerce.com/products/anrok-tax/",pluginSlugs:["anrok-tax"],logo:(0,f.jsx)("img",{className:"woocommerce-tax-recommendation-item__logo",src:"https://ps.w.org/anrok-tax/assets/icon.svg",alt:""})}].filter(e=>"anrok-tax"===e.id||(0,g._)(a)),h=p.map(e=>e.pluginSlugs[0]).join(","),_=(0,i.useRef)(!1);return(0,i.useEffect)(()=>{a&&p.length>0&&!_.current&&((0,m.recordEvent)("tax_partner_impression",{context:"settings",country:a,plugins:h}),_.current=!0)},[a,h,p.length]),(0,f.jsx)("div",{className:"woocommerce-recommended-tax-extensions-wrapper",children:(0,f.jsx)(k,{children:p.map(s=>{const i=s.pluginSlugs.some(e=>n.includes(e)),c=i||s.pluginSlugs.some(e=>r.includes(e));return(0,f.jsx)(A,{pluginSlug:j(s.pluginSlugs,r,n),isPluginInstalled:c,isPluginActive:i,pluginsBeingSetup:e,onInstallClick:t,onActivateClick:o,...s},s.id)})})})}},45154:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHwAAABACAMAAADveONaAAAAAXNSR0IArs4c6QAAADBQTFRFR3BMhjr/hzb/hTb/iDf/hTj/iTn/gzn/iTr/iTz/hjz/hzz/sif/h0D/hz7/hj3/IeVDjAAAAA50Uk5TABAgMkVcdY2gwNns7/4fEp0yAAADc0lEQVR42u1YCW7EIAwkCTmA2vP/31YsZMyR7QOqjNRK6xiPxzbOat2LFy9evHjx4j9guRK0Il2ra+FDSmHr3c80uS1HSEjhoHWGP2PSeO29NSiUENXYxEyKbIuTO5AWemWTaLYq4uYesAOK4gCcjtiyqQFw8Vkqj1r/gNsvVOoIdMfT+kCN1kPJEGnns4VEqDLlNh3FhOz2IdkVTL44C1O9s6sn1P7f8XjYAtTUNwB3PncxhcKBbDtLYAMUitByZ8ugXCEr69gBsrEmdPfFdDFTQDI3qoEoTKHlnl3IvgpG5YXcwx6Ir5FAblxW8ym2dTWNLsy9qFERkcajKo+YlF8NN1a3sAkjO/t0QJ8BJN5zlo/kntxUvpoJONmElpPJRVdOjOXm+ZwfcdKnWGMbuSgPNoFIn8gcSKiIqo61slJlBSpl2m5LQy6d8h2T8k2NW/fPtHHE5MhnEkD+UKbNihK3XGRYDHxVnlruoiMoySRwKPgxg/mUgfLNR8/pZ87Xg3JsZR82gHfOK8ieXdauwRVMEPCsOhR68O6N0mfyBB2VR9ixMxdZikvpgZsW05mP2GjP+ekDObC5fZhjeNaC2/agSHGGyHEKbqlRbOsMd+ZRee04lPE9hVPpyWSiM1z0Cm5Rnjgcsaj+qfxgclROE99nJNdHcm3IVfeWnAcfyRPqm4tN8xwC7v6T/i15uPmycrLI2ZDjWXlFYGEOyiC3ogbahQtldQS0uUgse5vfDqp4Uq4of9h3jIvR3u1ejWeKDOBgGbRbKAL8cdX42ofbYaapfVQOeJbUbItzB6g9kkcp6OeJnGvCyMndLhSQSo56yy1yzJ9ZGyDZoVv5/o0c2X0kB6etLXFpUwpRTWhtRYLtOJUQkjY+6r6Ta96yIzesvf0ahErnJ3UuQJN1j4vnkZz13QW9VRZn2BlszJEzmKiU7EzGGQ7BXF/fBbU22ZqGzgC4dzbFl/SEoQYeaC3KJrBkObPEcvd0zFFWasJjgpA+lIA09v05Af0Y9FgVrCuPAtL4nRgSxCdSch0S2BIrSqjBoeCFGrXzWHXUqtu0K9C2HtQ9SIciI1hKgKIIovGx7yiS5sCbXcnqN4xO/w1ewthWcs9YI2xbA2lzEw5kdDdhxlkUpnU+ieTdVxypKvo5ly8Zhrt80b8/Srx48eLFixf/Cb+l1I2Mp+sD/wAAAABJRU5ErkJggg=="}}]);
Save File
Cancel