1 line
75 KiB
JavaScript
1 line
75 KiB
JavaScript
(window.__wcAdmin_webpackJsonp=window.__wcAdmin_webpackJsonp||[]).push([[47],{277:function(e,t,o){"use strict";var r=o(0),s=o(8),n=Object(r.createElement)(s.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(s.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"}));t.a=n},278:function(e,t,o){"use strict";var r=o(0),s=o(8),n=Object(r.createElement)(s.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(s.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));t.a=n},501:function(e,t,o){"use strict";o.d(t,"b",(function(){return l})),o.d(t,"a",(function(){return m}));var r=o(0),s=o(30),n=o(89),c=o.n(n),i=o(13);const a=c()(i.a),l=e=>{const t=a.getCurrencyConfig(),o=Object(s.applyFilters)("woocommerce_admin_report_currency",t,e);return c()(o)},m=Object(r.createContext)(a)},507:function(e,t,o){"use strict";o.d(t,"a",(function(){return s}));var r=o(7);function s(e){const{createNotice:t}=Object(r.dispatch)("core/notices");e.error_data&&e.errors&&Object.keys(e.errors).length?Object.keys(e.errors).forEach(o=>{t("error",e.errors[o].join(" "))}):e.message&&t(e.code?"error":"success",e.message)}},509:function(e,t,o){"use strict";var r=o(53);const s=["a","b","em","i","strong","p","br"],n=["target","href","rel","name","download"];t.a=e=>({__html:Object(r.sanitize)(e,{ALLOWED_TAGS:s,ALLOWED_ATTR:n})})},514:function(e,t,o){"use strict";var r=o(0),s=o(2),n=o(14),c=o(7),i=o(18),a=o.n(i),l=o(3),m=o(21),d=o(11),u=o(122);class p extends r.Component{constructor(e){super(e),this.state={isLoadingScripts:!1,isRequestStarted:!1}}async componentDidUpdate(e,t){const{hasErrors:o,isRequesting:r,onClose:n,onContinue:c,createNotice:i}=this.props,{isLoadingScripts:a,isRequestStarted:l}=this.state;if(!l)return;const m=!r&&!a&&(e.isRequesting||t.isLoadingScripts)&&!o,d=!r&&e.isRequesting&&o;m&&(n(),c()),d&&(i("error",Object(s.__)("There was a problem updating your preferences",'woocommerce')),n())}updateTracking({allowTracking:e}){const{updateOptions:t}=this.props;e&&"function"==typeof window.wcTracks.enable?(this.setState({isLoadingScripts:!0}),window.wcTracks.enable(()=>{this._isMounted&&(Object(u.initializeExPlat)(),this.setState({isLoadingScripts:!1}))})):e||(window.wcTracks.isEnabled=!1);const o=e?"yes":"no";this.setState({isRequestStarted:!0}),t({woocommerce_allow_tracking:o})}componentDidMount(){this._isMounted=!0}componentWillUnmount(){this._isMounted=!1}render(){const{allowTracking:e,isResolving:t,onClose:o,onContinue:n}=this.props;if(t)return null;if(e)return o(),n(),null;const{isRequesting:c,title:i=Object(s.__)("Build a better WooCommerce",'woocommerce'),message:d=a()({mixedString:Object(s.__)("Get improved features and faster fixes by sharing non-sensitive data via {{link}}usage tracking{{/link}} that shows us how WooCommerce is used. No personal data is tracked or stored.",'woocommerce'),components:{link:Object(r.createElement)(m.Link,{href:"https://woocommerce.com/usage-tracking?utm_medium=product",target:"_blank",type:"external"})}}),dismissActionText:u=Object(s.__)("No thanks",'woocommerce'),acceptActionText:p=Object(s.__)("Yes, count me in!",'woocommerce')}=this.props,{isRequestStarted:b}=this.state,h=b&&c;return Object(r.createElement)(l.Modal,{title:i,isDismissible:this.props.isDismissible,onRequestClose:()=>this.props.onClose(),className:"woocommerce-usage-modal"},Object(r.createElement)("div",{className:"woocommerce-usage-modal__wrapper"},Object(r.createElement)("div",{className:"woocommerce-usage-modal__message"},d),Object(r.createElement)("div",{className:"woocommerce-usage-modal__actions"},Object(r.createElement)(l.Button,{isSecondary:!0,isBusy:h,onClick:()=>this.updateTracking({allowTracking:!1})},u),Object(r.createElement)(l.Button,{isPrimary:!0,isBusy:h,onClick:()=>this.updateTracking({allowTracking:!0})},p))))}}t.a=Object(n.compose)(Object(c.withSelect)(e=>{const{getOption:t,getOptionsUpdatingError:o,isOptionsUpdating:r,hasFinishedResolution:s}=e(d.OPTIONS_STORE_NAME);return{allowTracking:"yes"===t("woocommerce_allow_tracking"),isRequesting:Boolean(r()),isResolving:!s("getOption",["woocommerce_allow_tracking"])||void 0===t("woocommerce_allow_tracking"),hasErrors:Boolean(o())}}),Object(c.withDispatch)(e=>{const{createNotice:t}=e("core/notices"),{updateOptions:o}=e(d.OPTIONS_STORE_NAME);return{createNotice:t,updateOptions:o}}))(p)},526:function(e,t,o){"use strict";o.d(t,"a",(function(){return r})),o.d(t,"b",(function(){return s}));const r=(e,t,o="undefined")=>e&&Array.isArray(e)&&e.length?t?e.reduce((e,r)=>(r[t]||(r[t]=o),(e[r[t]]=e[r[t]]||[]).push(r),e),{}):e:{},s=(e,t)=>Object.entries(e).reduce((e,[o])=>({...e,[o]:t}),{})},527:function(e,t,o){"use strict";o.d(t,"b",(function(){return u})),o.d(t,"a",(function(){return p}));var r=o(35),s=o.n(r),n=o(0),c=o(2),i=o(28),a=o(4),l=o(13),m=o(21);const{countries:d}=Object(l.f)("dataEndpoints",{countries:{}});function u(e){const t={};return e.addressLine1.trim().length||(t.addressLine1=Object(c.__)("Please add an address",'woocommerce')),e.countryState.trim().length||(t.countryState=Object(c.__)("Please select a country / region",'woocommerce')),e.city.trim().length||(t.city=Object(c.__)("Please add a city",'woocommerce')),e.postCode.trim().length||(t.postCode=Object(c.__)("Please add a post code",'woocommerce')),t}function p(e){const{getInputProps:t,setValue:o}=e,r=Object(n.useMemo)(()=>d.reduce((e,t)=>{if(!t.states.length)return e.push({key:t.code,label:Object(i.decodeEntities)(t.name)}),e;const o=t.states.map(e=>({key:t.code+":"+e.code,label:Object(i.decodeEntities)(t.name)+" — "+Object(i.decodeEntities)(e.name)}));return e.push(...o),e},[]),[]),l=function(e,t,o){const[r,s]=Object(n.useState)(""),[c,i]=Object(n.useState)(""),l=Object(n.useRef)();return Object(n.useEffect)(()=>{const o=e.find(e=>e.key===t),n=o?o.label.split(/\u2013|\u2014|\-/):[],a=(n[0]||"").trim(),m=(n[1]||"").trim();l.current||a===r&&m===c||(s(a),i(m)),l.current=!1},[t]),Object(n.useEffect)(()=>{r||c||!t||(l.current=!0,o("countryState",""));let s=[];const n=new RegExp(Object(a.escapeRegExp)(r),"i"),i=new RegExp(Object(a.escapeRegExp)(c.replace(/\s/g,""))+"$","i");if((c.length||r.length)&&(s=e.filter(e=>(r.length?n:i).test(e.label))),r.length&&c.length){const e=c.length<3;s=s.filter(t=>i.test((e?t.key:t.label).replace("-","").replace(/\s/g,"")));const t=r.length<3;if(s.length>1){let e=[];e=s.filter(e=>n.test(t?e.key:e.label)),e.length>0&&(s=e)}if(s.length>1){let t=[];t=s.filter(t=>i.test((e?t.key:t.label).replace("-","").replace(/\s/g,""))),1===t.length&&(s=t)}}1===s.length&&t!==s[0].key&&(l.current=!0,o("countryState",s[0].key))},[r,c,e,o]),Object(n.createElement)(n.Fragment,null,Object(n.createElement)("input",{onChange:e=>s(e.target.value),value:r,name:"country",type:"text",className:"woocommerce-select-control__autofill-input",tabIndex:"-1",autoComplete:"country"}),Object(n.createElement)("input",{onChange:e=>i(e.target.value),value:c,name:"state",type:"text",className:"woocommerce-select-control__autofill-input",tabIndex:"-1",autoComplete:"address-level1"}))}(r,t("countryState").value,o);return Object(n.createElement)("div",{className:"woocommerce-store-address-fields"},Object(n.createElement)(m.TextControl,s()({label:Object(c.__)("Address line 1",'woocommerce'),required:!0,autoComplete:"address-line1"},t("addressLine1"))),Object(n.createElement)(m.TextControl,s()({label:Object(c.__)("Address line 2 (optional)",'woocommerce'),required:!0,autoComplete:"address-line2"},t("addressLine2"))),Object(n.createElement)(m.SelectControl,s()({label:Object(c.__)("Country / Region",'woocommerce'),required:!0,autoComplete:"new-password",options:r,excludeSelectedOptions:!1,showAllOnFocus:!0,isSearchable:!0},t("countryState"),{controlClassName:t("countryState").className}),l),Object(n.createElement)(m.TextControl,s()({label:Object(c.__)("City",'woocommerce'),required:!0},t("city"),{autoComplete:"address-level2"})),Object(n.createElement)(m.TextControl,s()({label:Object(c.__)("Post code",'woocommerce'),required:!0,autoComplete:"postal-code"},t("postCode"))))}},569:function(e,t,o){},570:function(e,t,o){},571:function(e,t,o){},572:function(e,t,o){},573:function(e,t,o){},574:function(e,t,o){"use strict";var r=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,o=e.size,s=void 0===o?24:o,n=e.onClick,i=(e.icon,e.className),a=function(e,t){var o={};for(var r in e)0<=t.indexOf(r)||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["size","onClick","icon","className"]),l=["gridicon","gridicons-info",i,(t=s,!(0!=t%18)&&"needs-offset"),!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",r({className:l,height:s,width:s,onClick:n},a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})))};var s,n=o(5),c=(s=n)&&s.__esModule?s:{default:s};e.exports=t.default},575:function(e,t,o){},576:function(e,t,o){"use strict";var r=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.size,o=void 0===t?24:t,s=e.onClick,n=(e.icon,e.className),i=function(e,t){var o={};for(var r in e)0<=t.indexOf(r)||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["size","onClick","icon","className"]),a=["gridicon","gridicons-cloud-upload",n,!1,!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",r({className:a,height:o,width:o,onClick:s},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M18 9c-.01 0-.017.002-.025.003C17.72 5.646 14.922 3 11.5 3 7.91 3 5 5.91 5 9.5c0 .524.07 1.03.186 1.52C5.123 11.015 5.064 11 5 11c-2.21 0-4 1.79-4 4 0 1.202.54 2.267 1.38 3h18.593C22.196 17.09 23 15.643 23 14c0-2.76-2.24-5-5-5zm-5 4v3h-2v-3H8l4-5 4 5h-3z"})))};var s,n=o(5),c=(s=n)&&s.__esModule?s:{default:s};e.exports=t.default},577:function(e,t,o){"use strict";var r=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.size,o=void 0===t?24:t,s=e.onClick,n=(e.icon,e.className),i=function(e,t){var o={};for(var r in e)0<=t.indexOf(r)||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["size","onClick","icon","className"]),a=["gridicon","gridicons-phone",n,!1,!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",r({className:a,height:o,width:o,onClick:s},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M16 2H8c-1.104 0-2 .896-2 2v16c0 1.104.896 2 2 2h8c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm-3 19h-2v-1h2v1zm3-2H8V5h8v14z"})))};var s,n=o(5),c=(s=n)&&s.__esModule?s:{default:s};e.exports=t.default},578:function(e,t,o){"use strict";var r=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.size,o=void 0===t?24:t,s=e.onClick,n=(e.icon,e.className),i=function(e,t){var o={};for(var r in e)0<=t.indexOf(r)||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["size","onClick","icon","className"]),a=["gridicon","gridicons-tablet",n,!1,!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",r({className:a,height:o,width:o,onClick:s},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M18 2H6c-1.104 0-2 .896-2 2v16c0 1.104.896 2 2 2h12c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm-5 19h-2v-1h2v1zm5-2H6V5h12v14z"})))};var s,n=o(5),c=(s=n)&&s.__esModule?s:{default:s};e.exports=t.default},579:function(e,t,o){"use strict";var r=Object.assign||function(e){for(var t,o=1;o<arguments.length;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.size,o=void 0===t?24:t,s=e.onClick,n=(e.icon,e.className),i=function(e,t){var o={};for(var r in e)0<=t.indexOf(r)||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["size","onClick","icon","className"]),a=["gridicon","gridicons-computer",n,!1,!1,!1].filter(Boolean).join(" ");return c.default.createElement("svg",r({className:a,height:o,width:o,onClick:s},i,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"}),c.default.createElement("g",null,c.default.createElement("path",{d:"M20 2H4c-1.104 0-2 .896-2 2v12c0 1.104.896 2 2 2h6v2H7v2h10v-2h-3v-2h6c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm0 14H4V4h16v12z"})))};var s,n=o(5),c=(s=n)&&s.__esModule?s:{default:s};e.exports=t.default},580:function(e,t,o){},607:function(e,t,o){"use strict";o.r(t);var r=o(0);t.default=({})=>Object(r.createElement)("div",null,"Settings page")},613:function(e,t,o){"use strict";o.r(t);var r=o(0),s=o(2),n=o(30),c=o(14),i=o(4),a=o(7),l=o(12),m=o(11),d=o(16),u=o(13),p=o(35),b=o.n(p),h=o(21),_=o(3),O=o(501),g=o(507);const j=[{key:"shopify",label:Object(s.__)("Shopify",'woocommerce')},{key:"bigcommerce",label:Object(s.__)("BigCommerce",'woocommerce')},{key:"magento",label:Object(s.__)("Magento",'woocommerce')},{key:"wix",label:Object(s.__)("Wix",'woocommerce')},{key:"amazon",label:Object(s.__)("Amazon",'woocommerce')},{key:"ebay",label:Object(s.__)("eBay",'woocommerce')},{key:"etsy",label:Object(s.__)("Etsy",'woocommerce')},{key:"squarespace",label:Object(s.__)("Squarespace",'woocommerce')},{key:"other",label:Object(s.__)("Other",'woocommerce')}],w=[{key:"no",label:Object(s.__)("No",'woocommerce')},{key:"other",label:Object(s.__)("Yes, on another platform",'woocommerce')},{key:"other-woocommerce",label:Object(s.__)("Yes, I own a different store powered by WooCommerce",'woocommerce')},{key:"brick-mortar",label:Object(s.__)("Yes, in person at physical stores and/or events",'woocommerce')},{key:"brick-mortar-other",label:Object(s.__)("Yes, on another platform and in person at physical stores and/or events",'woocommerce')}];var f=o(60),C=o(120);const E=(e,t)=>Object(C.formatValue)(e,"number",t),y=(e,t,o=!1,r=E)=>o?Object(s.sprintf)(Object(s._x)("%1$s - %2$s","store product count or revenue range",'woocommerce'),r(e,t),r(e,o)):Object(s.sprintf)(Object(s._x)("%s+","store product count or revenue",'woocommerce'),r(e,t)),v={US:1,EU:.9,IN:71.24,GB:.76,BR:4.19,VN:23172.5,ID:14031,BD:84.87,PK:154.8,RU:63.74,TR:5.75,MX:19.37,CA:1.32},S=(e,t)=>{const o=Object(f.c)(t);if("US"===o)return e;const r=v[o]||v.US,s=r.toString().split(".")[0].length,n=Math.pow(10,2+s);return Math.round(e*r/n)*n},k=(e,t,o)=>[{key:"none",label:Object(s.sprintf)(Object(s.__)("%s (I'm just getting started)",'woocommerce'),o(0))},{key:"up-to-2500",label:Object(s.sprintf)(Object(s.__)("Up to %s",'woocommerce'),o(S(2500,t)))},{key:"2500-10000",label:y(e,S(2500,t),S(1e4,t),(e,t)=>o(t))},{key:"10000-50000",label:y(e,S(1e4,t),S(5e4,t),(e,t)=>o(t))},{key:"50000-250000",label:y(e,S(5e4,t),S(25e4,t),(e,t)=>o(t))},{key:"more-than-250000",label:Object(s.sprintf)(Object(s.__)("More than %s",'woocommerce'),o(S(25e4,t)))},{key:"rather-not-say",label:Object(s.__)("I'd rather not say",'woocommerce')}];var N=o(20),T=o(116),P=o(277),x=o(278),I=o(18),M=o.n(I);const A=()=>Object(r.createElement)("svg",{width:"200",height:"148",viewBox:"0 0 200 148",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)("g",{clipPath:"url(#clip0)"},Object(r.createElement)("path",{d:"M197.563 2.53875e-09H62.909C62.3961 0.000450584 61.9043 0.205742 61.5416 0.570805C61.179 0.935868 60.975 1.43087 60.9746 1.94714V50.9404H93.5623C94.4445 50.9415 95.2902 51.2947 95.9141 51.9226C96.5379 52.5505 96.8888 53.4019 96.8899 54.2899V95.7402H197.563C197.843 95.7402 198.119 95.6791 198.373 95.5612C198.627 95.4432 198.853 95.2712 199.034 95.0569C199.05 95.0402 199.064 95.0222 199.076 95.0033C199.192 94.8612 199.285 94.7024 199.354 94.5322C199.451 94.2981 199.501 94.0468 199.5 93.7931V1.94714C199.499 1.43051 199.295 0.935241 198.932 0.57014C198.569 0.20504 198.077 -2.63458e-05 197.563 2.53875e-09Z",fill:"#F2F2F2"}),Object(r.createElement)("path",{d:"M199.222 7.80469H61.25V8.36132H199.222V7.80469Z",fill:"#CCCCCC"}),Object(r.createElement)("path",{d:"M65.95 5.84371C66.8662 5.84371 67.609 5.09607 67.609 4.17381C67.609 3.25155 66.8662 2.50391 65.95 2.50391C65.0338 2.50391 64.291 3.25155 64.291 4.17381C64.291 5.09607 65.0338 5.84371 65.95 5.84371Z",fill:"#CCCCCC"}),Object(r.createElement)("path",{d:"M70.72 5.84371C71.6363 5.84371 72.379 5.09607 72.379 4.17381C72.379 3.25155 71.6363 2.50391 70.72 2.50391C69.8038 2.50391 69.061 3.25155 69.061 4.17381C69.061 5.09607 69.8038 5.84371 70.72 5.84371Z",fill:"#CCCCCC"}),Object(r.createElement)("path",{d:"M75.4896 5.84371C76.4058 5.84371 77.1486 5.09607 77.1486 4.17381C77.1486 3.25155 76.4058 2.50391 75.4896 2.50391C74.5733 2.50391 73.8306 3.25155 73.8306 4.17381C73.8306 5.09607 74.5733 5.84371 75.4896 5.84371Z",fill:"#CCCCCC"}),Object(r.createElement)("path",{d:"M164.842 19.957H95.6295C94.8646 19.957 94.1311 20.2629 93.5903 20.8073C93.0494 21.3516 92.7456 22.09 92.7456 22.8599C92.7456 23.6298 93.0494 24.3681 93.5903 24.9125C94.1311 25.4569 94.8646 25.7627 95.6295 25.7627H164.842C165.607 25.7627 166.341 25.4569 166.882 24.9125C167.422 24.3681 167.726 23.6298 167.726 22.8599C167.726 22.09 167.422 21.3516 166.882 20.8073C166.341 20.2629 165.607 19.957 164.842 19.957ZM164.842 25.3161H95.6295C94.9823 25.3161 94.3616 25.0573 93.904 24.5967C93.4464 24.1361 93.1893 23.5113 93.1893 22.8599C93.1893 22.2084 93.4464 21.5837 93.904 21.123C94.3616 20.6624 94.9823 20.4036 95.6295 20.4036H164.842C165.489 20.4036 166.11 20.6624 166.568 21.123C167.025 21.5837 167.283 22.2084 167.283 22.8599C167.283 23.5113 167.025 24.1361 166.568 24.5967C166.11 25.0573 165.489 25.3161 164.842 25.3161Z",fill:"#CCCCCC"}),Object(r.createElement)("path",{d:"M186.022 43.0859H116.809C116.044 43.0859 115.31 43.3918 114.769 43.9362C114.229 44.4806 113.925 45.2189 113.925 45.9888C113.925 46.7587 114.229 47.497 114.769 48.0414C115.31 48.5858 116.044 48.8916 116.809 48.8916H186.022C186.786 48.8916 187.52 48.5858 188.061 48.0414C188.602 47.497 188.905 46.7587 188.905 45.9888C188.905 45.2189 188.602 44.4806 188.061 43.9362C187.52 43.3918 186.786 43.0859 186.022 43.0859Z",fill:"white"}),Object(r.createElement)("path",{d:"M186.022 53.8047H116.809C116.044 53.8047 115.31 54.1105 114.769 54.6549C114.229 55.1993 113.925 55.9376 113.925 56.7075C113.925 57.4774 114.229 58.2158 114.769 58.7601C115.31 59.3045 116.044 59.6104 116.809 59.6104H186.022C186.786 59.6104 187.52 59.3045 188.061 58.7601C188.602 58.2158 188.905 57.4774 188.905 56.7075C188.905 55.9376 188.602 55.1993 188.061 54.6549C187.52 54.1105 186.786 53.8047 186.022 53.8047Z",fill:"white"}),Object(r.createElement)("path",{d:"M186.022 64.5195H116.809C116.044 64.5195 115.31 64.8254 114.769 65.3698C114.229 65.9141 113.925 66.6525 113.925 67.4224C113.925 68.1923 114.229 68.9306 114.769 69.475C115.31 70.0194 116.044 70.3252 116.809 70.3252H186.022C186.786 70.3252 187.52 70.0194 188.061 69.475C188.602 68.9306 188.905 68.1923 188.905 67.4224C188.905 66.6525 188.602 65.9141 188.061 65.3698C187.52 64.8254 186.786 64.5195 186.022 64.5195Z",fill:"white"}),Object(r.createElement)("path",{d:"M105.623 38.2852H74.1183C73.4425 38.286 72.7947 38.5565 72.3168 39.0375C71.839 39.5185 71.5702 40.1706 71.5693 40.8508V50.9416H72.013V40.8508C72.0139 40.2891 72.2359 39.7506 72.6306 39.3533C73.0252 38.9561 73.5602 38.7326 74.1183 38.7317H105.623C106.182 38.7322 106.717 38.9556 107.112 39.3529C107.506 39.7502 107.728 40.289 107.729 40.8508V72.5633C107.728 73.1251 107.506 73.6638 107.112 74.0611C106.717 74.4585 106.182 74.6819 105.623 74.6824H96.8897V75.1289H105.623C106.299 75.1285 106.947 74.858 107.425 74.377C107.903 73.8959 108.172 73.2436 108.172 72.5633V40.8508C108.172 40.1705 107.903 39.5182 107.425 39.0371C106.947 38.556 106.299 38.2856 105.623 38.2852Z",fill:"#CCCCCC"}),Object(r.createElement)("path",{d:"M23.9309 70.9116C23.8195 70.9162 19.0705 70.5847 18.9492 70.5806L19.3758 66.294L22.0808 66.212L27.2495 56.5756C26.5327 55.1996 27.4148 53.3739 28.9355 53.0925C32 52.3914 33.0526 57.2443 29.9789 57.8901L25.7036 69.6652C25.5695 70.03 25.3278 70.3449 25.011 70.5676C24.6942 70.7904 24.3174 70.9104 23.9309 70.9116Z",fill:"#FFB8B8"}),Object(r.createElement)("path",{d:"M11.4107 73.118C6.89154 73.1291 6.49482 66.2544 11.024 65.7699C23.0006 65.0415 21.485 62.0137 22.3945 70.9448C22.4224 71.2097 22.3448 71.475 22.1787 71.6824C22.0126 71.8898 21.7715 72.0223 21.5084 72.051L11.803 73.0968C11.6727 73.1109 11.5417 73.1179 11.4107 73.118Z",className:"fill-theme-color"}),Object(r.createElement)("path",{d:"M10.3793 51.3852C16.605 54.9512 11.494 64.3601 5.15222 61.0097C-1.0733 57.4438 4.03771 48.0349 10.3793 51.3852Z",fill:"#FFB8B8"}),Object(r.createElement)("path",{d:"M16.0395 132.376L18.759 132.376L20.053 121.816L16.0391 121.817L16.0395 132.376Z",fill:"#FFB8B8"}),Object(r.createElement)("path",{d:"M15.4567 134.915L24.0042 134.915C23.9716 130.476 18.2546 131.755 15.4565 131.591L15.4567 134.915Z",fill:"#2F2E41"}),Object(r.createElement)("path",{d:"M4.28218 132.376L7.00167 132.376L8.29564 121.816L4.28174 121.817L4.28218 132.376Z",fill:"#FFB8B8"}),Object(r.createElement)("path",{d:"M3.69937 134.915L12.2469 134.915C12.2142 130.476 6.49728 131.755 3.69922 131.591L3.69937 134.915Z",fill:"#2F2E41"}),Object(r.createElement)("path",{d:"M7.37266 128.688C6.71536 128.507 3.14362 129.056 2.72209 128.335C1.24999 113.483 1.57722 98.9486 4.845 90.9619L16.0806 90.2695C18.5931 94.8863 24.3684 125.522 20.8847 127.385L16.4048 127.546C16.1493 127.554 15.8988 127.474 15.6952 127.318C15.4916 127.163 15.3475 126.941 15.2869 126.691L11.539 105.229C10.6057 103.916 8.77111 127.832 8.46815 127.742C8.42864 128.006 8.29626 128.247 8.09515 128.42C7.89404 128.594 7.63762 128.689 7.37266 128.688Z",fill:"#2F2E41"}),Object(r.createElement)("path",{d:"M4.48843 92.8373C-1.18427 86.8634 2.43414 70.8475 2.25101 71.1881C2.26655 70.7958 3.55141 64.7536 6.87506 63.762C9.51196 62.886 12.4305 65.5063 12.7906 68.1566L16.7406 91.6368C16.7611 91.7646 16.7514 91.8955 16.7123 92.0188C16.6733 92.1422 16.6059 92.2546 16.5158 92.3469C16.71 92.9556 4.76613 92.7153 4.48843 92.8373Z",className:"fill-theme-color"}),Object(r.createElement)("path",{d:"M6.32941 55.5845C6.82759 55.2675 7.07312 54.7238 7.36309 54.2285C8.89053 53.3522 10.6464 55.472 12.262 54.6809C16.8302 50.2665 12.1346 48.9642 7.92721 48.7314C6.9333 48.6081 6.08781 48.963 5.33637 49.5492C-3.06805 48.9031 0.962591 60.1519 6.26679 61.6376C7.2033 62.0505 7.90582 61.2148 7.07994 60.4551C5.93728 59.2493 4.52181 56.8221 6.32941 55.5845Z",fill:"#2F2E41"}),Object(r.createElement)("path",{d:"M93.5621 50.4922H32.779C31.7793 50.4936 30.8209 50.894 30.1139 51.6056C29.407 52.3172 29.0092 53.2819 29.0078 54.2882V131.548C29.0092 132.555 29.407 133.52 30.1139 134.231C30.8209 134.943 31.7793 135.343 32.779 135.345H93.5621C94.5619 135.343 95.5202 134.943 96.2272 134.231C96.9341 133.52 97.3319 132.555 97.3333 131.548V54.2882C97.3319 53.2819 96.9341 52.3172 96.2272 51.6056C95.5202 50.894 94.5619 50.4936 93.5621 50.4922ZM96.8896 131.548C96.8886 132.436 96.5376 133.288 95.9138 133.916C95.29 134.544 94.4443 134.897 93.5621 134.898H32.779C31.8968 134.897 31.0511 134.544 30.4273 133.916C29.8035 133.288 29.4526 132.436 29.4515 131.548V54.2882C29.4526 53.4002 29.8035 52.5489 30.4273 51.921C31.0511 51.2931 31.8968 50.9399 32.779 50.9388H93.5621C94.4443 50.9399 95.29 51.2931 95.9138 51.921C96.5376 52.5489 96.8886 53.4002 96.8896 54.2882V131.548Z",fill:"#3F3D56"}),Object(r.createElement)("path",{d:"M15.6527 83.0043C13.6494 83.2327 12.7698 78.5402 12.0039 77.3445L15.9936 75.7852L17.2918 78.1751L28.168 78.4472C28.2326 78.3591 28.3032 78.2755 28.3793 78.1971C30.5362 75.9238 34.0488 79.33 31.9 81.5984C31.663 81.8519 31.3752 82.0521 31.0557 82.1855C30.7362 82.319 30.3923 82.3828 30.0465 82.3727C29.7007 82.3627 29.361 82.2789 29.0497 82.1271C28.7384 81.9753 28.4626 81.7588 28.2405 81.4918C27.9719 81.5111 15.9153 83.0114 15.6527 83.0043Z",fill:"#FFB8B8"}),Object(r.createElement)("path",{d:"M12.6985 80.7664C12.0314 81.4133 6.91061 72.3318 6.5365 72.0751C3.94893 68.0267 10.0405 64.0298 12.6727 68.0562L17.9961 76.2911C18.1402 76.5145 18.1904 76.7864 18.1356 77.047C18.0808 77.3076 17.9255 77.5357 17.7039 77.6812C17.4613 77.7956 12.8697 81.0123 12.6985 80.7664Z",className:"fill-theme-color"}),Object(r.createElement)("path",{d:"M81.583 103.974H44.7583C40.9966 103.955 40.9809 98.1877 44.7584 98.168H81.583C85.3421 98.1857 85.3624 103.954 81.583 103.974Z",fill:"#CCCCCC"}),Object(r.createElement)("path",{d:"M81.583 114.692H44.7583C40.9966 114.674 40.9809 108.906 44.7584 108.887H81.583C85.3421 108.904 85.3624 114.673 81.583 114.692Z",fill:"#CCCCCC"}),Object(r.createElement)("path",{d:"M81.583 125.411H44.7583C40.9966 125.393 40.9809 119.625 44.7584 119.605H81.583C85.3421 119.623 85.3624 125.391 81.583 125.411Z",fill:"#CCCCCC"}),Object(r.createElement)("path",{d:"M95.3371 57.6387C94.1963 57.6387 93.0812 57.2982 92.1327 56.6603C91.1842 56.0223 90.4449 55.1156 90.0084 54.0548C89.5718 52.9939 89.4576 51.8266 89.6802 50.7004C89.9027 49.5742 90.452 48.5397 91.2587 47.7278C92.0653 46.9159 93.093 46.3629 94.2118 46.1389C95.3307 45.9149 96.4904 46.0299 97.5443 46.4693C98.5982 46.9087 99.499 47.6528 100.133 48.6076C100.767 49.5623 101.105 50.6848 101.105 51.833C101.103 53.3723 100.495 54.8479 99.4136 55.9363C98.3323 57.0247 96.8662 57.637 95.3371 57.6387Z",className:"fill-theme-color"}),Object(r.createElement)("path",{d:"M97.999 51.6121H95.5588V48.821C95.5588 48.7617 95.5355 48.7049 95.4939 48.6631C95.4523 48.6212 95.3958 48.5977 95.337 48.5977C95.2782 48.5977 95.2217 48.6212 95.1801 48.6631C95.1385 48.7049 95.1152 48.7617 95.1152 48.821V51.6121H92.675C92.6161 51.6121 92.5597 51.6357 92.5181 51.6775C92.4765 51.7194 92.4531 51.7762 92.4531 51.8354C92.4531 51.8947 92.4765 51.9515 92.5181 51.9933C92.5597 52.0352 92.6161 52.0587 92.675 52.0587H95.1152V54.8499C95.1152 54.9091 95.1385 54.9659 95.1801 55.0078C95.2217 55.0497 95.2782 55.0732 95.337 55.0732C95.3958 55.0732 95.4523 55.0497 95.4939 55.0078C95.5355 54.9659 95.5588 54.9091 95.5588 54.8499V52.0587H97.999C98.0579 52.0587 98.1143 52.0352 98.1559 51.9933C98.1975 51.9515 98.2209 51.8947 98.2209 51.8354C98.2209 51.7762 98.1975 51.7194 98.1559 51.6775C98.1143 51.6357 98.0579 51.6121 97.999 51.6121Z",fill:"white"}),Object(r.createElement)("path",{d:"M80.9177 91.2002H45.424C44.4535 91.1991 43.5232 90.8105 42.837 90.1198C42.1508 89.4291 41.7648 88.4926 41.7637 87.5158V67.5086C41.7648 66.5318 42.1508 65.5953 42.837 64.9046C43.5232 64.2139 44.4535 63.8253 45.424 63.8242H80.9177C81.8882 63.8253 82.8185 64.2139 83.5047 64.9046C84.1909 65.5953 84.5769 66.5318 84.578 67.5086V87.5158C84.5769 88.4926 84.1909 89.4291 83.5047 90.1198C82.8185 90.8105 81.8882 91.1991 80.9177 91.2002Z",className:"fill-theme-color"})),Object(r.createElement)("defs",null,Object(r.createElement)("clipPath",{id:"clip0"},Object(r.createElement)("rect",{width:"199",height:"148",fill:"white",transform:"translate(0.5)"}))));o(569);var R=o(509),B=o(526);const z=["basics"],F=()=>Object(r.createElement)("div",{className:"woocommerce-admin__business-details__free-badge"},Object(s.__)("Free",'woocommerce')),L=({onChange:e,description:t,isChecked:o})=>Object(r.createElement)("div",{className:"woocommerce-admin__business-details__selective-extensions-bundle__extension"},Object(r.createElement)(_.CheckboxControl,{id:"woocommerce-business-extensions__checkbox",checked:o,onChange:e}),Object(r.createElement)("p",{className:"woocommerce-admin__business-details__selective-extensions-bundle__description",dangerouslySetInnerHTML:Object(R.a)(t),onClick:e=>{const t=e.target.closest("a");t&&e.currentTarget.contains(t)&&t.href.startsWith("https://woocommerce.com/products/")&&Object(d.recordEvent)("storeprofiler_store_business_features_link_click",{extension_name:t.href.split("https://woocommerce.com/products/")[1]})}}),Object(r.createElement)(F,null)),D={install_extensions:!0},V=({isInstallingActivating:e,onSubmit:t})=>{const[o,n]=Object(r.useState)(!1),[c,i]=Object(r.useState)(D),{countryCode:l,freeExtensions:u,isResolving:p,profileItems:b}=Object(a.useSelect)(e=>{const{getFreeExtensions:t,getProfileItems:o,hasFinishedResolution:r}=e(m.ONBOARDING_STORE_NAME),{getSettings:s}=e(m.SETTINGS_STORE_NAME),{general:n={}}=s("general");return{countryCode:Object(f.b)(n.woocommerce_default_country),freeExtensions:t(),isResolving:!r("getFreeExtensions"),profileItems:o()}}),O=Object(r.useMemo)(()=>{const{product_types:e}=b;return u.filter(t=>(window.wcAdminFeatures&&window.wcAdminFeatures.subscriptions&&"US"===l&&e.includes("subscriptions")&&(t.plugins=t.plugins.filter(e=>"woocommerce-payments"!==e.key||"woocommerce-payments"===e.key&&!e.is_activated)),z.includes(t.key)))},[u,b]);Object(r.useEffect)(()=>{if(!e){const e=O.reduce((e,t)=>({...e,...t.plugins.reduce((e,{key:t,selected:o})=>({...e,[t]:null==o||o}),{})}),D);i(e)}},[O]);const g=e=>t=>{const o={...c,[e]:t},r=1===Object.entries(o).filter(([,e])=>e).length&&o.install_extensions;i(r?{...o,install_extensions:!1}:{...c,[e]:t,install_extensions:!0})};return Object(r.createElement)("div",{className:"woocommerce-profile-wizard__business-details__free-features"},Object(r.createElement)(_.Card,null,Object(r.createElement)("div",{className:"woocommerce-profile-wizard__business-details__free-features__illustration"},Object(r.createElement)(A,null)),Object(r.createElement)("div",{className:"woocommerce-admin__business-details__selective-extensions-bundle"},Object(r.createElement)("div",{className:"woocommerce-admin__business-details__selective-extensions-bundle__extension"},Object(r.createElement)(_.CheckboxControl,{checked:c.install_extensions,onChange:e=>{i(Object(B.b)(c,e))}}),Object(r.createElement)("p",{className:"woocommerce-admin__business-details__selective-extensions-bundle__description"},Object(s.__)("Add recommended business features to my site",'woocommerce')),Object(r.createElement)(_.Button,{className:"woocommerce-admin__business-details__selective-extensions-bundle__expand",onClick:()=>{n(!o),o||Object(d.recordEvent)("storeprofiler_store_business_features_accordion_click")}},Object(r.createElement)(T.a,{icon:o?P.a:x.a}))),o&&O.map(({plugins:e,key:t})=>Object(r.createElement)("div",{key:t},p?Object(r.createElement)(_.Spinner,null):e.map(({description:e,key:t})=>Object(r.createElement)(L,{key:t,description:e,isChecked:c[t],onChange:g(t)}))))),Object(r.createElement)("div",{className:"woocommerce-profile-wizard__business-details__free-features__action"},Object(r.createElement)(_.Button,{onClick:()=>{t(c)},isBusy:e,disabled:e,isPrimary:!0},Object(s.__)("Continue",'woocommerce')))),((e,t)=>{const o=Object.keys(e).filter(t=>e[t]&&"install_extensions"!==t);if(0===o.length)return null;const n=o.reduce((e,t)=>{const o=m.pluginNames[t];return e.includes(o)?e:[...e,o]},[]).join(", ");if(t)return Object(r.createElement)("div",{className:"woocommerce-profile-wizard__footnote"},Object(r.createElement)(N.Text,{variant:"caption",as:"p",size:"12",lineHeight:"16px"},Object(s.sprintf)(Object(s._n)("Installing the following plugin: %s","Installing the following plugins: %s",o.length,'woocommerce'),n)));const c=o.includes("jetpack")||o.includes("woocommerce-shipping"),i=Object(s.__)("User accounts are required to use these features.",'woocommerce');return Object(r.createElement)("div",{className:"woocommerce-profile-wizard__footnote"},Object(r.createElement)(N.Text,{variant:"caption",as:"p",size:"12",lineHeight:"16px"},Object(s.sprintf)(Object(s._n)("The following plugin will be installed for free: %1$s. %2$s","The following plugins will be installed for free: %1$s. %2$s",o.length,'woocommerce'),n,i)),c&&Object(r.createElement)(N.Text,{variant:"caption",as:"p",size:"12",lineHeight:"16px"},M()({mixedString:Object(s.__)("By installing Jetpack and WooCommerce Shipping plugins for free you agree to our {{link}}Terms of Service{{/link}}.",'woocommerce'),components:{link:Object(r.createElement)(h.Link,{href:"https://wordpress.com/tos/",target:"_blank",type:"external"})}})))})(c,e))};o(570);class H extends r.Component{constructor(){super(),this.state={isPopoverVisible:!1,isValid:!1,currentTab:"business-details",savedValues:null},this.onContinue=this.onContinue.bind(this),this.validate=this.validate.bind(this)}async onContinue(e){const{createNotice:t,goToNextStep:o,installAndActivatePlugins:r}=this.props,n=(e=>Object.keys(e).filter(t=>e[t]&&"install_extensions"!==t).map(e=>e.split(":")[0]).filter((e,t,o)=>o.indexOf(e)===t))(e);Object(d.recordEvent)("storeprofiler_store_business_features_continue",{all_extensions_installed:Object.values(e).every(e=>e),install_woocommerce_services:e["woocommerce-services:shipping"]||e["woocommerce-services:tax"],install_jetpack:e.jetpack,install_wcpay:e["woocommerce-payments"]});const c=[this.persistProfileItems({business_extensions:n})];n.length&&c.push(r(n).then(e=>{Object(g.a)(e)}).catch(e=>{throw Object(g.a)(e),new Error})),Promise.all(c).then(()=>{o()}).catch(()=>{t("error",Object(s.__)("There was a problem updating your business details",'woocommerce'))})}async persistProfileItems(e={}){const{updateProfileItems:t,createNotice:o}=this.props,{other_platform:r,other_platform_name:n,product_count:c,revenue:i,selling_venues:a,setup_client:l}=this.state.savedValues,m={other_platform:r,other_platform_name:"other"===r?n:"",product_count:c,revenue:i,selling_venues:a,setup_client:l,...e};return t(Object.entries(m).reduce((e,[t,o])=>""!==o?{...e,[t]:o}:e,{})).catch(()=>{o("error",Object(s.__)("There was a problem updating your business details",'woocommerce'))})}validate(e){const t={};return e.product_count.length||(t.product_count=Object(s.__)("This field is required",'woocommerce')),e.selling_venues.length||(t.selling_venues=Object(s.__)("This field is required",'woocommerce')),!e.other_platform.length&&["other","brick-mortar-other"].includes(e.selling_venues)&&(t.other_platform=Object(s.__)("This field is required",'woocommerce')),!e.other_platform_name&&"other"===e.other_platform&&["other","brick-mortar-other"].includes(e.selling_venues)&&(t.other_platform_name=Object(s.__)("This field is required",'woocommerce')),!e.revenue.length&&["other","brick-mortar","brick-mortar-other","other-woocommerce"].includes(e.selling_venues)&&(t.revenue=Object(s.__)("This field is required",'woocommerce')),0===Object.keys(t).length&&this.setState({isValid:!0}),t}trackBusinessDetailsStep({other_platform:e,other_platform_name:t,product_count:o,selling_venues:r,revenue:s,setup_client:n}){const{getCurrencyConfig:c}=this.context;Object(d.recordEvent)("storeprofiler_store_business_details_continue_variant",{already_selling:r,currency:c().code,product_number:o,revenue:s,used_platform:e,used_platform_name:t,setup_client:n})}renderBusinessDetailsStep(){const{goToNextStep:e,isInstallingActivating:t,hasInstallActivateError:o}=this.props,{formatAmount:n,getCurrencyConfig:c}=this.context,i=(a=c(),[{key:"0",label:Object(s.__)("I don't have any products yet.",'woocommerce')},{key:"1-10",label:y(a,1,10)},{key:"11-100",label:y(a,11,100)},{key:"101-1000",label:y(a,101,1e3)},{key:"1000+",label:y(a,1e3)}]);var a;return Object(r.createElement)(h.Form,{initialValues:this.state.savedValues||this.props.initialValues,onSubmit:e=>{this.setState({savedValues:e,currentTab:"free-features"}),this.trackBusinessDetailsStep(e)},onChange:(e,t,o)=>{this.setState({savedValues:t,isValid:o})},validate:this.validate},({getInputProps:a,handleSubmit:l,values:m,isValidForm:d})=>Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"woocommerce-profile-wizard__step-header"},Object(r.createElement)(_.__experimentalText,{variant:"title.small",as:"h2",size:"20",lineHeight:"28px"},Object(s.__)("Tell us about your business",'woocommerce')),Object(r.createElement)(_.__experimentalText,{variant:"body",as:"p"},Object(s.__)("We'd love to know if you are just getting started or you already have a business in place.",'woocommerce'))),Object(r.createElement)(_.Card,null,Object(r.createElement)(_.CardBody,null,Object(r.createElement)(h.SelectControl,b()({excludeSelectedOptions:!1,label:Object(s.__)("How many products do you plan to display?",'woocommerce'),options:i,required:!0},a("product_count"))),Object(r.createElement)(h.SelectControl,b()({excludeSelectedOptions:!1,label:Object(s.__)("Currently selling elsewhere?",'woocommerce'),options:w,required:!0},a("selling_venues"))),["other","brick-mortar","brick-mortar-other","other-woocommerce"].includes(m.selling_venues)&&Object(r.createElement)(h.SelectControl,b()({excludeSelectedOptions:!1,label:Object(s.__)("What's your current annual revenue?",'woocommerce'),options:k(c(),this.props.settings.woocommerce_default_country,n),required:!0},a("revenue"))),["other","brick-mortar-other"].includes(m.selling_venues)&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"business-competitors"},Object(r.createElement)(h.SelectControl,b()({excludeSelectedOptions:!1,label:Object(s.__)("Which platform is the store using?",'woocommerce'),options:j,required:!0},a("other_platform"))),"other"===m.other_platform&&Object(r.createElement)(h.TextControl,b()({label:Object(s.__)("What is the platform name?",'woocommerce'),required:!0},a("other_platform_name")))))),Object(r.createElement)(_.CardFooter,{isBorderless:!0},Object(r.createElement)(_.FlexItem,null,Object(r.createElement)("div",{className:"woocommerce-profile-wizard__client"},Object(r.createElement)(_.CheckboxControl,b()({label:Object(s.__)("I'm setting up a store for a client",'woocommerce')},a("setup_client")))))),Object(r.createElement)(_.CardFooter,{justify:"center"},Object(r.createElement)(_.Button,{isPrimary:!0,onClick:async()=>{await l(),this.persistProfileItems()},disabled:!d,isBusy:t},o?Object(s.__)("Retry",'woocommerce'):Object(s.__)("Continue",'woocommerce')),o&&Object(r.createElement)(_.Button,{onClick:()=>{this.persistProfileItems(),e()}},Object(s.__)("Continue without installing",'woocommerce'))))))}renderFreeFeaturesStep(){const{isInstallingActivating:e,settings:t,profileItems:o}=this.props,n=t.woocommerce_default_country?t.woocommerce_default_country:null;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"woocommerce-profile-wizard__step-header"},Object(r.createElement)(_.__experimentalText,{variant:"title.small",as:"h2",size:"20",lineHeight:"28px"},Object(s.__)("Included business features",'woocommerce')),Object(r.createElement)(_.__experimentalText,{variant:"body",as:"p"},Object(s.__)("We recommend enhancing your store with these free extensions",'woocommerce')),Object(r.createElement)(_.__experimentalText,{variant:"body",as:"p"},Object(s.__)("No commitment required - you can remove them at any time.",'woocommerce'))),Object(r.createElement)(V,{isInstallingActivating:e,onSubmit:this.onContinue,country:n,industry:o.industry,productTypes:o.product_types}))}render(){const{initialValues:e}=this.props;return Object(r.createElement)(_.TabPanel,{activeClass:"is-active",initialTabName:"current-tab",onSelect:t=>{this.state.currentTab!==t&&this.setState({currentTab:t,savedValues:this.state.savedValues||e})},tabs:[{name:"business-details"===this.state.currentTab?"current-tab":"business-details",id:"business-details",title:Object(s.__)("Business details",'woocommerce')},{name:"free-features"===this.state.currentTab?"current-tab":"free-features",id:"free-features",title:Object(s.__)("Free features",'woocommerce'),className:this.state.isValid?"":"is-disabled"}]},e=>Object(r.createElement)(r.Fragment,null,this.getTab(e.id)))}getTab(e){return"business-details"===e?this.renderBusinessDetailsStep():this.renderFreeFeaturesStep()}}H.contextType=O.a;const U=Object(c.compose)(Object(a.withSelect)(e=>{const{getSettings:t,getSettingsError:o}=e(m.SETTINGS_STORE_NAME),{getProfileItems:r,getOnboardingError:s}=e(m.ONBOARDING_STORE_NAME),{getPluginsError:n,isPluginsRequesting:c}=e(m.PLUGINS_STORE_NAME),{general:i={}}=t("general");return{hasInstallActivateError:n("installPlugins")||n("activatePlugins"),isError:Boolean(s("updateProfileItems")),profileItems:r(),isSettingsError:Boolean(o("general")),settings:i,isInstallingActivating:c("installPlugins")||c("activatePlugins")||c("getJetpackConnectUrl")}}),Object(a.withDispatch)(e=>{const{updateProfileItems:t}=e(m.ONBOARDING_STORE_NAME),{installAndActivatePlugins:o}=e(m.PLUGINS_STORE_NAME),{createNotice:r}=e("core/notices");return{createNotice:r,installAndActivatePlugins:o,updateProfileItems:t}}))(H);o(571);const q=e=>{const{profileItems:t,isLoading:o}=Object(a.useSelect)(e=>({isLoading:!e(m.ONBOARDING_STORE_NAME).hasFinishedResolution("getProfileItems")||!e(m.SETTINGS_STORE_NAME).hasFinishedResolution("getSettings",["general"]),profileItems:e(m.ONBOARDING_STORE_NAME).getProfileItems()}));if(o)return Object(r.createElement)("div",{className:"woocommerce-admin__business-details__spinner"},Object(r.createElement)(h.Spinner,null));const s={other_platform:t.other_platform||"",other_platform_name:t.other_platform_name||"",product_count:t.product_count||"",selling_venues:t.selling_venues||"",revenue:t.revenue||"",setup_client:t.setup_client||!1};return Object(r.createElement)(U,b()({},e,{initialValues:s}))},G=Object(u.f)("onboarding",{});class Z extends r.Component{constructor(e){let t=Object(i.get)(e,"profileItems",{}).industry||[];const{locationSettings:o}=e;if("US"!==Object(f.c)(o.woocommerce_default_country)){const e="cbd-other-hemp-derived-products";t=t.filter(t=>e!==t&&e!==t.slug)}super(),this.state={error:null,selected:t,textInputListContent:{}},this.onContinue=this.onContinue.bind(this),this.onIndustryChange=this.onIndustryChange.bind(this),this.onDetailChange=this.onDetailChange.bind(this)}async onContinue(){if(await this.validateField(),this.state.error)return;const{createNotice:e,goToNextStep:t,isError:o,updateProfileItems:r}=this.props,n=this.state.selected.map(e=>e.slug),c=this.state.selected.map(e=>e.detail).filter(e=>e).join(",");Object(d.recordEvent)("storeprofiler_store_industry_continue",{store_industry:n,industries_with_detail:c}),await r({industry:this.state.selected}),o?e("error",Object(s.__)("There was a problem updating your industries",'woocommerce')):t()}async validateField(){const e=this.state.selected.length?null:Object(s.__)("Please select at least one industry",'woocommerce');this.setState({error:e})}onIndustryChange(e){this.setState(t=>{const o=t.selected,r=Object(i.find)(o,{slug:e});if(r){const o=t.textInputListContent;return o[e]=r.detail,{selected:Object(i.filter)(t.selected,t=>t.slug!==e)||[],textInputListContent:o}}return o.push({slug:e,detail:t.textInputListContent[e]}),{selected:o}},()=>this.validateField())}onDetailChange(e,t){this.setState(o=>{const r=o.selected,s=o.textInputListContent;return r[Object(i.findIndex)(r,{slug:t})].detail=e,s[t]=e,{selected:r,textInputListContent:s}})}renderIndustryLabel(e,t,o){const{textInputListContent:s}=this.state;return Object(r.createElement)(r.Fragment,null,t.label,t.use_description&&o&&Object(r.createElement)(h.TextControl,{key:"text-control-"+e,label:t.description_label,value:o.detail||s[e]||"",onChange:t=>this.onDetailChange(t,e),className:"woocommerce-profile-wizard__text"}))}render(){const{industries:e}=G,{error:t,selected:o}=this.state,{locationSettings:n,isProfileItemsRequesting:c}=this.props,a=Object(f.c)(n.woocommerce_default_country),l=Object.keys(e),m="US"===a?l:l.filter(e=>"cbd-other-hemp-derived-products"!==e);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"woocommerce-profile-wizard__step-header"},Object(r.createElement)(N.Text,{variant:"title.small",as:"h2",size:"20",lineHeight:"28px"},Object(s.__)("In which industry does the store operate?",'woocommerce')),Object(r.createElement)(N.Text,{variant:"body",as:"p"},Object(s.__)("Choose any that apply",'woocommerce'))),Object(r.createElement)(_.Card,null,Object(r.createElement)(_.CardBody,{size:null},Object(r.createElement)("div",{className:"woocommerce-profile-wizard__checkbox-group"},m.map(t=>{const s=Object(i.find)(o,{slug:t});return Object(r.createElement)(_.CheckboxControl,{key:"checkbox-control-"+t,label:this.renderIndustryLabel(t,e[t],s),onChange:()=>this.onIndustryChange(t),checked:s||!1,className:"woocommerce-profile-wizard__checkbox"})}),t&&Object(r.createElement)("span",{className:"woocommerce-profile-wizard__error"},t))),Object(r.createElement)(_.CardFooter,{isBorderless:!0,justify:"center"},Object(r.createElement)(_.Button,{isPrimary:!0,onClick:this.onContinue,isBusy:c,disabled:!o.length||c},Object(s.__)("Continue",'woocommerce')))))}}var W=Object(c.compose)(Object(a.withSelect)(e=>{const{getProfileItems:t,getOnboardingError:o,isOnboardingRequesting:r}=e(m.ONBOARDING_STORE_NAME),{getSettings:s}=e(m.SETTINGS_STORE_NAME),{general:n={}}=s("general");return{isError:Boolean(o("updateProfileItems")),profileItems:t(),locationSettings:n,isProfileItemsRequesting:r("updateProfileItems")}}),Object(a.withDispatch)(e=>{const{updateProfileItems:t}=e(m.ONBOARDING_STORE_NAME),{createNotice:o}=e("core/notices");return{createNotice:o,updateProfileItems:t}}))(Z),J=o(8),$=Object(r.createElement)(J.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(J.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"}));function Y({annualPrice:e,description:t,isMonthlyPricing:o,label:n,moreUrl:c,slug:i}){const[a,l]=Object(r.useState)("");if(!e)return n;const m=Object(s.__)("This product type requires a paid extension.\nWe'll add this to a cart so that\nyou can purchase and install it later.",'woocommerce');return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"woocommerce-product-wizard__product-types-label"},n),Object(r.createElement)(_.Button,{isTertiary:!0,label:Object(s.__)("Learn more about recommended free business features",'woocommerce'),onClick:()=>{l(!0)}},Object(r.createElement)(T.a,{icon:$})),a&&Object(r.createElement)(_.Popover,{focusOnMount:"container",position:"top center",onClose:()=>l(!1)},M()({mixedString:t+(c?" {{moreLink/}}":""),components:{moreLink:c?Object(r.createElement)(h.Link,{href:c,target:"_blank",type:"external",onClick:()=>Object(d.recordEvent)("storeprofiler_store_product_type_learn_more",{product_type:i})},Object(s.__)("Learn more",'woocommerce')):""}})),Object(r.createElement)(_.Tooltip,{text:m,position:"bottom center"},Object(r.createElement)(h.Pill,null,Object(r.createElement)("span",{className:"screen-reader-text"},m),o?Object(s.sprintf)(Object(s.__)("$%f per month",'woocommerce'),(e/12).toFixed(2)):Object(s.sprintf)(Object(s.__)("$%f per year",'woocommerce'),e))))}o(572);class Q extends r.Component{constructor(){super(),this.state={error:null,isMonthlyPricing:!0,selected:[],isWCPayInstalled:null},this.onContinue=this.onContinue.bind(this),this.onChange=this.onChange.bind(this)}componentDidMount(){const{installedPlugins:e,invalidateResolution:t}=this.props,{isWCPayInstalled:o}=this.state;t("getProductTypes",[]),null===o&&e&&this.setState({isWCPayInstalled:e.includes("woocommerce-payments")})}componentDidUpdate(e){const{profileItems:t,productTypes:o}=this.props;if(e.productTypes!==o){const e=Object.keys(o).filter(e=>!!o[e].default);this.setState({selected:t.product_types||e})}}validateField(){const e=this.state.selected.length?null:Object(s.__)("Please select at least one product type",'woocommerce');return this.setState({error:e}),!e}onContinue(){const{selected:e}=this.state,{installedPlugins:t=[]}=this.props;if(!this.validateField())return;const{countryCode:o,createNotice:r,goToNextStep:n,installAndActivatePlugins:c,updateProfileItems:i}=this.props;Object(d.recordEvent)("storeprofiler_store_product_type_continue",{product_type:e});const a=[i({product_types:e})];window.wcAdminFeatures&&window.wcAdminFeatures.subscriptions&&"US"===o&&!t.includes("woocommerce-payments")&&e.includes("subscriptions")&&a.push(c(["woocommerce-payments"]).then(e=>{Object(g.a)(e)}).catch(e=>{throw Object(g.a)(e),new Error})),Promise.all(a).then(()=>n()).catch(()=>r("error",Object(s.__)("There was a problem updating your product types",'woocommerce')))}onChange(e){this.setState(t=>{if(Object(i.includes)(t.selected,e))return{selected:Object(i.filter)(t.selected,t=>t!==e)||[]};const o=t.selected;return o.push(e),{selected:o}},()=>this.validateField())}render(){const{productTypes:e=[]}=this.props,{error:t,isMonthlyPricing:o,isWCPayInstalled:n,selected:c}=this.state,{countryCode:i,isInstallingActivating:a,isProductTypesRequesting:l,isProfileItemsRequesting:m}=this.props;return l?Object(r.createElement)("div",{className:"woocommerce-profile-wizard__product-types__spinner"},Object(r.createElement)(_.Spinner,null)):Object(r.createElement)("div",{className:"woocommerce-profile-wizard__product-types"},Object(r.createElement)("div",{className:"woocommerce-profile-wizard__step-header"},Object(r.createElement)(N.Text,{variant:"title.small",as:"h2",size:"20",lineHeight:"28px"},Object(s.__)("What type of products will be listed?",'woocommerce')),Object(r.createElement)(N.Text,{variant:"body",as:"p"},Object(s.__)("Choose any that apply",'woocommerce'))),Object(r.createElement)(_.Card,null,Object(r.createElement)(_.CardBody,{size:null},Object.keys(e).map(t=>Object(r.createElement)(_.CheckboxControl,{key:t,label:Object(r.createElement)(Y,{description:e[t].description,label:e[t].label,annualPrice:e[t].yearly_price,isMonthlyPricing:o,moreUrl:e[t].more_url,slug:t}),onChange:()=>this.onChange(t),checked:c.includes(t),className:"woocommerce-profile-wizard__checkbox"})),t&&Object(r.createElement)("span",{className:"woocommerce-profile-wizard__error"},t)),Object(r.createElement)(_.CardFooter,{isBorderless:!0,justify:"center"},Object(r.createElement)(_.Button,{isPrimary:!0,onClick:this.onContinue,isBusy:m||a,disabled:!c.length||m||a},Object(s.__)("Continue",'woocommerce')))),Object(r.createElement)("div",{className:"woocommerce-profile-wizard__card-help-footnote"},Object(r.createElement)("div",{className:"woocommerce-profile-wizard__product-types-pricing-toggle woocommerce-profile-wizard__checkbox"},Object(r.createElement)("label",{htmlFor:"woocommerce-product-types__pricing-toggle"},Object(r.createElement)(N.Text,{variant:"body",as:"p"},Object(s.__)("Display monthly prices",'woocommerce')),Object(r.createElement)(_.FormToggle,{id:"woocommerce-product-types__pricing-toggle",checked:o,onChange:()=>this.setState({isMonthlyPricing:!o})}))),Object(r.createElement)(N.Text,{variant:"caption",size:"12",lineHeight:"16px"},Object(s.__)("Billing is annual. All purchases are covered by our 30 day money back guarantee and include access to support and updates. Extensions will be added to a cart for you to purchase later.",'woocommerce')),window.wcAdminFeatures&&window.wcAdminFeatures.subscriptions&&"US"===i&&!n&&c.includes("subscriptions")&&Object(r.createElement)(N.Text,{variant:"body",size:"12",lineHeight:"16px",as:"p"},Object(s.__)("The following extensions will be added to your site for free: WooCommerce Payments. An account is required to use this feature.",'woocommerce'))))}}var K=Object(c.compose)(Object(a.withSelect)(e=>{const{getProfileItems:t,getProductTypes:o,getOnboardingError:r,hasFinishedResolution:s,isOnboardingRequesting:n}=e(m.ONBOARDING_STORE_NAME),{getSettings:c}=e(m.SETTINGS_STORE_NAME),{getInstalledPlugins:i,isPluginsRequesting:a}=e(m.PLUGINS_STORE_NAME),{general:l={}}=c("general");return{isError:Boolean(r("updateProfileItems")),profileItems:t(),isProfileItemsRequesting:n("updateProfileItems"),installedPlugins:i(),isInstallingActivating:a("installPlugins")||a("activatePlugins"),countryCode:Object(f.b)(l.woocommerce_default_country),productTypes:o(),isProductTypesRequesting:!s("getProductTypes")}}),Object(a.withDispatch)(e=>{const{updateProfileItems:t}=e(m.ONBOARDING_STORE_NAME),{createNotice:o}=e("core/notices"),{installAndActivatePlugins:r}=e(m.PLUGINS_STORE_NAME),{invalidateResolution:s}=e(m.ONBOARDING_STORE_NAME);return{createNotice:o,installAndActivatePlugins:r,invalidateResolution:s,updateProfileItems:t}}))(Q);class X extends r.Component{renderStepper(){const{currentStep:e,steps:t}=this.props,o=Object(i.filter)(t,e=>!!e.label),s=o.findIndex(t=>t.key===e);return o.map((e,t)=>{const r=o[t-1];return t<s&&(e.isComplete=!0),r&&!r.isComplete||(e.onClick=e=>Object(l.updateQueryString)({step:e})),e}),Object(r.createElement)(h.Stepper,{steps:o,currentStep:e})}render(){const e=this.props.steps.find(e=>e.key===this.props.currentStep);return e&&e.label?Object(r.createElement)("div",{className:"woocommerce-profile-wizard__header"},this.renderStepper()):null}}var ee=o(527),te=o(514);o(573);const oe=_.FlexItem||(({children:e,align:t})=>{const o={display:"flex","justify-content":t?"center":"flex-start"};return Object(r.createElement)("div",{style:o},e)}),re=()=>Object(r.createElement)("div",{className:"woocommerce-admin__store-details__spinner"},Object(r.createElement)(_.Spinner,null));class se extends r.Component{constructor(e){super(e),this.state={showUsageModal:!1,skipping:!1,isStoreDetailsPopoverVisible:!1,isSkipSetupPopoverVisible:!1},this.onContinue=this.onContinue.bind(this),this.onSubmit=this.onSubmit.bind(this)}deriveCurrencySettings(e){if(!e)return null;const t=this.context,o=Object(f.b)(e),{currencySymbols:r={},localeInfo:s={}}=Object(u.f)("onboarding",{});return t.getDataForCountry(o,s,r)}onSubmit(){this.setState({showUsageModal:!0,skipping:!1})}async onContinue(e){const{createNotice:t,goToNextStep:o,updateProfileItems:r,updateAndPersistSettingsForGroup:n,profileItems:c,settings:i,errorsRef:a}=this.props,l=this.deriveCurrencySettings(e.countryState);this.context.setCurrency(l),Object(d.recordEvent)("storeprofiler_store_details_continue",{store_country:Object(f.b)(e.countryState),derived_currency:l.currency_code,email_signup:e.isAgreeMarketing}),await n("general",{general:{...i,woocommerce_store_address:e.addressLine1,woocommerce_store_address_2:e.addressLine2,woocommerce_default_country:e.countryState,woocommerce_store_city:e.city,woocommerce_store_postcode:e.postCode,woocommerce_currency:l.code,woocommerce_currency_pos:l.symbolPosition,woocommerce_price_thousand_sep:l.thousandSeparator,woocommerce_price_decimal_sep:l.decimalSeparator,woocommerce_price_num_decimals:l.precision}});const m={is_agree_marketing:e.isAgreeMarketing,store_email:e.storeEmail};if("US"!==Object(f.c)(e.countryState)&&c.industry&&c.industry.length){const e="cbd-other-hemp-derived-products",t=c.industry.filter(t=>e!==t&&e!==t.slug);m.industry=t}let u=[];try{await r(m)}catch(e){var p;null!=e&&null!==(p=e.data)&&void 0!==p&&p.params&&(u=Object.values(e.data.params))}Boolean(a.current.settings)||u.length?(t("error",Object(s.__)("There was a problem saving your store details",'woocommerce')),u.forEach(e=>t("error",e))):o()}validateStoreDetails(e){const t=Object(ee.b)(e);return!e.isAgreeMarketing||e.storeEmail&&e.storeEmail.trim().length||(t.storeEmail=Object(s.__)("Please add an email address",'woocommerce')),e.storeEmail&&e.storeEmail.trim().length&&-1===e.storeEmail.indexOf("@")&&(t.storeEmail=Object(s.__)("Invalid email address",'woocommerce')),t}render(){const{showUsageModal:e,skipping:t,isStoreDetailsPopoverVisible:o,isSkipSetupPopoverVisible:n}=this.state,{skipProfiler:c,isLoading:i,isBusy:a,initialValues:l}=this.props,m=Object(s.__)("Manual setup is only recommended for\n experienced WooCommerce users or developers.",'woocommerce'),d=Object(s.__)("Your store address will help us configure currency\n options and shipping rules automatically.\n This information will not be publicly visible and can\n easily be changed later.",'woocommerce');return i?Object(r.createElement)("div",{className:"woocommerce-profile-wizard__store-details"},Object(r.createElement)(re,null)):Object(r.createElement)("div",{className:"woocommerce-profile-wizard__store-details"},Object(r.createElement)("div",{className:"woocommerce-profile-wizard__step-header"},Object(r.createElement)(N.Text,{variant:"title.small",as:"h2",size:"20",lineHeight:"28px"},Object(s.__)("Welcome to WooCommerce",'woocommerce')),Object(r.createElement)(N.Text,{variant:"body",as:"p"},Object(s.__)("Tell us about your store and we'll get you set up in no time",'woocommerce'),Object(r.createElement)(_.Button,{isTertiary:!0,label:Object(s.__)("Learn more about store details",'woocommerce'),onClick:()=>this.setState({isStoreDetailsPopoverVisible:!0})},Object(r.createElement)(T.a,{icon:$}))),o&&Object(r.createElement)(_.Popover,{focusOnMount:"container",position:"top center",onClose:()=>this.setState({isStoreDetailsPopoverVisible:!1})},d)),Object(r.createElement)(h.Form,{initialValues:l,onSubmit:this.onSubmit,validate:this.validateStoreDetails},({getInputProps:o,handleSubmit:n,values:i,isValidForm:l,setValue:m})=>Object(r.createElement)(_.Card,null,e&&Object(r.createElement)(te.a,{onContinue:()=>{t?c():this.onContinue(i)},onClose:()=>this.setState({showUsageModal:!1,skipping:!1})}),Object(r.createElement)(_.CardBody,null,Object(r.createElement)(ee.a,{getInputProps:o,setValue:m}),Object(r.createElement)(h.TextControl,b()({label:Object(s.__)("Email address",'woocommerce'),required:!0,autoComplete:"email"},o("storeEmail")))),Object(r.createElement)(_.CardFooter,null,Object(r.createElement)(oe,null,Object(r.createElement)("div",{className:"woocommerce-profile-wizard__newsletter-signup"},Object(r.createElement)(_.CheckboxControl,b()({label:Object(r.createElement)(r.Fragment,null,Object(s.__)("Get tips, product updates and inspiration straight to your mailbox.",'woocommerce')," ",Object(r.createElement)("span",{className:"woocommerce-profile-wizard__powered-by-mailchimp"},Object(s.__)("Powered by Mailchimp",'woocommerce')))},o("isAgreeMarketing")))))),Object(r.createElement)(_.CardFooter,{justify:"center"},Object(r.createElement)(_.Button,{isPrimary:!0,onClick:n,isBusy:a,disabled:!l||a},Object(s.__)("Continue",'woocommerce'))))),Object(r.createElement)("div",{className:"woocommerce-profile-wizard__footer"},Object(r.createElement)(_.Button,{isLink:!0,className:"woocommerce-profile-wizard__footer-link",onClick:()=>(this.setState({showUsageModal:!0,skipping:!0}),!1)},Object(s.__)("Skip setup store details",'woocommerce')),Object(r.createElement)(_.Button,{isTertiary:!0,label:m,onClick:()=>this.setState({isSkipSetupPopoverVisible:!0})},Object(r.createElement)(T.a,{icon:$})),n&&Object(r.createElement)(_.Popover,{focusOnMount:"container",position:"top center",onClose:()=>this.setState({isSkipSetupPopoverVisible:!1})},m)))}}se.contextType=O.a;var ne=Object(c.compose)(Object(a.withSelect)(e=>{const{getSettings:t,getSettingsError:o,isUpdateSettingsRequesting:s}=e(m.SETTINGS_STORE_NAME),{getProfileItems:n,isOnboardingRequesting:c,getEmailPrefill:i,hasFinishedResolution:a}=e(m.ONBOARDING_STORE_NAME),{isResolving:l}=e(m.OPTIONS_STORE_NAME),d=n(),u=i(),{general:p={}}=t("general"),b=c("updateProfileItems")||s("general")||l("getOption",["woocommerce_allow_tracking"]),h=!a("getProfileItems")||!a("getEmailPrefill"),_=Object(r.useRef)({settings:null});_.current={settings:o("general")};const O=p.woocommerce_store_address&&p.woocommerce_default_country||"";return{initialValues:{addressLine1:p.woocommerce_store_address||"",addressLine2:p.woocommerce_store_address_2||"",city:p.woocommerce_store_city||"",countryState:O,postCode:p.woocommerce_store_postcode||"",isAgreeMarketing:"boolean"!=typeof d.is_agree_marketing||d.is_agree_marketing,storeEmail:"string"==typeof d.store_email?d.store_email:u},isLoading:h,profileItems:d,isBusy:b,settings:p,errorsRef:_}}),Object(a.withDispatch)(e=>{const{createNotice:t}=e("core/notices"),{updateProfileItems:o}=e(m.ONBOARDING_STORE_NAME),{updateAndPersistSettingsForGroup:r}=e(m.SETTINGS_STORE_NAME);return{createNotice:t,updateProfileItems:o,updateAndPersistSettingsForGroup:r}}))(se),ce=o(17),ie=o.n(ce),ae=o(28),le=o(574),me=o.n(le),de=(o(575),o(6)),ue=o.n(de),pe=o(576),be=o.n(pe),he=o(1),_e=o.n(he),Oe=o(476);const ge=({children:e,className:t})=>Object(Oe.isWpVersion)("5.8",">=")?Object(r.createElement)("div",{className:t},e):Object(r.createElement)(_.DropZoneProvider,null,Object(r.createElement)("div",{className:t},e));class je extends r.Component{constructor(){super(),this.state={isUploading:!1},this.handleFilesUpload=this.handleFilesUpload.bind(this),this.handleFilesDrop=this.handleFilesDrop.bind(this)}handleFilesDrop(e){const t=e[0];this.uploadTheme(t)}handleFilesUpload(e){const t=e.target.files[0];this.uploadTheme(t)}uploadTheme(e){const{createNotice:t,onUploadComplete:o}=this.props;this.setState({isUploading:!0});const r=new window.FormData;return r.append("pluginzip",e),ie()({path:"/wc-admin/themes",method:"POST",body:r}).then(e=>{o(e),this.setState({isUploading:!1}),t(e.status,e.message)}).catch(e=>{this.setState({isUploading:!1}),e&&e.message&&t("error",e.message)})}render(){const{className:e}=this.props,{isUploading:t}=this.state,o=ue()("woocommerce-theme-uploader",e,{"is-uploading":t});return Object(r.createElement)(_.Card,{className:o},Object(r.createElement)(ge,{className:"woocommerce-theme-uploader__dropzone-wrapper"},t?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(h.Spinner,null),Object(r.createElement)(h.H,{className:"woocommerce-theme-uploader__title"},Object(s.__)("Uploading theme",'woocommerce')),Object(r.createElement)("p",null,Object(s.__)("Your theme is being uploaded",'woocommerce'))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(_.FormFileUpload,{accept:".zip",onChange:this.handleFilesUpload},Object(r.createElement)(be.a,null),Object(r.createElement)(h.H,{className:"woocommerce-theme-uploader__title"},Object(s.__)("Upload a theme",'woocommerce')),Object(r.createElement)("p",null,Object(s.__)("Drop a theme zip file here to upload",'woocommerce'))),Object(r.createElement)(_.DropZone,{label:Object(s.__)("Drop your theme zip file here",'woocommerce'),onFilesDrop:this.handleFilesDrop}))))}}je.propTypes={className:_e.a.string,onUploadComplete:_e.a.func},je.defaultProps={onUploadComplete:i.noop};var we=Object(c.compose)(Object(a.withDispatch)(e=>{const{createNotice:t}=e("core/notices");return{createNotice:t}}))(je),fe=o(497),Ce=o(577),Ee=o.n(Ce),ye=o(578),ve=o.n(ye),Se=o(579),ke=o.n(Se);const Ne=[{key:"mobile",icon:Ee.a},{key:"tablet",icon:ve.a},{key:"desktop",icon:ke.a}];class Te extends r.Component{constructor(){super(...arguments),this.state={device:"desktop"},this.handleDeviceClick=this.handleDeviceClick.bind(this)}handleDeviceClick(e){const{theme:t}=this.props;Object(d.recordEvent)("storeprofiler_store_theme_demo_device",{device:e,theme:t.slug}),this.setState({device:e})}render(){const{isBusy:e,onChoose:t,onClose:o,theme:n}=this.props,{demo_url:c,slug:i,title:a}=n,{device:l}=this.state;return Object(r.createElement)("div",{className:"woocommerce-theme-preview"},Object(r.createElement)("div",{className:"woocommerce-theme-preview__toolbar"},Object(r.createElement)(_.Button,{className:"woocommerce-theme-preview__close",onClick:o},Object(r.createElement)(T.a,{icon:fe.a})),Object(r.createElement)("div",{className:"woocommerce-theme-preview__theme-name"},M()({mixedString:Object(s.sprintf)(Object(s.__)("{{strong}}%s{{/strong}} developed by WooCommerce",'woocommerce'),a),components:{strong:Object(r.createElement)("strong",null)}})),Object(r.createElement)("div",{className:"woocommerce-theme-preview__devices"},Ne.map(e=>{const t=e.icon;return Object(r.createElement)(_.Button,{key:e.key,className:ue()("woocommerce-theme-preview__device",{"is-selected":e.key===l}),onClick:()=>this.handleDeviceClick(e.key)},Object(r.createElement)(t,null))})),Object(r.createElement)(_.Button,{isPrimary:!0,onClick:()=>t(i,"preview"),isBusy:e},Object(s.__)("Choose",'woocommerce'))),Object(r.createElement)(h.WebPreview,{src:c,title:a,className:"is-"+l}))}}var Pe=Te;class xe extends r.Component{constructor(){super(...arguments),this.state={activeTab:"all",chosen:null,demo:null,uploadedThemes:[]},this.handleUploadComplete=this.handleUploadComplete.bind(this),this.onChoose=this.onChoose.bind(this),this.onClosePreview=this.onClosePreview.bind(this),this.onSelectTab=this.onSelectTab.bind(this),this.openDemo=this.openDemo.bind(this),this.skipStep=this.skipStep.bind(this)}componentDidUpdate(e){const{isError:t,isUpdatingProfileItems:o,createNotice:r}=this.props,{chosen:n}=this.state,c=!o&&e.isUpdatingProfileItems&&!t&&n,i=!o&&e.isRequesting&&t;c&&(this.setState({chosen:null}),this.props.goToNextStep()),i&&(this.setState({chosen:null}),r("error",Object(s.__)("There was a problem selecting your store theme",'woocommerce')))}onChoose(e,t=""){const{updateProfileItems:o}=this.props,{is_installed:r,price:s,slug:n}=e,{activeTheme:c=""}=Object(u.f)("onboarding",{});this.setState({chosen:n}),Object(d.recordEvent)("storeprofiler_store_theme_choose",{theme:n,location:t}),n!==c&&Object(f.d)(s)<=0?r?this.activateTheme(n):this.installTheme(n):o({theme:n})}installTheme(e){const{createNotice:t}=this.props;ie()({path:"/wc-admin/onboarding/themes/install?theme="+e,method:"POST"}).then(o=>{t("success",Object(s.sprintf)(Object(s.__)("%s was installed on your site",'woocommerce'),o.name)),this.activateTheme(e)}).catch(e=>{this.setState({chosen:null}),t("error",e.message)})}activateTheme(e){const{createNotice:t,updateProfileItems:o}=this.props;ie()({path:"/wc-admin/onboarding/themes/activate?theme="+e,method:"POST"}).then(r=>{t("success",Object(s.sprintf)(Object(s.__)("%s was activated on your site",'woocommerce'),r.name)),Object(u.g)("onboarding",{...Object(u.f)("onboarding",{}),activeTheme:r.slug}),o({theme:e})}).catch(e=>{this.setState({chosen:null}),t("error",e.message)})}onClosePreview(){const{demo:e}=this.state;Object(d.recordEvent)("storeprofiler_store_theme_demo_close",{theme:e.slug}),document.body.classList.remove("woocommerce-theme-preview-active"),this.setState({demo:null})}openDemo(e){Object(d.recordEvent)("storeprofiler_store_theme_live_demo",{theme:e.slug}),document.body.classList.add("woocommerce-theme-preview-active"),this.setState({demo:e})}skipStep(){const{activeTheme:e=""}=Object(u.f)("onboarding",{});Object(d.recordEvent)("storeprofiler_store_theme_skip_step",{activeTheme:e}),this.props.goToNextStep()}renderTheme(e){const{demo_url:t,has_woocommerce_support:o,image:n,slug:c,title:i}=e,{chosen:a}=this.state,{activeTheme:l=""}=Object(u.f)("onboarding",{});return Object(r.createElement)(_.Card,{className:"woocommerce-profile-wizard__theme",key:c},Object(r.createElement)(_.CardBody,{size:null},n&&Object(r.createElement)("div",{className:"woocommerce-profile-wizard__theme-image",style:{backgroundImage:`url(${n})`},role:"img","aria-label":i})),Object(r.createElement)(_.CardBody,{className:"woocommerce-profile-wizard__theme-details"},Object(r.createElement)(h.H,{className:"woocommerce-profile-wizard__theme-name"},i,!o&&Object(r.createElement)(_.Tooltip,{text:Object(s.__)("This theme does not support WooCommerce.",'woocommerce')},Object(r.createElement)("span",null,Object(r.createElement)(me.a,{role:"img","aria-hidden":"true",focusable:"false"})))),Object(r.createElement)("p",{className:"woocommerce-profile-wizard__theme-status"},this.getThemeStatus(e))),Object(r.createElement)(_.CardFooter,null,c===l?Object(r.createElement)(_.Button,{isPrimary:!0,onClick:()=>this.onChoose(e,"card"),isBusy:a===c,disabled:a===c},Object(s.__)("Continue with my active theme",'woocommerce')):Object(r.createElement)(_.Button,{isSecondary:!0,onClick:()=>this.onChoose(e,"card"),isBusy:a===c,disabled:a===c},Object(s.__)("Choose",'woocommerce')),t&&Object(r.createElement)(_.Button,{isTertiary:!0,onClick:()=>this.openDemo(e)},Object(s.__)("Live demo",'woocommerce'))))}getThemeStatus(e){const{is_installed:t,price:o,slug:r}=e,{activeTheme:n=""}=Object(u.f)("onboarding",{});return n===r?Object(s.__)("Currently active theme",'woocommerce'):t?Object(s.__)("Installed",'woocommerce'):Object(f.d)(o)<=0?Object(s.__)("Free",'woocommerce'):Object(s.sprintf)(Object(s.__)("%s per year",'woocommerce'),Object(ae.decodeEntities)(o))}doesActiveThemeSupportWooCommerce(){const{activeTheme:e=""}=Object(u.f)("onboarding",{}),t=this.getThemes().find(t=>t.slug===e);return t&&t.has_woocommerce_support}onSelectTab(e){Object(d.recordEvent)("storeprofiler_store_theme_navigate",{navigation:e}),this.setState({activeTab:e})}getPriceValue(e){return Number(Object(ae.decodeEntities)(e).replace(/[^0-9.-]+/g,""))}getThemes(e="all"){const{uploadedThemes:t}=this.state,{activeTheme:o="",themes:r=[]}=Object(u.f)("onboarding",{}),s=[...r.filter(e=>e&&(e.has_woocommerce_support||e.slug===o)),...t];switch(e){case"paid":return s.filter(e=>Object(f.d)(e.price)>0);case"free":return s.filter(e=>Object(f.d)(e.price)<=0);case"all":default:return s}}handleUploadComplete(e){"success"===e.status&&e.theme_data&&(this.setState({uploadedThemes:[...this.state.uploadedThemes,e.theme_data]}),Object(d.recordEvent)("storeprofiler_store_theme_upload",{theme:e.theme_data.slug}))}render(){const{activeTab:e,chosen:t,demo:o}=this.state,n=this.getThemes(e),c=this.doesActiveThemeSupportWooCommerce();return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"woocommerce-profile-wizard__step-header"},Object(r.createElement)(N.Text,{variant:"title.small",as:"h2",size:"20",lineHeight:"28px"},Object(s.__)("Choose a theme",'woocommerce')),Object(r.createElement)(N.Text,{variant:"body",as:"p"},Object(s.__)("Choose how your store appears to customers. And don't worry, you can always switch themes and edit them later.",'woocommerce'))),Object(r.createElement)(_.TabPanel,{className:"woocommerce-profile-wizard__themes-tab-panel",activeClass:"is-active",onSelect:this.onSelectTab,tabs:[{name:"all",title:Object(s.__)("All themes",'woocommerce')},{name:"paid",title:Object(s.__)("Paid themes",'woocommerce')},{name:"free",title:Object(s.__)("Free themes",'woocommerce')}]},()=>Object(r.createElement)("div",{className:"woocommerce-profile-wizard__themes"},n&&n.map(e=>this.renderTheme(e)),Object(r.createElement)(we,{onUploadComplete:this.handleUploadComplete}))),o&&Object(r.createElement)(Pe,{theme:o,onChoose:()=>this.onChoose(o,"card"),onClose:this.onClosePreview,isBusy:t===o.slug}),c&&Object(r.createElement)("p",{className:"woocommerce-profile-wizard__themes-skip-this-step"},Object(r.createElement)(_.Button,{isLink:!0,className:"woocommerce-profile-wizard__skip",onClick:()=>this.skipStep()},Object(s.__)("Skip this step",'woocommerce'))))}}var Ie=Object(c.compose)(Object(a.withSelect)(e=>{const{getProfileItems:t,getOnboardingError:o,isOnboardingRequesting:r}=e(m.ONBOARDING_STORE_NAME);return{isError:Boolean(o("updateProfileItems")),isUpdatingProfileItems:r("updateProfileItems"),profileItems:t()}}),Object(a.withDispatch)(e=>{const{updateProfileItems:t}=e(m.ONBOARDING_STORE_NAME),{createNotice:o}=e("core/notices");return{createNotice:o,updateProfileItems:t}}))(xe);o(580);class Me extends r.Component{constructor(e){super(e),this.cachedActivePlugins=e.activePlugins,this.goToNextStep=this.goToNextStep.bind(this)}componentDidUpdate(e){const{step:t}=e.query,{step:o}=this.props.query,{isError:r,isGetProfileItemsRequesting:n,createNotice:c}=this.props;!n&&e.isRequesting&&r&&c("error",Object(s.__)("There was a problem finishing the setup wizard",'woocommerce')),t!==o&&(window.document.documentElement.scrollTop=0,Object(d.recordEvent)("storeprofiler_step_view",{step:this.getCurrentStep().key}))}componentDidMount(){document.body.classList.remove("woocommerce-admin-is-loading"),document.body.classList.add("woocommerce-onboarding"),document.body.classList.add("woocommerce-profile-wizard__body"),document.body.classList.add("woocommerce-admin-full-screen"),document.body.classList.add("is-wp-toolbar-disabled"),Object(d.recordEvent)("storeprofiler_step_view",{step:this.getCurrentStep().key})}componentWillUnmount(){document.body.classList.remove("woocommerce-onboarding"),document.body.classList.remove("woocommerce-profile-wizard__body"),document.body.classList.remove("woocommerce-admin-full-screen"),document.body.classList.remove("is-wp-toolbar-disabled")}getSteps(){const{profileItems:e}=this.props,t=[];return t.push({key:"store-details",container:ne,label:Object(s.__)("Store Details",'woocommerce'),isComplete:e.hasOwnProperty("setup_client")&&null!==e.setup_client}),t.push({key:"industry",container:W,label:Object(s.__)("Industry",'woocommerce'),isComplete:e.hasOwnProperty("industry")&&null!==e.industry}),t.push({key:"product-types",container:K,label:Object(s.__)("Product Types",'woocommerce'),isComplete:e.hasOwnProperty("product_types")&&null!==e.product_types}),t.push({key:"business-features",container:q,label:Object(s.__)("Business Details",'woocommerce'),isComplete:e.hasOwnProperty("product_count")&&null!==e.product_count}),t.push({key:"theme",container:Ie,label:Object(s.__)("Theme",'woocommerce'),isComplete:e.hasOwnProperty("theme")&&null!==e.theme}),Object(n.applyFilters)("woocommerce_admin_profile_wizard_steps",t)}getCurrentStep(){const{step:e}=this.props.query,t=this.getSteps().find(t=>t.key===e);return t||this.getSteps()[0]}async goToNextStep(){const{activePlugins:e,dismissedTasks:t,updateOptions:o}=this.props,r=this.getCurrentStep(),s=this.getSteps().findIndex(e=>e.key===r.key);Object(d.recordEvent)("storeprofiler_step_complete",{step:r.key}),t.length&&o({woocommerce_task_list_dismissed_tasks:[]}),this.cachedActivePlugins=e;const n=this.getSteps()[s+1];if(void 0!==n)return Object(l.updateQueryString)({step:n.key});this.completeProfiler()}completeProfiler(){const{activePlugins:e,isJetpackConnected:t,notes:o,updateNote:r,updateProfileItems:s,connectToJetpack:n}=this.props;Object(d.recordEvent)("storeprofiler_complete");const c=e.includes("jetpack")&&!t,i=o.find(e=>"wc-admin-onboarding-profiler-reminder"===e.name);i&&r(i.id,{status:"actioned"}),s({completed:!0}).then(()=>{const e=new URL(Object(l.getNewPath)({},"/",{}),window.location.href).href;c?(document.body.classList.add("woocommerce-admin-is-loading"),n(()=>e)):window.location.href=e})}skipProfiler(){const{createNotice:e,updateProfileItems:t}=this.props;t({skipped:!0}).then(()=>{Object(d.recordEvent)("storeprofiler_store_details_skip"),Object(l.getHistory)().push(Object(l.getNewPath)({},"/",{}))}).catch(()=>{e("error",Object(s.__)("There was a problem skipping the setup wizard",'woocommerce'))})}render(){const{query:e}=this.props,t=this.getCurrentStep(),o=t.key,s=Object(r.createElement)(t.container,{query:e,step:t,goToNextStep:this.goToNextStep,skipProfiler:()=>{this.skipProfiler()}}),n=this.getSteps().map(e=>Object(i.pick)(e,["key","label","isComplete"])),c="woocommerce-profile-wizard__container "+o;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(X,{currentStep:o,steps:n}),Object(r.createElement)("div",{className:c},s))}}t.default=Object(c.compose)(Object(a.withSelect)(e=>{const{getNotes:t}=e(m.NOTES_STORE_NAME),{getOption:o}=e(m.OPTIONS_STORE_NAME),{getProfileItems:r,getOnboardingError:s}=e(m.ONBOARDING_STORE_NAME),{getActivePlugins:n,getPluginsError:c,isJetpackConnected:i}=e(m.PLUGINS_STORE_NAME),a=r(),l=t({page:1,per_page:m.QUERY_DEFAULTS.pageSize,type:"update",status:"unactioned"}),d=n();return{dismissedTasks:o("woocommerce_task_list_dismissed_tasks")||[],getPluginsError:c,isError:Boolean(s("updateProfileItems")),isJetpackConnected:i(),notes:l,profileItems:a,activePlugins:d}}),Object(a.withDispatch)(e=>{const{connectToJetpackWithFailureRedirect:t,createErrorNotice:o}=e(m.PLUGINS_STORE_NAME),{updateNote:r}=e(m.NOTES_STORE_NAME),{updateOptions:s}=e(m.OPTIONS_STORE_NAME),{updateProfileItems:n}=e(m.ONBOARDING_STORE_NAME),{createNotice:c}=e("core/notices");return{connectToJetpack:e=>{t(e,o,u.e)},createNotice:c,updateNote:r,updateOptions:s,updateProfileItems:n}}),Object(u.f)("plugins")?Object(m.withPluginsHydration)({...Object(u.f)("plugins"),jetpackStatus:Object(u.f)("dataEndpoints",{}).jetpackStatus}):i.identity)(Me)}}]); |