golden hour
/var/www/html/wp-content/plugins/woocommerce/packages/woocommerce-admin/dist/chunks
⬆️ Go Up
Upload
File/Folder
Size
Actions
0.js
18.49 KB
Del
OK
0.style.css
2.25 KB
Del
OK
0.style.rtl.css
2.25 KB
Del
OK
1.js
175.91 KB
Del
OK
11.style.css
1.35 KB
Del
OK
11.style.rtl.css
1.35 KB
Del
OK
12.style.css
1.52 KB
Del
OK
12.style.rtl.css
1.52 KB
Del
OK
14.style.css
2.25 KB
Del
OK
14.style.rtl.css
2.25 KB
Del
OK
17.style.css
5.36 KB
Del
OK
17.style.rtl.css
5.37 KB
Del
OK
2.js
9.57 KB
Del
OK
25.style.css
6.38 KB
Del
OK
25.style.rtl.css
6.38 KB
Del
OK
26.style.css
3.59 KB
Del
OK
26.style.rtl.css
3.59 KB
Del
OK
3.js
17.4 KB
Del
OK
3.js.LICENSE.txt
182 B
Del
OK
31.style.css
37.28 KB
Del
OK
31.style.rtl.css
37.29 KB
Del
OK
32.style.css
1.97 KB
Del
OK
32.style.rtl.css
1.97 KB
Del
OK
34.style.css
11.51 KB
Del
OK
34.style.rtl.css
11.51 KB
Del
OK
4.style.css
2.16 KB
Del
OK
4.style.rtl.css
2.16 KB
Del
OK
44.style.css
2.67 KB
Del
OK
44.style.rtl.css
2.67 KB
Del
OK
46.style.css
21.09 KB
Del
OK
46.style.rtl.css
21.1 KB
Del
OK
47.style.css
5.29 KB
Del
OK
47.style.rtl.css
5.28 KB
Del
OK
48.style.css
1.9 KB
Del
OK
48.style.rtl.css
1.9 KB
Del
OK
49.style.css
6.37 KB
Del
OK
49.style.rtl.css
6.37 KB
Del
OK
5.style.css
10.82 KB
Del
OK
5.style.rtl.css
10.81 KB
Del
OK
6.style.css
1.45 KB
Del
OK
6.style.rtl.css
1.45 KB
Del
OK
7.style.css
1.52 KB
Del
OK
7.style.rtl.css
1.52 KB
Del
OK
9.style.css
2.25 KB
Del
OK
9.style.rtl.css
2.25 KB
Del
OK
activity-panels-help.js
9.94 KB
Del
OK
activity-panels-inbox.js
8.64 KB
Del
OK
analytics-report-categories.js
14.03 KB
Del
OK
analytics-report-coupons.js
7.59 KB
Del
OK
analytics-report-customers.js
23.26 KB
Del
OK
analytics-report-downloads.js
8.6 KB
Del
OK
analytics-report-orders.js
12.88 KB
Del
OK
analytics-report-products.js
16.43 KB
Del
OK
analytics-report-revenue.js
6.92 KB
Del
OK
analytics-report-stock.js
14.85 KB
Del
OK
analytics-report-taxes.js
7.08 KB
Del
OK
analytics-report-variations.js
10.21 KB
Del
OK
analytics-report.js
1.94 KB
Del
OK
analytics-settings.js
16.97 KB
Del
OK
customizable-dashboard.js
14.77 KB
Del
OK
dashboard-charts.js
33.82 KB
Del
OK
dashboard.js
450 B
Del
OK
homescreen.js
137.33 KB
Del
OK
leaderboards.js
4.9 KB
Del
OK
marketing-overview.js
73.23 KB
Del
OK
payment-recommendations.js
5.56 KB
Del
OK
profile-wizard.js
70.34 KB
Del
OK
store-alerts.js
5.28 KB
Del
OK
store-performance.js
4.71 KB
Del
OK
task-list.js
69.13 KB
Del
OK
wcpay-usage-modal.js
3.83 KB
Del
OK
Edit: task-list.js
(window.__wcAdmin_webpackJsonp=window.__wcAdmin_webpackJsonp||[]).push([[49],{162:function(e,t,o){"use strict";o.d(t,"a",(function(){return a}));var c=o(14),n=o(15);const a=(e,t={})=>{const{pathname:o,search:a}=window.location,s=Object(n.f)("connectNonce","");return t={"wccom-site":Object(n.f)("siteUrl"),"wccom-back":o+a,"wccom-woo-version":Object(n.f)("wcVersion"),"wccom-connect-nonce":s,...t},Object(c.addQueryArgs)(e,t)}},470:function(e,t,o){"use strict";var c=o(0),n=o(8),a=Object(c.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(n.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"}));t.a=a},472:function(e,t,o){"use strict";var c=o(0),n=o(8),a=Object(c.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(n.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"}));t.a=a},523:function(e,t,o){"use strict";o.d(t,"a",(function(){return c})),o.d(t,"b",(function(){return n}));const c=(e,t,o="undefined")=>e&&Array.isArray(e)&&e.length?t?e.reduce((e,c)=>(c[t]||(c[t]=o),(e[c[t]]=e[c[t]]||[]).push(c),e),{}):e:{},n=(e,t)=>Object.entries(e).reduce((e,[o])=>({...e,[o]:t}),{})},524:function(e,t,o){"use strict";o.d(t,"b",(function(){return p})),o.d(t,"a",(function(){return u}));var c=o(35),n=o.n(c),a=o(0),s=o(2),i=o(28),r=o(3),m=o(15),l=o(21);const{countries:d}=Object(m.f)("dataEndpoints",{countries:{}});function p(e){const t={};return e.addressLine1.trim().length||(t.addressLine1=Object(s.__)("Please add an address",'woocommerce')),e.countryState.trim().length||(t.countryState=Object(s.__)("Please select a country / region",'woocommerce')),e.city.trim().length||(t.city=Object(s.__)("Please add a city",'woocommerce')),e.postCode.trim().length||(t.postCode=Object(s.__)("Please add a post code",'woocommerce')),t}function u(e){const{getInputProps:t,setValue:o}=e,c=Object(a.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},[]),[]),m=function(e,t,o){const[c,n]=Object(a.useState)(""),[s,i]=Object(a.useState)("");return Object(a.useEffect)(()=>{let n=[];const a=new RegExp(Object(r.escapeRegExp)(c),"i");if((s.length||c.length)&&(n=e.filter(e=>a.test(e.label))),c.length&&s.length){const e=new RegExp(Object(r.escapeRegExp)(s.replace(/\s/g,"")),"i");if(n=n.filter(t=>e.test(t.label.replace("-","").replace(/\s/g,""))),n.length>1){let e=[];e=n.filter(e=>a.test(e.key)),e.length>0&&(n=e)}if(n.length>1){let t=[];t=n.filter(t=>e.test(t.key)),1===t.length&&(n=t)}}1===n.length&&t!==n[0].key&&o("countryState",n[0].key)},[c,s,t,e,o]),Object(a.createElement)(a.Fragment,null,Object(a.createElement)("input",{onChange:e=>n(e.target.value),value:c,name:"country",type:"text",className:"woocommerce-select-control__autofill-input",tabIndex:"-1",autoComplete:"country"}),Object(a.createElement)("input",{onChange:e=>i(e.target.value),value:s,name:"state",type:"text",className:"woocommerce-select-control__autofill-input",tabIndex:"-1",autoComplete:"address-level1"}))}(c,t("countryState").value,o);return Object(a.createElement)("div",{className:"woocommerce-store-address-fields"},Object(a.createElement)(l.TextControl,n()({label:Object(s.__)("Address line 1",'woocommerce'),required:!0,autoComplete:"address-line1"},t("addressLine1"))),Object(a.createElement)(l.TextControl,n()({label:Object(s.__)("Address line 2 (optional)",'woocommerce'),required:!0,autoComplete:"address-line2"},t("addressLine2"))),Object(a.createElement)(l.SelectControl,n()({label:Object(s.__)("Country / Region",'woocommerce'),required:!0,options:c,excludeSelectedOptions:!1,showAllOnFocus:!0,isSearchable:!0},t("countryState"),{controlClassName:t("countryState").className}),m),Object(a.createElement)(l.TextControl,n()({label:Object(s.__)("City",'woocommerce'),required:!0},t("city"),{autoComplete:"address-level2"})),Object(a.createElement)(l.TextControl,n()({label:Object(s.__)("Post code",'woocommerce'),required:!0,autoComplete:"postal-code"},t("postCode"))))}},534:function(e,t,o){},585:function(e,t,o){},586:function(e,t,o){},587:function(e,t,o){},600:function(e,t,o){"use strict";o.r(t);var c=o(0),n=o(2),a=o(4),s=o(472),i=o(7),r=o(11),m=o(122),l=o(16),d=o(21),p=(o(536),o(13)),u=o(3),_=o(28),b=o(15),h=o(59),g=o(506),O=o(162);class j extends c.Component{constructor(e){super(e),this.state={purchaseNowButtonBusy:!1,purchaseLaterButtonBusy:!1}}onClickPurchaseNow(){const{productIds:e,onClickPurchaseNow:t}=this.props;if(this.setState({purchaseNowButtonBusy:!0}),!e.length)return;Object(l.recordEvent)("tasklist_modal_proceed_checkout",{product_ids:e,purchase_install:!0});const o=Object(O.a)("https://woocommerce.com/cart",{"wccom-replace-with":e.join(",")});t?t(o):window.location=o}onClickPurchaseLater(){const{productIds:e}=this.props;Object(l.recordEvent)("tasklist_modal_proceed_checkout",{product_ids:e,purchase_install:!1}),this.setState({purchaseLaterButtonBusy:!0}),this.props.onClickPurchaseLater()}onClose(){const{onClose:e,productIds:t}=this.props;Object(l.recordEvent)("tasklist_modal_proceed_checkout",{product_ids:t,purchase_install:!1}),e()}renderProducts(){const{productIds:e}=this.props,{productTypes:t={},themes:o=[]}=Object(b.f)("onboarding",{}),a=[];return e.forEach(e=>{const s=Object(u.find)(t,t=>t.product===e);s&&a.push({title:s.label,content:s.description});const i=Object(u.find)(o,t=>t.id===e);i&&a.push({title:Object(n.sprintf)(Object(n.__)("%s — %s per year",'woocommerce'),i.title,Object(_.decodeEntities)(i.price)),content:Object(c.createElement)("span",{dangerouslySetInnerHTML:Object(g.a)(i.excerpt)})})}),Object(c.createElement)(d.List,{items:a})}render(){const{purchaseNowButtonBusy:e,purchaseLaterButtonBusy:t}=this.state;return Object(c.createElement)(a.Modal,{title:Object(n.__)("Would you like to add the following paid features to your store now?",'woocommerce'),onRequestClose:()=>this.onClose(),className:"woocommerce-cart-modal"},this.renderProducts(),Object(c.createElement)("p",{className:"woocommerce-cart-modal__help-text"},Object(n.__)("You won't have access to this functionality until the extensions have been purchased and installed.",'woocommerce')),Object(c.createElement)("div",{className:"woocommerce-cart-modal__actions"},Object(c.createElement)(a.Button,{isLink:!0,isBusy:t,onClick:()=>this.onClickPurchaseLater()},Object(n.__)("I'll do it later",'woocommerce')),Object(c.createElement)(a.Button,{isPrimary:!0,isBusy:e,onClick:()=>this.onClickPurchaseNow()},Object(n.__)("Buy now",'woocommerce'))))}}var w=Object(p.compose)(Object(i.withSelect)(e=>{const{getInstalledPlugins:t}=e(r.PLUGINS_STORE_NAME),{getProfileItems:o}=e(r.ONBOARDING_STORE_NAME),c=o(),n=t();return{profileItems:c,productIds:Object(h.e)(c,!1,n)}}))(j),y=o(30),k=o(12),E=o(17),S=o.n(E);class v extends c.Component{constructor(e){super(e);const{hasHomepage:t,hasProducts:o}=e.tasksStatus;this.stepVisibility={homepage:!t,import:!o},this.state={isDirty:!1,isPending:!1,logo:null,stepIndex:0,isUpdatingLogo:!1,isUpdatingNotice:!1,storeNoticeText:e.demoStoreNotice||""},this.completeStep=this.completeStep.bind(this),this.createHomepage=this.createHomepage.bind(this),this.importProducts=this.importProducts.bind(this),this.updateLogo=this.updateLogo.bind(this),this.updateNotice=this.updateNotice.bind(this)}componentDidMount(){const{themeMods:e}=this.props.tasksStatus;e&&e.custom_logo&&this.setState({logo:{id:e.custom_logo}})}componentDidUpdate(e){const{isPending:t,logo:o}=this.state,{demoStoreNotice:c}=this.props;!o||o.url||t||(this.setState({isPending:!0}),wp.media.attachment(o.id).fetch().then(()=>{const e=wp.media.attachment(o.id).get("url");this.setState({isPending:!1,logo:{id:o.id,url:e}})})),c&&e.demoStoreNotice!==c&&this.setState({storeNoticeText:c})}completeStep(){const{stepIndex:e}=this.state;this.getSteps()[e+1]?this.setState({stepIndex:e+1}):Object(k.getHistory)().push(Object(k.getNewPath)({},"/",{}))}importProducts(){const{clearTaskStatusCache:e,createNotice:t}=this.props;this.setState({isPending:!0}),Object(l.recordEvent)("tasklist_appearance_import_demo",{}),S()({path:r.WC_ADMIN_NAMESPACE+"/onboarding/tasks/import_sample_products",method:"POST"}).then(o=>{o.failed&&o.failed.length?t("error",Object(n.__)("There was an error importing some of the sample products",'woocommerce')):(t("success",Object(n.__)("All sample products have been imported",'woocommerce')),e()),this.setState({isPending:!1}),this.completeStep()}).catch(e=>{t("error",e.message),this.setState({isPending:!1})})}createHomepage(){const{clearTaskStatusCache:e,createNotice:t}=this.props;this.setState({isPending:!0}),Object(l.recordEvent)("tasklist_appearance_create_homepage",{create_homepage:!0}),S()({path:"/wc-admin/onboarding/tasks/create_homepage",method:"POST"}).then(o=>{e(),t(o.status,o.message,{actions:o.edit_post_link?[{label:Object(n.__)("Customize",'woocommerce'),onClick:()=>{Object(l.queueRecordEvent)("tasklist_appearance_customize_homepage",{}),window.location=o.edit_post_link+"&wc_onboarding_active_task=homepage"}}]:null}),this.setState({isPending:!1}),this.completeStep()}).catch(e=>{t("error",e.message),this.setState({isPending:!1})})}async updateLogo(){const{clearTaskStatusCache:e,createNotice:t,stylesheet:o,themeMods:c,updateOptions:a}=this.props,{logo:s}=this.state,i={...c,custom_logo:s?s.id:null};Object(l.recordEvent)("tasklist_appearance_upload_logo"),this.setState({isUpdatingLogo:!0});const r=await a({["theme_mods_"+o]:i});e(),r.success?(this.setState({isUpdatingLogo:!1}),t("success",Object(n.__)("Store logo updated sucessfully",'woocommerce')),this.completeStep()):t("error",r.message)}async updateNotice(){const{clearTaskStatusCache:e,createNotice:t,updateOptions:o}=this.props,{storeNoticeText:c}=this.state;Object(l.recordEvent)("tasklist_appearance_set_store_notice",{added_text:Boolean(c.length)}),this.setState({isUpdatingNotice:!0});const a=await o({woocommerce_task_list_appearance_complete:!0,woocommerce_demo_store:c.length?"yes":"no",woocommerce_demo_store_notice:c});e(),a.success?(this.setState({isUpdatingNotice:!1}),t("success",Object(n.__)("🎨 Your store is looking great! Don't forget to continue personalizing it",'woocommerce')),this.completeStep()):t("error",a.message)}getSteps(){const{isDirty:e,isPending:t,logo:o,storeNoticeText:s,isUpdatingLogo:i}=this.state,r=[{key:"import",label:Object(n.__)("Import sample products",'woocommerce'),description:Object(n.__)("We’ll add some products that will make it easier to see what your store looks like",'woocommerce'),content:Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.Button,{onClick:this.importProducts,isBusy:t,isPrimary:!0},Object(n.__)("Import products",'woocommerce')),Object(c.createElement)(a.Button,{onClick:()=>this.completeStep()},Object(n.__)("Skip",'woocommerce'))),visible:this.stepVisibility.import},{key:"homepage",label:Object(n.__)("Create a custom homepage",'woocommerce'),description:Object(n.__)("Create a new homepage and customize it to suit your needs",'woocommerce'),content:Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.Button,{isPrimary:!0,isBusy:t,onClick:this.createHomepage},Object(n.__)("Create homepage",'woocommerce')),Object(c.createElement)(a.Button,{isTertiary:!0,onClick:()=>{Object(l.recordEvent)("tasklist_appearance_create_homepage",{create_homepage:!1}),this.completeStep()}},Object(n.__)("Skip",'woocommerce'))),visible:this.stepVisibility.homepage},{key:"logo",label:Object(n.__)("Upload a logo",'woocommerce'),description:Object(n.__)("Ensure your store is on-brand by adding your logo",'woocommerce'),content:t?null:Object(c.createElement)(c.Fragment,null,Object(c.createElement)(d.ImageUpload,{image:o,onChange:e=>this.setState({isDirty:!0,logo:e})}),Object(c.createElement)(a.Button,{disabled:!o&&!e,onClick:this.updateLogo,isBusy:i,isPrimary:!0},Object(n.__)("Proceed",'woocommerce')),Object(c.createElement)(a.Button,{isTertiary:!0,onClick:()=>this.completeStep()},Object(n.__)("Skip",'woocommerce'))),visible:!0},{key:"notice",label:Object(n.__)("Set a store notice",'woocommerce'),description:Object(n.__)("Optionally display a prominent notice across all pages of your store",'woocommerce'),content:Object(c.createElement)(c.Fragment,null,Object(c.createElement)(d.TextControl,{label:Object(n.__)("Store notice text",'woocommerce'),placeholder:Object(n.__)("Store notice text",'woocommerce'),value:s,onChange:e=>this.setState({storeNoticeText:e})}),Object(c.createElement)(a.Button,{onClick:this.updateNotice,isPrimary:!0},Object(n.__)("Complete task",'woocommerce'))),visible:!0}];return Object(u.filter)(r,e=>e.visible)}render(){const{isPending:e,stepIndex:t,isUpdatingLogo:o,isUpdatingNotice:n}=this.state,s=this.getSteps()[t].key;return Object(c.createElement)("div",{className:"woocommerce-task-appearance"},Object(c.createElement)(a.Card,{className:"woocommerce-task-card"},Object(c.createElement)(a.CardBody,null,Object(c.createElement)(d.Stepper,{isPending:n||o||e,isVertical:!0,currentStep:s,steps:this.getSteps()}))))}}var f=Object(p.compose)(Object(i.withSelect)(e=>{const{getOption:t}=e(r.OPTIONS_STORE_NAME),{getTasksStatus:o}=e(r.ONBOARDING_STORE_NAME),c=o();return{demoStoreNotice:t("woocommerce_demo_store_notice"),stylesheet:t("stylesheet"),tasksStatus:c}}),Object(i.withDispatch)(e=>{const{createNotice:t}=e("core/notices"),{updateOptions:o}=e(r.OPTIONS_STORE_NAME),{invalidateResolutionForStoreSelector:c}=e(r.ONBOARDING_STORE_NAME);return{clearTaskStatusCache:()=>c("getTasksStatus"),createNotice:t,updateOptions:o}}))(v),C=o(115),T=o(8),x=Object(c.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(T.Path,{d:"M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})),N=o(470),P=Object(c.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(T.Path,{d:"M10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6zM10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6z"})),A=Object(c.createElement)(T.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)(T.Path,{d:"M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5zM8 12.8h8v-1.5H8v1.5zm0 3h8v-1.5H8v1.5z"})),I=Object(c.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(T.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})),R=(o(585),o(507));const M=[{key:"physical",title:Object(n.__)("Physical product",'woocommerce'),subtitle:Object(n.__)("Tangible items that get delivered to customers",'woocommerce')},{key:"digital",title:Object(n.__)("Digital product",'woocommerce'),subtitle:Object(n.__)("Items that customers download or access through your website",'woocommerce')},{key:"variable",title:Object(n.__)("Variable product",'woocommerce'),subtitle:Object(n.__)("Products with several versions that customers can choose from",'woocommerce')}];function B({onClose:e}){const[t,o]=Object(c.useState)(null),[s,m]=Object(c.useState)(!1),{createProductFromTemplate:d}=Object(i.useDispatch)(r.ITEMS_STORE_NAME),p=Object(y.applyFilters)("woocommerce_admin_onboarding_product_templates",M);return Object(c.createElement)(a.Modal,{title:Object(n.__)("Start with a template"),isDismissible:!0,onRequestClose:()=>e(),className:"woocommerce-product-template-modal"},Object(c.createElement)("div",{className:"woocommerce-product-template-modal__wrapper"},Object(c.createElement)("div",{className:"woocommerce-product-template-modal__list"},Object(c.createElement)(a.RadioControl,{selected:t,options:p.map(e=>({label:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("span",{className:"woocommerce-product-template-modal__list-title"},e.title),Object(c.createElement)("span",{className:"woocommerce-product-template-modal__list-subtitle"},e.subtitle)),value:e.key})),onChange:o})),Object(c.createElement)("div",{className:"woocommerce-product-template-modal__actions"},Object(c.createElement)(a.Button,{isPrimary:!0,isBusy:s,disabled:!t||s,onClick:()=>{m(!0),Object(l.recordEvent)("tasklist_product_template_selection",{product_type:t}),t?d({template_name:t,status:"draft"},{_fields:["id"]}).then(e=>{if(e&&e.id){const t=Object(b.e)(`post.php?post=${e.id}&action=edit&wc_onboarding_active_task=products&tutorial=true`);window.location=t}},e=>{Object(R.a)(e),m(!1)}):e&&(Object(l.recordEvent)("tasklist_product_template_dismiss"),e())}},Object(n.__)("Go")))))}const G=[{key:"addProductTemplate",title:Object(c.createElement)(c.Fragment,null,Object(n.__)("Start with a template",'woocommerce'),Object(c.createElement)(d.Pill,null,Object(n.__)("Recommended",'woocommerce'))),content:Object(n.__)("Use a template to add physical, digital, and variable products",'woocommerce'),before:Object(c.createElement)(C.a,{icon:x}),after:Object(c.createElement)(C.a,{icon:N.a}),onClick:()=>Object(l.recordEvent)("tasklist_add_product",{method:"product_template"})},{key:"addProductManually",title:Object(n.__)("Add manually",'woocommerce'),content:Object(n.__)("For small stores we recommend adding products manually",'woocommerce'),before:Object(c.createElement)(C.a,{icon:P}),after:Object(c.createElement)(C.a,{icon:N.a}),onClick:()=>Object(l.recordEvent)("tasklist_add_product",{method:"manually"}),href:Object(b.e)("post-new.php?post_type=product&wc_onboarding_active_task=products&tutorial=true")},{key:"importProducts",title:Object(n.__)("Import via CSV",'woocommerce'),content:Object(n.__)("For larger stores we recommend importing all products at once via CSV file",'woocommerce'),before:Object(c.createElement)(C.a,{icon:A}),after:Object(c.createElement)(C.a,{icon:N.a}),onClick:()=>Object(l.recordEvent)("tasklist_add_product",{method:"import"}),href:Object(b.e)("edit.php?post_type=product&page=product_importer&wc_onboarding_active_task=product-import")},{key:"migrateProducts",title:Object(n.__)("Import from another service",'woocommerce'),content:Object(n.__)("For stores currently selling elsewhere we suggest using a product migration service",'woocommerce'),before:Object(c.createElement)(C.a,{icon:I}),after:Object(c.createElement)(C.a,{icon:N.a}),onClick:()=>Object(l.recordEvent)("tasklist_add_product",{method:"migrate"}),href:"https://woocommerce.com/products/cart2cart/",target:"_blank"}];function L(){const[e,t]=Object(c.useState)(null),o=G.map(e=>({...e,onClick:()=>(e=>{e.onClick(),"addProductTemplate"===e.key&&t(!0)})(e)}));return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.Card,{className:"woocommerce-task-card"},Object(c.createElement)(a.CardBody,{size:null},Object(c.createElement)(d.List,{items:o}))),e?Object(c.createElement)(B,{onClose:()=>t(null)}):null)}var F=o(35),D=o.n(F),U=o(18),z=o.n(U),H=o(1),q=o.n(H);class V extends c.Component{constructor(e){super(e),this.state={isConnecting:!1},this.connectJetpack=this.connectJetpack.bind(this),e.setIsPending(!0)}componentDidUpdate(e){const{createNotice:t,error:o,isRequesting:c,onError:n,setIsPending:a}=this.props;e.isRequesting&&!c&&a(!1),o&&o!==e.error&&(n&&n(),t("error",o))}async connectJetpack(){const{jetpackConnectUrl:e,onConnect:t}=this.props;this.setState({isConnecting:!0},()=>{t&&t(),window.location=e})}render(){const{hasErrors:e,isRequesting:t,onSkip:o,skipText:s,onAbort:i,abortText:r}=this.props;return Object(c.createElement)(c.Fragment,null,e?Object(c.createElement)(a.Button,{isPrimary:!0,onClick:()=>window.location.reload()},Object(n.__)("Retry",'woocommerce')):Object(c.createElement)(a.Button,{disabled:t,isBusy:this.state.isConnecting,isPrimary:!0,onClick:this.connectJetpack},Object(n.__)("Connect",'woocommerce')),o&&Object(c.createElement)(a.Button,{onClick:o},s||Object(n.__)("No thanks",'woocommerce')),i&&Object(c.createElement)(a.Button,{onClick:i},r||Object(n.__)("Abort",'woocommerce')))}}V.propTypes={createNotice:q.a.func.isRequired,error:q.a.string,hasErrors:q.a.bool,isRequesting:q.a.bool,jetpackConnectUrl:q.a.string,onConnect:q.a.func,onError:q.a.func,onSkip:q.a.func,redirectUrl:q.a.string,skipText:q.a.string,setIsPending:q.a.func,onAbort:q.a.func,abortText:q.a.string},V.defaultProps={setIsPending:()=>{}};var J=Object(p.compose)(Object(i.withSelect)((e,t)=>{const{getJetpackConnectUrl:o,isPluginsRequesting:c,getPluginsError:n}=e(r.PLUGINS_STORE_NAME),a={redirect_url:t.redirectUrl||window.location.href},s=c("getJetpackConnectUrl");return{error:n("getJetpackConnectUrl")||"",isRequesting:s,jetpackConnectUrl:o(a)}}),Object(i.withDispatch)(e=>{const{createNotice:t}=e("core/notices");return{createNotice:t}}))(V),W=o(524);class Y extends c.Component{constructor(){super(...arguments),this.onSubmit=this.onSubmit.bind(this)}async onSubmit(e){const{onComplete:t,createNotice:o,isSettingsError:c,updateAndPersistSettingsForGroup:a,settings:s}=this.props;await a("general",{general:{...s,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}}),c?o("error",Object(n.__)("There was a problem saving your store location",'woocommerce')):t(e)}getInitialValues(){const{settings:e}=this.props,{woocommerce_store_address:t,woocommerce_store_address_2:o,woocommerce_store_city:c,woocommerce_default_country:n,woocommerce_store_postcode:a}=e;return{addressLine1:t||"",addressLine2:o||"",city:c||"",countryState:n||"",postCode:a||""}}render(){const{isSettingsRequesting:e}=this.props;return e?null:Object(c.createElement)(d.Form,{initialValues:this.getInitialValues(),onSubmit:this.onSubmit,validate:W.b},({getInputProps:e,handleSubmit:t,setValue:o})=>Object(c.createElement)(c.Fragment,null,Object(c.createElement)(W.a,{getInputProps:e,setValue:o}),Object(c.createElement)(a.Button,{isPrimary:!0,onClick:t},Object(n.__)("Continue",'woocommerce'))))}}var Z=Object(c.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(T.Path,{d:"M9 0C4.03 0 0 4.03 0 9s4.03 9 9 9 9-4.03 9-9-4.03-9-9-9zM1.11 9.68h2.51c.04.91.167 1.814.38 2.7H1.84c-.403-.85-.65-1.764-.73-2.7zm8.57-5.4V1.19c.964.366 1.756 1.08 2.22 2 .205.347.386.708.54 1.08l-2.76.01zm3.22 1.35c.232.883.37 1.788.41 2.7H9.68v-2.7h3.22zM8.32 1.19v3.09H5.56c.154-.372.335-.733.54-1.08.462-.924 1.255-1.64 2.22-2.01zm0 4.44v2.7H4.7c.04-.912.178-1.817.41-2.7h3.21zm-4.7 2.69H1.11c.08-.936.327-1.85.73-2.7H4c-.213.886-.34 1.79-.38 2.7zM4.7 9.68h3.62v2.7H5.11c-.232-.883-.37-1.788-.41-2.7zm3.63 4v3.09c-.964-.366-1.756-1.08-2.22-2-.205-.347-.386-.708-.54-1.08l2.76-.01zm1.35 3.09v-3.04h2.76c-.154.372-.335.733-.54 1.08-.464.92-1.256 1.634-2.22 2v-.04zm0-4.44v-2.7h3.62c-.04.912-.178 1.817-.41 2.7H9.68zm4.71-2.7h2.51c-.08.936-.327 1.85-.73 2.7H14c.21-.87.337-1.757.38-2.65l.01-.05zm0-1.35c-.046-.894-.176-1.78-.39-2.65h2.16c.403.85.65 1.764.73 2.7l-2.5-.05zm1-4H13.6c-.324-.91-.793-1.76-1.39-2.52 1.244.56 2.325 1.426 3.14 2.52h.04zm-9.6-2.52c-.597.76-1.066 1.61-1.39 2.52H2.65c.815-1.094 1.896-1.96 3.14-2.52zm-3.15 12H4.4c.324.91.793 1.76 1.39 2.52-1.248-.567-2.33-1.445-3.14-2.55l-.01.03zm9.56 2.52c.597-.76 1.066-1.61 1.39-2.52h1.76c-.82 1.08-1.9 1.933-3.14 2.48l-.01.04z"})),$=o(497);class Q extends c.Component{constructor(){super(...arguments),this.updateShippingZones=this.updateShippingZones.bind(this)}getShippingMethods(e,t=null){return e&&e.methods&&Array.isArray(e.methods)?t?e.methods?e.methods.filter(e=>e.method_id===t):[]:e.methods:[]}disableShippingMethods(e,t){t.length&&t.forEach(t=>{S()({method:"POST",path:`/wc/v3/shipping/zones/${e.id}/methods/${t.instance_id}`,data:{enabled:!1}})})}async updateShippingZones(e){const{clearTaskStatusCache:t,createNotice:o,shippingZones:c}=this.props;let a=!1,s=!1;c.forEach(t=>{0===t.id?a=t.toggleable&&e[t.id+"_enabled"]:s=""!==e[t.id+"_rate"]&&parseFloat(e[t.id+"_rate"])!==parseFloat(0);const o=this.getShippingMethods(t),c=parseFloat(e[t.id+"_rate"])===parseFloat(0)?"free_shipping":"flat_rate",n=this.getShippingMethods(t,c).length?this.getShippingMethods(t,c)[0]:null;if(!t.toggleable||e[t.id+"_enabled"]){if(n){const e=o.filter(e=>e.instance_id!==n.instance_id);this.disableShippingMethods(t,e)}S()({method:"POST",path:n?`/wc/v3/shipping/zones/${t.id}/methods/${n.instance_id}`:`/wc/v3/shipping/zones/${t.id}/methods`,data:{method_id:c,enabled:!0,settings:{cost:e[t.id+"_rate"]}}})}else this.disableShippingMethods(t,o)}),Object(l.recordEvent)("tasklist_shipping_set_costs",{shipping_cost:s,rest_world:a}),t(),o("success",Object(n.__)("Your shipping rates have been updated",'woocommerce')),this.props.onComplete()}renderInputPrefix(){const{symbolPosition:e,symbol:t}=this.context.getCurrencyConfig();return 0===e.indexOf("right")?null:Object(c.createElement)("span",{className:"woocommerce-shipping-rate__control-prefix"},t)}renderInputSuffix(e){const{symbolPosition:t,symbol:o}=this.context.getCurrencyConfig();return 0===t.indexOf("right")?Object(c.createElement)("span",{className:"woocommerce-shipping-rate__control-suffix"},o):parseFloat(e)===parseFloat(0)?Object(c.createElement)("span",{className:"woocommerce-shipping-rate__control-suffix"},Object(n.__)("Free shipping",'woocommerce')):null}getFormattedRate(e){const{formatDecimalString:t}=this.context,o=t(e);return e.length&&o.length?t(e):t(0)}getInitialValues(){const{formatDecimalString:e}=this.context,t={};return this.props.shippingZones.forEach(o=>{const c=this.getShippingMethods(o),n=c.length&&c[0].settings.cost?this.getFormattedRate(c[0].settings.cost.value):e(0);t[o.id+"_rate"]=n,c.length&&c[0].enabled?t[o.id+"_enabled"]=!0:t[o.id+"_enabled"]=!1}),t}validate(e){const t={};return Object.keys(e).filter(e=>e.endsWith("_rate")).forEach(o=>{e[o]<0&&(t[o]=Object(n.__)("Shipping rates can not be negative numbers.",'woocommerce'))}),t}render(){const{buttonText:e,shippingZones:t}=this.props;return t.length?Object(c.createElement)(d.Form,{initialValues:this.getInitialValues(),onSubmit:this.updateShippingZones,validate:this.validate},({getInputProps:o,handleSubmit:s,setTouched:i,setValue:r,values:m})=>Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"woocommerce-shipping-rates"},t.map(e=>Object(c.createElement)("div",{className:"woocommerce-shipping-rate",key:e.id},Object(c.createElement)("div",{className:"woocommerce-shipping-rate__icon"},e.locations?e.locations.map(e=>Object(c.createElement)(d.Flag,{size:24,code:e.code,key:e.code})):Object(c.createElement)(C.a,{icon:Z})),Object(c.createElement)("div",{className:"woocommerce-shipping-rate__main"},e.toggleable?Object(c.createElement)("label",{htmlFor:"woocommerce-shipping-rate__toggle-"+e.id,className:"woocommerce-shipping-rate__name"},e.name,Object(c.createElement)(a.FormToggle,D()({id:"woocommerce-shipping-rate__toggle-"+e.id},o(e.id+"_enabled")))):Object(c.createElement)("div",{className:"woocommerce-shipping-rate__name"},e.name),(!e.toggleable||m[e.id+"_enabled"])&&Object(c.createElement)(d.TextControlWithAffixes,D()({label:Object(n.__)("Shipping cost",'woocommerce'),required:!0},o(e.id+"_rate"),{onBlur:()=>{i(e.id+"_rate"),r(e.id+"_rate",this.getFormattedRate(m[e.id+"_rate"]))},prefix:this.renderInputPrefix(),suffix:this.renderInputSuffix(m[e.id+"_rate"]),className:"muriel-input-text woocommerce-shipping-rate__control-wrapper"})))))),Object(c.createElement)(a.Button,{isPrimary:!0,onClick:s},e||Object(n.__)("Update",'woocommerce')))):null}}Q.propTypes={buttonText:q.a.string,onComplete:q.a.func.isRequired,createNotice:q.a.func.isRequired,shippingZones:q.a.array},Q.defaultProps={shippingZones:[]},Q.contextType=$.a;var K=Object(p.compose)(Object(i.withDispatch)(e=>{const{invalidateResolutionForStoreSelector:t}=e(r.ONBOARDING_STORE_NAME);return{clearTaskStatusCache:()=>t("getTasksStatus")}}))(Q);class X extends c.Component{constructor(e){super(e),this.initialState={isPending:!1,step:"store_location",shippingZones:[]},this.activePlugins=e.activePlugins,this.state=this.initialState,this.completeStep=this.completeStep.bind(this)}componentDidMount(){this.reset()}reset(){this.setState(this.initialState)}async fetchShippingZones(){this.setState({isPending:!0});const{countryCode:e,countryName:t}=this.props,o=[],c=await S()({path:"/wc/v3/shipping/zones"});let a=!1;if(await Promise.all(c.map(async t=>{if(0===t.id)return t.methods=await S()({path:`/wc/v3/shipping/zones/${t.id}/methods`}),t.name=Object(n.__)("Rest of the world",'woocommerce'),t.toggleable=!0,void o.push(t);t.locations=await S()({path:`/wc/v3/shipping/zones/${t.id}/locations`});t.locations.find(t=>e===t.code)&&(t.methods=await S()({path:`/wc/v3/shipping/zones/${t.id}/methods`}),o.push(t),a=!0)})),!a){const c=await S()({method:"POST",path:"/wc/v3/shipping/zones",data:{name:t}});c.locations=await S()({method:"POST",path:`/wc/v3/shipping/zones/${c.id}/locations`,data:[{code:e,type:"country"}]}),o.push(c)}o.reverse(),this.setState({isPending:!1,shippingZones:o})}componentDidUpdate(e,t){const{countryCode:o,settings:c}=this.props,{woocommerce_store_address:n,woocommerce_default_country:a,woocommerce_store_postcode:s}=c,{step:i}=this.state;"rates"!==i||e.countryCode===o&&"rates"===t.step||this.fetchShippingZones();const r=Boolean(n&&a&&s);"store_location"===i&&r&&this.completeStep()}completeStep(){const{createNotice:e}=this.props,{step:t}=this.state,o=this.getSteps(),c=o.findIndex(e=>e.key===t),a=o[c+1];a?this.setState({step:a.key}):(e("success",Object(n.__)("📦 Shipping is done! Don't worry, you can always change it later",'woocommerce')),Object(k.getHistory)().push(Object(k.getNewPath)({},"/",{})))}getPluginsToActivate(){const{countryCode:e}=this.props,t=[];return["GB","CA","AU"].includes(e)?t.push("woocommerce-shipstation-integration"):"US"===e&&(t.push("woocommerce-services"),t.push("jetpack")),Object(u.difference)(t,this.activePlugins)}getSteps(){const{countryCode:e,isJetpackConnected:t,settings:o}=this.props,a=this.getPluginsToActivate(),s=!t&&"US"===e,i=[{key:"store_location",label:Object(n.__)("Set store location",'woocommerce'),description:Object(n.__)("The address from which your business operates",'woocommerce'),content:Object(c.createElement)(Y,D()({},this.props,{onComplete:e=>{const t=Object(h.b)(e.countryState);Object(l.recordEvent)("tasklist_shipping_set_location",{country:t}),this.completeStep()}})),visible:!0},{key:"rates",label:Object(n.__)("Set shipping costs",'woocommerce'),description:Object(n.__)("Define how much customers pay to ship to different destinations",'woocommerce'),content:Object(c.createElement)(K,D()({buttonText:a.length||s?Object(n.__)("Proceed",'woocommerce'):Object(n.__)("Complete task",'woocommerce'),shippingZones:this.state.shippingZones,onComplete:this.completeStep},this.props)),visible:"disabled"!==o.woocommerce_ship_to_countries},{key:"label_printing",label:Object(n.__)("Enable shipping label printing",'woocommerce'),description:a.includes("woocommerce-shipstation-integration")?z()({mixedString:Object(n.__)("We recommend using ShipStation to save time at the post office by printing your shipping labels at home. Try ShipStation free for 30 days. {{link}}Learn more{{/link}}.",'woocommerce'),components:{link:Object(c.createElement)(d.Link,{href:"https://woocommerce.com/products/shipstation-integration",target:"_blank",type:"external"})}}):Object(n.__)("With WooCommerce Shipping you can save time by printing your USPS and DHL Express shipping labels at home",'woocommerce'),content:Object(c.createElement)(d.Plugins,D()({onComplete:(e,t)=>{Object(R.a)(t),Object(l.recordEvent)("tasklist_shipping_label_printing",{install:!0,plugins_to_activate:a}),this.completeStep()},onError:(e,t)=>Object(R.a)(t),onSkip:()=>{Object(l.recordEvent)("tasklist_shipping_label_printing",{install:!1,plugins_to_activate:a}),Object(k.getHistory)().push(Object(k.getNewPath)({},"/",{}))},pluginSlugs:a},this.props)),visible:a.length},{key:"connect",label:Object(n.__)("Connect your store",'woocommerce'),description:Object(n.__)("Connect your store to WordPress.com to enable label printing",'woocommerce'),content:Object(c.createElement)(J,D()({redirectUrl:Object(b.e)("admin.php?page=wc-admin"),completeStep:this.completeStep},this.props,{onConnect:()=>{Object(l.recordEvent)("tasklist_shipping_connect_store")}})),visible:s}];return Object(u.filter)(i,e=>e.visible)}render(){const{isPending:e,step:t}=this.state,{isUpdateSettingsRequesting:o}=this.props;return Object(c.createElement)("div",{className:"woocommerce-task-shipping"},Object(c.createElement)(a.Card,{className:"woocommerce-task-card"},Object(c.createElement)(a.CardBody,null,Object(c.createElement)(d.Stepper,{isPending:e||o,isVertical:!0,currentStep:t,steps:this.getSteps()}))))}}var ee=Object(p.compose)(Object(i.withSelect)(e=>{const{getSettings:t,isUpdateSettingsRequesting:o}=e(r.SETTINGS_STORE_NAME),{getActivePlugins:c,isJetpackConnected:n}=e(r.PLUGINS_STORE_NAME),{general:a={}}=t("general"),s=Object(h.b)(a.woocommerce_default_country),{countries:i=[]}=Object(b.f)("dataEndpoints",{}),m=s?i.find(e=>e.code===s):null,l=m?m.name:null,d=c();return{countryCode:s,countryName:l,isUpdateSettingsRequesting:o("general"),settings:a,activePlugins:d,isJetpackConnected:n()}}),Object(i.withDispatch)(e=>{const{createNotice:t}=e("core/notices"),{updateAndPersistSettingsForGroup:o}=e(r.SETTINGS_STORE_NAME);return{createNotice:t,updateAndPersistSettingsForGroup:o}}))(X),te=o(20);class oe extends c.Component{constructor(e){super(e);const{hasCompleteAddress:t,pluginsToActivate:o}=e;this.initialState={isPending:!1,stepIndex:t?1:0,cachedPluginsToActivate:o},this.state=this.initialState,this.completeStep=this.completeStep.bind(this)}componentDidMount(){const{query:e}=this.props,{auto:t}=e;this.reset(),"true"===t&&this.enableAutomatedTax()}reset(){this.setState(this.initialState)}shouldShowSuccessScreen(){const{isJetpackConnected:e,hasCompleteAddress:t,pluginsToActivate:o}=this.props;return t&&!o.length&&e&&this.isTaxJarSupported()}isTaxJarSupported(){const{countryCode:e,tasksStatus:t}=this.props,{automatedTaxSupportedCountries:o=[],taxJarActivated:c}=t;return!c&&o.includes(e)}completeStep(){const{stepIndex:e}=this.state;this.getSteps()[e+1]&&this.setState({stepIndex:e+1})}async manuallyConfigureTaxRates(){const{generalSettings:e,updateAndPersistSettingsForGroup:t}=this.props;"yes"!==e.woocommerce_calc_taxes?(this.setState({isPending:!0}),t("general",{general:{...e,woocommerce_calc_taxes:"yes"}}).then(()=>this.redirectToTaxSettings()).catch(e=>Object(R.a)(e))):this.redirectToTaxSettings()}updateAutomatedTax(e){const{clearTaskStatusCache:t,createNotice:o,updateAndPersistSettingsForGroup:c,generalSettings:a,taxSettings:s}=this.props;Promise.all([c("tax",{tax:{...s,wc_connect_taxes_enabled:e?"yes":"no"}}),c("general",{general:{...a,woocommerce_calc_taxes:"yes"}})]).then(()=>{t(),e?(o("success",Object(n.__)("You're awesome! One less item on your to-do list ✅",'woocommerce')),Object(k.getHistory)().push(Object(k.getNewPath)({},"/",{}))):this.redirectToTaxSettings()}).catch(()=>{o("error",Object(n.__)("There was a problem updating your tax settings",'woocommerce'))})}redirectToTaxSettings(){window.location=Object(b.e)("admin.php?page=wc-settings&tab=tax§ion=standard&wc_onboarding_active_task=tax")}doNotChargeSalesTax(){const{updateOptions:e}=this.props;Object(l.queueRecordEvent)("tasklist_tax_connect_store",{connect:!1,no_tax:!0}),e({woocommerce_no_sales_tax:!0,woocommerce_calc_taxes:"no"}).then(()=>{window.location=Object(b.e)("admin.php?page=wc-admin")})}getSteps(){const{generalSettings:e,isJetpackConnected:t,isPending:o,tosAccepted:s,updateOptions:i}=this.props,{cachedPluginsToActivate:r}=this.state;let m,p;r.includes("woocommerce-services")?(m=Object(n.__)("Install Jetpack and WooCommerce Tax",'woocommerce'),p=Object(n.__)("By installing Jetpack and WooCommerce Tax you agree to the {{link}}Terms of Service{{/link}}.",'woocommerce')):(m=Object(n.__)("Install Jetpack",'woocommerce'),p=Object(n.__)("By installing Jetpack you agree to the {{link}}Terms of Service{{/link}}.",'woocommerce'));const _=[{key:"store_location",label:Object(n.__)("Set store location",'woocommerce'),description:Object(n.__)("The address from which your business operates",'woocommerce'),content:Object(c.createElement)(Y,D()({},this.props,{onComplete:e=>{const t=Object(h.b)(e.countryState);Object(l.recordEvent)("tasklist_tax_set_location",{country:t}),this.completeStep()},isSettingsRequesting:!1,settings:e})),visible:!0},{key:"plugins",label:m,description:Object(n.__)("Jetpack and WooCommerce Tax allow you to automate sales tax calculations",'woocommerce'),content:Object(c.createElement)(c.Fragment,null,Object(c.createElement)(d.Plugins,{onComplete:(e,t)=>{Object(R.a)(t),Object(l.recordEvent)("tasklist_tax_install_extensions",{install_extensions:!0}),i({woocommerce_setup_jetpack_opted_in:!0}),this.completeStep()},onError:(e,t)=>Object(R.a)(t),onSkip:()=>{Object(l.queueRecordEvent)("tasklist_tax_install_extensions",{install_extensions:!1}),this.manuallyConfigureTaxRates()},skipText:Object(n.__)("Set up manually",'woocommerce'),onAbort:()=>this.doNotChargeSalesTax(),abortText:Object(n.__)("I don't charge sales tax",'woocommerce')}),!s&&Object(c.createElement)(te.Text,{variant:"caption",className:"woocommerce-task__caption",size:"12",lineHeight:"16px"},z()({mixedString:p,components:{link:Object(c.createElement)(d.Link,{href:"https://wordpress.com/tos/",target:"_blank",type:"external"})}}))),visible:(r.length||!s)&&this.isTaxJarSupported()},{key:"connect",label:Object(n.__)("Connect your store",'woocommerce'),description:Object(n.__)("Connect your store to WordPress.com to enable automated sales tax calculations",'woocommerce'),content:Object(c.createElement)(J,D()({},this.props,{onConnect:()=>{Object(l.recordEvent)("tasklist_tax_connect_store",{connect:!0,no_tax:!1})},onSkip:()=>{Object(l.queueRecordEvent)("tasklist_tax_connect_store",{connect:!1,no_tax:!1}),this.manuallyConfigureTaxRates()},skipText:Object(n.__)("Set up tax rates manually",'woocommerce'),onAbort:()=>this.doNotChargeSalesTax(),abortText:Object(n.__)("My business doesn't charge sales tax",'woocommerce')})),visible:!t&&this.isTaxJarSupported()},{key:"manual_configuration",label:Object(n.__)("Configure tax rates",'woocommerce'),description:Object(n.__)("Head over to the tax rate settings screen to configure your tax rates",'woocommerce'),content:Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.Button,{disabled:o,isPrimary:!0,isBusy:o,onClick:()=>{Object(l.recordEvent)("tasklist_tax_config_rates"),this.manuallyConfigureTaxRates()}},Object(n.__)("Configure",'woocommerce')),Object(c.createElement)("p",null,"yes"!==e.woocommerce_calc_taxes&&z()({mixedString:Object(n.__)('By clicking "Configure" you\'re enabling tax rates and calculations. More info {{link}}here{{/link}}.','woocommerce'),components:{link:Object(c.createElement)(d.Link,{href:"https://docs.woocommerce.com/document/setting-up-taxes-in-woocommerce/#section-1",target:"_blank",type:"external"})}}))),visible:!this.isTaxJarSupported()}];return Object(u.filter)(_,e=>e.visible)}enableAutomatedTax(){Object(l.recordEvent)("tasklist_tax_setup_automated_proceed",{setup_automatically:!0}),this.updateAutomatedTax(!0)}renderSuccessScreen(){const{isPending:e}=this.props;return Object(c.createElement)("div",{className:"woocommerce-task-tax__success"},Object(c.createElement)("span",{className:"woocommerce-task-tax__success-icon",role:"img","aria-labelledby":"woocommerce-task-tax__success-message"},"🎊"),Object(c.createElement)(d.H,{id:"woocommerce-task-tax__success-message"},Object(n.__)("Good news!",'woocommerce')),Object(c.createElement)("p",null,z()({mixedString:Object(n.__)("{{strong}}Jetpack{{/strong}} and {{strong}}WooCommerce Tax{{/strong}} can automate your sales tax calculations for you.",'woocommerce'),components:{strong:Object(c.createElement)("strong",null)}})),Object(c.createElement)(a.Button,{disabled:e,isPrimary:!0,isBusy:e,onClick:this.enableAutomatedTax.bind(this)},Object(n.__)("Yes please",'woocommerce')),Object(c.createElement)(a.Button,{disabled:e,isTertiary:!0,onClick:()=>{Object(l.recordEvent)("tasklist_tax_setup_automated_proceed",{setup_automatically:!1}),this.updateAutomatedTax(!1)}},Object(n.__)("No thanks, I'll set up manually",'woocommerce')),Object(c.createElement)(a.Button,{disabled:e,isTertiary:!0,onClick:()=>this.doNotChargeSalesTax()},Object(n.__)("I don't charge sales tax",'woocommerce')))}render(){const{stepIndex:e}=this.state,{isPending:t,isResolving:o}=this.props;if(o)return Object(c.createElement)(d.Spinner,null);const n=this.getSteps()[e];return Object(c.createElement)("div",{className:"woocommerce-task-tax"},Object(c.createElement)(a.Card,{className:"woocommerce-task-card"},Object(c.createElement)(a.CardBody,null,this.shouldShowSuccessScreen()?this.renderSuccessScreen():Object(c.createElement)(d.Stepper,{isPending:t||o,isVertical:!0,currentStep:n.key,steps:this.getSteps()}))))}}var ce=Object(p.compose)(Object(i.withSelect)(e=>{const{getSettings:t,isUpdateSettingsRequesting:o}=e(r.SETTINGS_STORE_NAME),{getOption:c,isResolving:n}=e(r.OPTIONS_STORE_NAME),{getActivePlugins:a,isJetpackConnected:s,isPluginsRequesting:i}=e(r.PLUGINS_STORE_NAME),{getTasksStatus:m}=e(r.ONBOARDING_STORE_NAME),{general:l={}}=t("general"),d=Object(h.b)(l.woocommerce_default_country),{woocommerce_store_address:p,woocommerce_default_country:_,woocommerce_store_postcode:b}=l,g=Boolean(p&&_&&b),{tax:O={}}=t("tax"),j=a(),w=Object(u.difference)(["jetpack","woocommerce-services"],j),y=c("wc_connect_options")||{},k=c("woocommerce_setup_jetpack_opted_in"),E=y.tos_accepted||"1"===k,S=m(),v=o("tax")||o("general"),f=i("getJetpackConnectUrl")||n("getOption",["woocommerce_setup_jetpack_opted_in"])||void 0===k;return{countryCode:d,generalSettings:l,hasCompleteAddress:g,isJetpackConnected:s(),isPending:v,isResolving:f,pluginsToActivate:w,tasksStatus:S,taxSettings:O,tosAccepted:E}}),Object(i.withDispatch)(e=>{const{createNotice:t}=e("core/notices"),{updateOptions:o}=e(r.OPTIONS_STORE_NAME),{updateAndPersistSettingsForGroup:c}=e(r.SETTINGS_STORE_NAME),{invalidateResolutionForStoreSelector:n}=e(r.ONBOARDING_STORE_NAME);return{clearTaskStatusCache:()=>n("getTasksStatus"),createNotice:t,updateAndPersistSettingsForGroup:c,updateOptions:o}}))(oe),ne=o(6),ae=o.n(ne),se=o(270),ie=o(537);o(534);const re=({isRecommended:e,markConfigured:t,paymentGateway:o,gatewayIds:n})=>{var s,i;const{image:r,content:m,id:d,plugins:p=[],title:u,loading:_,enabled:b=!1,installed:h=!1,needsSetup:g=!0,requiredSettings:O,settingsUrl:j,is_local_partner:w}=o,y=Object(te.useSlot)("woocommerce_payment_gateway_configure_"+d),k=Object(te.useSlot)("woocommerce_payment_gateway_setup_"+d),E=Boolean(null==y||null===(s=y.fills)||void 0===s?void 0:s.length)||Boolean(null==k||null===(i=k.fills)||void 0===i?void 0:i.length),S=Boolean(p.length||O.length||E),v=e&&g,f=ae()("woocommerce-task-payment","woocommerce-task-card",g&&"woocommerce-task-payment-not-configured","woocommerce-task-payment-"+d);return Object(c.createElement)(c.Fragment,{key:d},Object(c.createElement)(a.CardBody,{style:{paddingLeft:0,marginBottom:0},className:f},Object(c.createElement)(a.CardMedia,{isBorderless:!0},Object(c.createElement)("img",{src:r,alt:u})),Object(c.createElement)("div",{className:"woocommerce-task-payment__description"},v&&Object(c.createElement)(se.RecommendedRibbon,{isLocalPartner:w}),Object(c.createElement)(te.Text,{as:"h3",className:"woocommerce-task-payment__title"},u,h&&g&&!!p.length&&Object(c.createElement)(se.SetupRequired,null)),Object(c.createElement)("div",{className:"woocommerce-task-payment__content"},m)),Object(c.createElement)("div",{className:"woocommerce-task-payment__footer"},Object(c.createElement)(ie.a,{manageUrl:j,id:d,hasSetup:S,needsSetup:g,isEnabled:b,isInstalled:h,hasPlugins:Boolean(p.length),isRecommended:e,isLoading:_,markConfigured:t,onSetup:()=>Object(l.recordEvent)("tasklist_payment_setup",{options:n,selected:d})}))),Object(c.createElement)(a.CardDivider,null))},me=({heading:e,markConfigured:t,recommendation:o,paymentGateways:n})=>Object(c.createElement)(a.Card,null,Object(c.createElement)(a.CardHeader,{as:"h2"},e),n.map(e=>{const{id:a}=e;return Object(c.createElement)(re,{key:a,isRecommended:o===a,markConfigured:t,paymentGateway:e,gatewayIds:n.map(e=>e.id)})})),le=()=>{const e=ae()("woocommerce-task-payment","woocommerce-task-card");return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.CardBody,{style:{paddingLeft:0,marginBottom:0},className:e},Object(c.createElement)(a.CardMedia,{isBorderless:!0},Object(c.createElement)("span",{className:"is-placeholder"})),Object(c.createElement)("div",{className:"woocommerce-task-payment__description"},Object(c.createElement)(te.Text,{as:"h3",className:"woocommerce-task-payment__title"},Object(c.createElement)("span",{className:"is-placeholder"})),Object(c.createElement)("div",{className:"woocommerce-task-payment__content"},Object(c.createElement)("span",{className:"is-placeholder"}))),Object(c.createElement)("div",{className:"woocommerce-task-payment__footer"},Object(c.createElement)("span",{className:"is-placeholder"}))),Object(c.createElement)(a.CardDivider,null))},de=()=>Object(c.createElement)(a.Card,{"aria-hidden":"true",className:"is-loading woocommerce-payment-gateway-suggestions-list-placeholder"},Object(c.createElement)(a.CardHeader,{as:"h2"},Object(c.createElement)("span",{className:"is-placeholder"})),Object(c.createElement)(le,null),Object(c.createElement)(le,null),Object(c.createElement)(le,null)),pe=({markConfigured:e,paymentGateway:t,recordConnectStartEvent:o})=>{var s;const{id:m,connectionUrl:l,setupHelpText:p,settingsUrl:u,title:_,requiredSettings:b}=t,{createNotice:h}=Object(i.useDispatch)("core/notices"),{updatePaymentGateway:O}=Object(i.useDispatch)(r.PAYMENT_GATEWAYS_STORE_NAME),j=Object(te.useSlot)("woocommerce_payment_gateway_configure_"+m),w=Boolean(null==j||null===(s=j.fills)||void 0===s?void 0:s.length),{isUpdating:y}=Object(i.useSelect)(e=>{const{isPaymentGatewayUpdating:t}=e(r.PAYMENT_GATEWAYS_STORE_NAME);return{isUpdating:t()}}),k=t=>{o(m),O(m,{enabled:!0,settings:t}).then(t=>{t&&t.id===m&&(e(m),h("success",Object(n.sprintf)(Object(n.__)("%s configured successfully",'woocommerce'),_)))}).catch(()=>{h("error",Object(n.__)("There was a problem saving your payment settings",'woocommerce'))})},E=p&&Object(c.createElement)("p",{dangerouslySetInnerHTML:Object(g.a)(p)}),S=Object(c.createElement)(d.DynamicForm,{fields:b,isBusy:y,onSubmit:k,submitLabel:Object(n.__)("Proceed",'woocommerce'),validate:e=>((e,t)=>{const o={},c=e=>t.find(t=>t.id===e);for(const[t,n]of Object.entries(e)){const e=c(t),a=e.label.replace(/([A-Z][a-z]+)/g,e=>e.toLowerCase());n||"checkbox"===e.type||(o[t]="Please enter your "+a)}return o})(e,b)});return w?Object(c.createElement)(se.WooPaymentGatewayConfigure.Slot,{fillProps:{defaultForm:S,defaultSubmit:k,defaultFields:b,markConfigured:()=>e(m),paymentGateway:t},id:m}):l?Object(c.createElement)(c.Fragment,null,E,Object(c.createElement)(a.Button,{isPrimary:!0,href:l},Object(n.__)("Connect",'woocommerce'))):b.length?Object(c.createElement)(c.Fragment,null,E,S):Object(c.createElement)(c.Fragment,null,E||Object(c.createElement)("p",null,Object(n.__)("You can manage this payment gateway's settings by clicking the button below",'woocommerce')),Object(c.createElement)(a.Button,{isPrimary:!0,href:u},Object(n.__)("Set up",'woocommerce')))};o(586);const ue=({markConfigured:e,paymentGateway:t,recordConnectStartEvent:o})=>{var s;const{id:m,plugins:p=[],title:u,postInstallScripts:_,installed:h}=t,g=Object(te.useSlot)("woocommerce_payment_gateway_setup_"+m),O=Boolean(null==g||null===(s=g.fills)||void 0===s?void 0:s.length),[j,w]=Object(c.useState)(!1);Object(c.useEffect)(()=>{Object(l.recordEvent)("payments_task_stepper_view",{payment_method:m})},[]);const{invalidateResolutionForStoreSelector:y}=Object(i.useDispatch)(r.PAYMENT_GATEWAYS_STORE_NAME),{isOptionUpdating:k,isPaymentGatewayResolving:E,needsPluginInstall:S}=Object(i.useSelect)(e=>{const{isOptionsUpdating:t}=e(r.OPTIONS_STORE_NAME),{isResolving:o}=e(r.PAYMENT_GATEWAYS_STORE_NAME),c=e(r.PLUGINS_STORE_NAME).getActivePlugins(),n=p.filter(e=>!c.includes(e));return{isOptionUpdating:t(),isPaymentGatewayResolving:o("getPaymentGateways"),needsPluginInstall:!!n.length}});Object(c.useEffect)(()=>{if(!S)if(_&&_.length){const e=_.map(e=>Object(b.d)(e));Promise.all(e).then(()=>{w(!0)})}else w(!0)},[_,S]);const v=Object(c.useMemo)(()=>p&&p.length?{key:"install",label:Object(n.sprintf)(Object(n.__)("Install %s",'woocommerce'),u),content:Object(c.createElement)(d.Plugins,{onComplete:(e,t)=>{Object(R.a)(t),y("getPaymentGateways"),Object(l.recordEvent)("tasklist_payment_install_method",{plugins:p})},onError:(e,t)=>Object(R.a)(t),autoInstall:!0,pluginSlugs:p})}:null,[]),f=Object(c.useMemo)(()=>({key:"configure",label:Object(n.sprintf)(Object(n.__)("Configure your %(title)s account",'woocommerce'),{title:u}),content:h?Object(c.createElement)(pe,{markConfigured:e,paymentGateway:t,recordConnectStartEvent:o}):null}),[h]),C=S||k||E||!j,T=Object(c.createElement)(d.Stepper,{isVertical:!0,isPending:C,currentStep:S?"install":"configure",steps:[v,f].filter(Boolean)});return Object(c.createElement)(a.Card,{className:"woocommerce-task-payment-method woocommerce-task-card"},Object(c.createElement)(a.CardBody,null,O?Object(c.createElement)(se.WooPaymentGatewaySetup.Slot,{fillProps:{defaultStepper:T,defaultInstallStep:v,defaultConfigureStep:f,markConfigured:()=>e(m),paymentGateway:t},id:m}):T))},_e=()=>{const e=ae()("is-loading","woocommerce-task-payment-method","woocommerce-task-card");return Object(c.createElement)(a.Card,{"aria-hidden":"true",className:e},Object(c.createElement)(a.CardBody,null,Object(c.createElement)(d.Stepper,{isVertical:!0,currentStep:"none",steps:[{key:"first",label:""},{key:"second",label:""}]})))};var be=o(515),he=o(116);const ge={account_name:"",account_number:"",bank_name:"",sort_code:"",iban:"",bic:""};Object(he.registerPlugin)("wc-admin-payment-gateway-setup-bacs",{render:()=>{const e=Object(i.useSelect)(e=>e(r.OPTIONS_STORE_NAME).isOptionsUpdating()),{createNotice:t}=Object(i.useDispatch)("core/notices"),{updateOptions:o}=Object(i.useDispatch)(r.OPTIONS_STORE_NAME),s=e=>{const t={};return e.account_number||e.iban||(t.account_number=t.iban=Object(n.__)("Please enter an account number or IBAN",'woocommerce')),t};return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(se.WooPaymentGatewaySetup,{id:"bacs"},({markConfigured:i})=>Object(c.createElement)(d.Form,{initialValues:ge,onSubmit:e=>(async(e,c)=>{if((await o({woocommerce_bacs_settings:{enabled:"yes"},woocommerce_bacs_accounts:[e]})).success)return c(),void t("success",Object(n.__)("Direct bank transfer details added successfully",'woocommerce'));t("error",Object(n.__)("There was a problem saving your payment settings",'woocommerce'))})(e,i),validate:s},({getInputProps:t,handleSubmit:o})=>Object(c.createElement)(c.Fragment,null,Object(c.createElement)(d.H,null,Object(n.__)("Add your bank details",'woocommerce')),Object(c.createElement)("p",null,Object(n.__)("These details are required to receive payments via bank transfer",'woocommerce')),Object(c.createElement)("div",{className:"woocommerce-task-payment-method__fields"},Object(c.createElement)(d.TextControl,D()({label:Object(n.__)("Account name",'woocommerce'),required:!0},t("account_name"))),Object(c.createElement)(d.TextControl,D()({label:Object(n.__)("Account number",'woocommerce'),required:!0},t("account_number"))),Object(c.createElement)(d.TextControl,D()({label:Object(n.__)("Bank name",'woocommerce'),required:!0},t("bank_name"))),Object(c.createElement)(d.TextControl,D()({label:Object(n.__)("Sort code",'woocommerce'),required:!0},t("sort_code"))),Object(c.createElement)(d.TextControl,D()({label:Object(n.__)("IBAN",'woocommerce'),required:!0},t("iban"))),Object(c.createElement)(d.TextControl,D()({label:Object(n.__)("BIC / Swift",'woocommerce'),required:!0},t("bic")))),Object(c.createElement)(a.Button,{isPrimary:!0,isBusy:e,onClick:o},Object(n.__)("Save",'woocommerce'))))))},scope:'woocommerce'});const Oe=({query:e})=>{const{invalidateResolutionForStoreSelector:t}=Object(i.useDispatch)(r.ONBOARDING_STORE_NAME),{updatePaymentGateway:o}=Object(i.useDispatch)(r.PAYMENT_GATEWAYS_STORE_NAME),{getPaymentGateway:a,paymentGateways:s,isResolving:m}=Object(i.useSelect)(e=>{const t=e(r.PAYMENT_GATEWAYS_STORE_NAME).getPaymentGateways().reduce((e,t)=>(e[t.id]=t,e),{}),o=e(r.ONBOARDING_STORE_NAME).getPaymentGatewaySuggestions().reduce((e,o)=>{const{id:c}=o,n=t[o.id]?t[c]:{},a={installed:!!t[c],postInstallScripts:n.post_install_scripts,enabled:n.enabled||!1,needsSetup:n.needs_setup,settingsUrl:n.settings_url,connectionUrl:n.connection_url,setupHelpText:n.setup_help_text,title:n.title,requiredSettings:n.required_settings_keys?n.required_settings_keys.map(e=>n.settings[e]).filter(Boolean):[],...o};return e.set(c,a),e},new Map);return{getPaymentGateway:e(r.PAYMENT_GATEWAYS_STORE_NAME).getPaymentGateway,getOption:e(r.OPTIONS_STORE_NAME).getOption,isResolving:e(r.ONBOARDING_STORE_NAME).isResolving("getPaymentGatewaySuggestions"),paymentGateways:o}}),d=Object(c.useCallback)(async(e,c={})=>{if(!s.get(e))throw`Payment gateway ${e} not found in available gateways list`;(e=>{if(!e)return;const c=a(e);c&&!c.enabled&&o(e,{enabled:!0}).then(()=>{t("getTasksStatus")})})(e),Object(l.recordEvent)("tasklist_payment_connect_method",{payment_method:e}),Object(k.getHistory)().push(Object(k.getNewPath)({...c},"/",{}))},[s]),p=Object(c.useCallback)(e=>{Object(l.recordEvent)("tasklist_payment_connect_start",{payment_method:e})},[]),u=Object(c.useMemo)(()=>Array.from(s.values()).filter(e=>e.recommendation_priority).sort((e,t)=>e.recommendation_priority-t.recommendation_priority).map(e=>e.id).shift(),[s]),_=Object(c.useMemo)(()=>{if(!e.id||m||!s.size)return null;const t=s.get(e.id);if(!t)throw`Current gateway ${e.id} not found in available gateways list`;return t},[m,e,s]),[b,h,g]=Object(c.useMemo)(()=>Array.from(s.values()).reduce((e,t)=>{const[o,c,n]=e;return"woocommerce_payments"!==t.id||t.installed&&!t.needsSetup?t.enabled?c.push(t):n.push(t):o.push(t),e},[[],[],[]]),[s]);return e.id&&!_?Object(c.createElement)(_e,null):_?Object(c.createElement)(ue,{paymentGateway:_,markConfigured:d,recordConnectStartEvent:p}):Object(c.createElement)("div",{className:"woocommerce-task-payments"},!s.size&&Object(c.createElement)(de,null),!!b.length&&Object(c.createElement)(be.a,{paymentGateway:b[0]}),!!h.length&&Object(c.createElement)(me,{heading:Object(n.__)("Enabled payment gateways",'woocommerce'),recommendation:u,paymentGateways:h}),!!g.length&&Object(c.createElement)(me,{heading:Object(n.__)("Additional payment gateways",'woocommerce'),recommendation:u,paymentGateways:g,markConfigured:d}))};var je=o(523),we=o(538);function ye(e,t,o,c){Object(l.recordEvent)("task_view",{task_name:e,wcs_installed:c.includes("woocommerce-services"),wcs_active:o.includes("woocommerce-services"),jetpack_installed:c.includes("jetpack"),jetpack_active:o.includes("jetpack"),jetpack_connected:t})}function ke(e,t){if(e.completed||t.completed)return e.completed?1:-1;const o=e.level||3,c=t.level||3;return o===c?0:o>c?1:-1}o(587);function Ee(e,t,o){return[...new Set([...e,...t])].filter(e=>!o.includes(e))}var Se=({query:e,name:t,eventName:o,isComplete:s,dismissedTasks:m,remindMeLaterTasks:p,tasks:u,trackedCompletedTasks:_,title:b,collapsible:h=!1,onComplete:g,onHide:O,expandingItems:j=!1})=>{var w;const{createNotice:y}=Object(i.useDispatch)("core/notices"),{updateOptions:E}=Object(i.useDispatch)(r.OPTIONS_STORE_NAME),{profileItems:S}=Object(i.useSelect)(e=>{const{getProfileItems:t}=e(r.ONBOARDING_STORE_NAME);return{profileItems:t()}}),v=Object(c.useRef)(e);Object(c.useEffect)(()=>{B()},[]),Object(c.useEffect)(()=>{const{task:t}=v.current,{task:o}=e;t!==o&&(window.document.documentElement.scrollTop=0,v.current=e),A(),I()},[e]);const f=Date.now(),C=u.filter(e=>e.visible&&!m.includes(e.key)&&(!p[e.key]||p[e.key]<f)),T=C.filter(e=>e.completed).map(e=>e.key),x=u.filter(e=>e.visible&&!e.completed&&!m.includes(e.key)),[N,P]=Object(c.useState)(null===(w=x[0])||void 0===w?void 0:w.key),A=()=>{const e=`woocommerce_${t}_complete`,o=s?{[e]:"no"}:{[e]:"yes"};(!x.length&&!s||x.length&&s)&&(E({...o}),"function"==typeof g&&g())},I=()=>{const e=function(e,t){if(!t)return[];return e.filter(e=>t.includes(e))}(T,_),t=(o=e,c=_,C.filter(e=>c.includes(e.key)&&!o.includes(e.key)).map(e=>e.key));var o,c;(function(e,t,o){if(t.length>0)return!0;if(0===o.length)return!1;return!o.every(t=>e.indexOf(t)>=0)})(e,t,T)&&E({woocommerce_task_list_tracked_completed_tasks:Ee(T,_,t)})},R=e=>{const t=m.filter(t=>t!==e);E({woocommerce_task_list_dismissed_tasks:t}),Object(l.recordEvent)(o+"_undo_dismiss_task",{task_name:e})},M=e=>{const{[e]:t,...c}=p;E({woocommerce_task_list_remind_me_later_tasks:c}),Object(l.recordEvent)(o+"_undo_remindmelater_task",{task_name:e})},B=()=>{e.task||Object(l.recordEvent)(o+"_view",{number_tasks:C.length,store_connected:S.wccom_connected})},G=C.map(e=>(e.onClick||(e.onClick=t=>{if(Object(l.recordEvent)(o+"_click",{task_name:e.key}),"A"===t.target.nodeName)return!1;Object(k.updateQueryString)({task:e.key})}),e));if(!G.length)return Object(c.createElement)("div",{className:"woocommerce-task-dashboard__container"});const L=Object(n.sprintf)(Object(n._n)("Show %i more task.","Show %i more tasks.",G.length-2,'woocommerce'),G.length-2),F=Object(n.__)("Show less",'woocommerce'),U=h?te.CollapsibleList:te.List,z=h?{collapseLabel:F,expandLabel:L,show:2,onCollapse:()=>Object(l.recordEvent)(o+"_collapse"),onExpand:()=>Object(l.recordEvent)(o+"_expand")}:{};return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"woocommerce-task-dashboard__container"},Object(c.createElement)(a.Card,{size:"large",className:"woocommerce-task-card woocommerce-homescreen-card"},Object(c.createElement)(a.CardHeader,{size:"medium"},Object(c.createElement)("div",{className:"wooocommerce-task-card__header"},Object(c.createElement)(te.Text,{size:"20",lineHeight:"28px",variant:"title.small"},b),Object(c.createElement)(d.Badge,{count:x.length})),Object(c.createElement)("div",{className:"woocommerce-card__menu woocommerce-card__header-item"},Object(c.createElement)(d.EllipsisMenu,{label:Object(n.__)("Task List Options",'woocommerce'),renderContent:()=>Object(c.createElement)("div",{className:"woocommerce-task-card__section-controls"},Object(c.createElement)(a.Button,{onClick:()=>(e=>{const c={[`woocommerce_${t}_hidden`]:"yes"};Object(l.recordEvent)(o+"_completed",{action:e,completed_task_count:T.length,incomplete_task_count:x.length}),E({...c}),"function"==typeof O&&O()})("remove_card")},Object(n.__)("Hide this",'woocommerce')))}))),Object(c.createElement)(U,D()({animation:"custom"},z),G.map(e=>Object(c.createElement)(te.TaskItem,{key:e.key,title:e.title,completed:e.completed,content:e.content,onClick:!j||e.completed?e.onClick:()=>P(e.key),expandable:j,expanded:j&&N===e.key,onDismiss:e.isDismissable?()=>(({key:e,onDismiss:t})=>{y("success",Object(n.__)("Task dismissed"),{actions:[{label:Object(n.__)("Undo",'woocommerce'),onClick:()=>R(e)}]}),Object(l.recordEvent)(o+"_dismiss_task",{task_name:e}),E({woocommerce_task_list_dismissed_tasks:[...m,e]}),t&&t()})(e):void 0,remindMeLater:e.allowRemindMeLater?()=>(({key:e,onDismiss:t})=>{y("success",Object(n.__)("Task postponed until tomorrow",'woocommerce'),{actions:[{label:Object(n.__)("Undo",'woocommerce'),onClick:()=>M(e)}]}),Object(l.recordEvent)(o+"_remindmelater_task",{task_name:e});const c=Date.now()+864e5;E({woocommerce_task_list_remind_me_later_tasks:{...p,[e]:c}}),t&&t()})(e):void 0,time:e.time,level:e.level,action:e.onClick,actionLabel:e.action,additionalInfo:e.additionalInfo}))))))},ve=o(252);const fe=({taskContainer:e,query:t})=>{const o=Object(c.useRef)(),{isJetpackConnected:n,activePlugins:a,installedPlugins:s}=Object(i.useSelect)(e=>{const{getActivePlugins:t,getInstalledPlugins:o,isJetpackConnected:c}=e(r.PLUGINS_STORE_NAME);return{activePlugins:t(),isJetpackConnected:c(),installedPlugins:o()}});return Object(c.useEffect)(()=>{const{task:e}=t;o.current!==e&&(window.document.documentElement.scrollTop=0),o.current=e,(()=>{const{task:e}=t;e&&ye(e,n,a,s)})()},[t]),e&&t.task?Object(c.createElement)("div",{className:"woocommerce-task-dashboard__container"},Object(c.cloneElement)(e,{query:t})):null};var Ce=o(535);const Te=e=>{const{getProfileItems:t,getTasksStatus:o}=e(r.ONBOARDING_STORE_NAME),{getSettings:c}=e(r.SETTINGS_STORE_NAME),{getOption:n}=e(r.OPTIONS_STORE_NAME),{getActivePlugins:a,getInstalledPlugins:s,isJetpackConnected:i}=e(r.PLUGINS_STORE_NAME),m=t(),l=n("woocommerce_task_list_tracked_completed_tasks")||[],{general:d={}}=c("general"),p=Object(h.b)(d.woocommerce_default_country),{woocommerce_store_address:u,woocommerce_default_country:_,woocommerce_store_postcode:b}=d,g=Boolean(u&&_&&b),O=a(),j=s(),w=o();return{activePlugins:O,countryCode:p,dismissedTasks:n("woocommerce_task_list_dismissed_tasks"),remindMeLaterTasks:n("woocommerce_task_list_remind_me_later_tasks"),isExtendedTaskListComplete:"yes"===n("woocommerce_extended_task_list_complete"),isExtendedTaskListHidden:"yes"===n("woocommerce_extended_task_list_hidden"),isJetpackConnected:i(),isSetupTaskListHidden:"yes"===n("woocommerce_task_list_hidden"),isTaskListComplete:"yes"===n("woocommerce_task_list_complete"),installedPlugins:j,onboardingStatus:w,profileItems:m,trackedCompletedTasks:l,hasCompleteAddress:g}};t.default=({userPreferences:e,query:t})=>{const{createNotice:o}=Object(i.useDispatch)("core/notices"),{updateOptions:p}=Object(i.useDispatch)(r.OPTIONS_STORE_NAME),{installAndActivatePlugins:u}=Object(i.useDispatch)(r.PLUGINS_STORE_NAME),{trackedCompletedTasks:_,activePlugins:b,countryCode:g,installedPlugins:O,isJetpackConnected:j,onboardingStatus:E,profileItems:S,isSetupTaskListHidden:v,dismissedTasks:C,remindMeLaterTasks:T,isTaskListComplete:x,isExtendedTaskListHidden:N,isExtendedTaskListComplete:P,hasCompleteAddress:A}=Object(i.useSelect)(Te),[I,R]=Object(c.useState)(!1),[M,B]=Object(m.useExperiment)("woocommerce_tasklist_progression");Object(c.useEffect)(()=>{document.body.classList.add("woocommerce-onboarding"),document.body.classList.add("woocommerce-task-dashboard__body")},[]);const G=()=>{I||Object(l.recordEvent)("tasklist_purchase_extensions"),R(!I)},F=e=>Object(c.createElement)(Se,{name:"extended_task_list",eventName:"extended_tasklist",collapsible:!0,dismissedTasks:C||[],remindMeLaterTasks:T||[],isComplete:P,query:t,tasks:e,title:Object(n.__)("Things to do next",'woocommerce'),trackedCompletedTasks:_||[]}),D=function({activePlugins:e,countryCode:t,createNotice:o,installAndActivatePlugins:a,installedPlugins:s,isJetpackConnected:i,onboardingStatus:r,profileItems:m,query:l,toggleCartModal:d,onTaskSelect:p,hasCompleteAddress:u}){const{hasPaymentGateway:_,hasPhysicalProducts:b,hasProducts:g,isAppearanceComplete:O,isTaxComplete:j,shippingZonesCount:w,wcPayIsConnected:E}={hasPaymentGateway:!1,hasPhysicalProducts:!1,hasProducts:!1,isAppearanceComplete:!1,isTaxComplete:!1,shippingZonesCount:0,wcPayIsConnected:!1,...r},S=Object(h.a)(m,s),{products:v,remainingProducts:C,uniqueItemsList:T}=S,x=-1!==s.indexOf("woocommerce-payments"),N=-1!==e.indexOf("woocommerce-services"),{completed:P,product_types:A,business_extensions:I}=m,R=(I||[]).includes("woocommerce-payments");let M,B=Object(n.__)("Add paid extensions to my store",'woocommerce');if(1===T.length){var G;const{name:e}=T[0],t=Object(n.__)("Add %s to my store",'woocommerce');B=Object(n.sprintf)(t,e),M=null===(G=v.find(({label:t})=>t===e))||void 0===G?void 0:G.description}else{const e=T.map(({name:e})=>e),t=e.pop();let o=e.join(", ");e.length>1&&(o+=","),M=Object(n.sprintf)(Object(n.__)("Good choice! You chose to add %1$s and %2$s to your store.",'woocommerce'),o,t)}const{automatedTaxSupportedCountries:F=[],taxJarActivated:D}=r,U=!D&&F.includes(t),z=u&&N&&U;let H=Object(n.__)("Let's go",'woocommerce'),q=Object(n.__)("Set your store location and configure tax rate settings.",'woocommerce');z&&(H=Object(n.__)("Yes please",'woocommerce'),q=Object(n.__)("Good news! WooCommerce Services and Jetpack can automate your sales tax calculations for you.",'woocommerce'));const V=[{key:"store_details",title:Object(n.__)("Store details",'woocommerce'),content:Object(n.__)("Your store address is required to set the origin country for shipping, currencies, and payment options.",'woocommerce'),container:null,action:Object(n.__)("Let's go",'woocommerce'),onClick:()=>{p("store_details"),Object(k.getHistory)().push(Object(k.getNewPath)({},"/setup-wizard",{}))},completed:P,visible:!0,time:Object(n.__)("4 minutes",'woocommerce'),type:"setup"},{key:"purchase",title:B,content:M,container:null,action:Object(n.__)("Purchase & install now",'woocommerce'),onClick:()=>(p("purchase"),C.length?d():null),visible:v.length,completed:v.length&&!C.length,time:Object(n.__)("2 minutes",'woocommerce'),isDismissable:!0,type:"setup"},{key:"products",title:Object(n.__)("Add my products",'woocommerce'),content:Object(n.__)("Start by adding the first product to your store. You can add your products manually, via CSV, or import them from another service.",'woocommerce'),container:Object(c.createElement)(L,null),onClick:()=>{p("products"),Object(k.updateQueryString)({task:"products"})},completed:g,visible:!0,time:Object(n.__)("1 minute per product",'woocommerce'),type:"setup"},{key:"woocommerce-payments",title:Object(n.__)("Get paid with WooCommerce Payments",'woocommerce'),content:Object(n.__)("You're only one step away from getting paid. Verify your business details to start managing transactions with WooCommerce Payments.",'woocommerce'),action:Object(n.__)("Finish setup","woocommmerce-admin"),expanded:!0,container:Object(c.createElement)(c.Fragment,null),completed:E,onClick:async t=>{if("A"===t.target.nodeName)return!1;await new Promise((t,c)=>(ye("wcpay",i,e,s),p("woocommerce-payments"),Object(be.b)(c,o,a)))},visible:R&&x&&Object(be.c)(t),additionalInfo:Object(n.__)('By setting up, you are agreeing to the <a href="https://wordpress.com/tos/" target="_blank">Terms of Service</a>','woocommerce'),time:Object(n.__)("2 minutes",'woocommerce'),type:"setup"},{key:"payments",title:Object(n.__)("Set up payments",'woocommerce'),content:Object(n.__)("Choose payment providers and enable payment methods at checkout.",'woocommerce'),container:Object(c.createElement)(Oe,{query:l}),completed:_,onClick:()=>{p("payments"),Object(k.updateQueryString)({task:"payments"})},visible:window.wcAdminFeatures["payment-gateway-suggestions"]&&(!x||!R||!Object(be.c)(t)),time:Object(n.__)("2 minutes",'woocommerce'),type:"setup"},{key:"tax",title:Object(n.__)("Set up tax",'woocommerce'),content:q,container:Object(c.createElement)(ce,null),action:H,onClick:(e,t={})=>{const{isExpanded:o}=t;p("tax"),Object(k.updateQueryString)({task:"tax",auto:z&&o})},completed:j,visible:!0,time:Object(n.__)("1 minute",'woocommerce'),type:"setup"},{key:"shipping",title:Object(n.__)("Set up shipping",'woocommerce'),content:Object(n.__)("Set your store location and where you'll ship to.",'woocommerce'),container:Object(c.createElement)(ee,null),action:Object(n.__)("Let's go",'woocommerce'),onClick:()=>{w>0?window.location=Object(we.b)({type:"wc-settings",tab:"shipping"}).href:(p("shipping"),Object(k.updateQueryString)({task:"shipping"}))},completed:w>0,visible:A&&A.includes("physical")||b,time:Object(n.__)("1 minute",'woocommerce'),type:"setup"},{key:"appearance",title:Object(n.__)("Personalize my store",'woocommerce'),content:Object(n.__)("Add your logo, create a homepage, and start designing your store.",'woocommerce'),container:Object(c.createElement)(f,null),action:Object(n.__)("Let's go",'woocommerce'),onClick:()=>{p("appearance"),Object(k.updateQueryString)({task:"appearance"})},completed:O,visible:!0,time:Object(n.__)("2 minutes",'woocommerce'),type:"setup"}],J=Object(y.applyFilters)("woocommerce_admin_onboarding_task_list",V,l);for(const e of J)e.level=e.level?parseInt(e.level,10):3;return Object(je.a)(J,"type","extension")}({activePlugins:b,countryCode:g,createNotice:o,installAndActivatePlugins:u,installedPlugins:O,isJetpackConnected:j,onboardingStatus:E,profileItems:S,query:t,toggleCartModal:G,onTaskSelect:t=>{const o=(t=>{const o=e.task_list_tracked_started_tasks;return o&&o[t]?o[t]:0})(t);Object(l.recordEvent)("tasklist_click",{task_name:t}),(e=>!!_&&_.includes(e))(t)||((t,o)=>{const c=e.task_list_tracked_started_tasks||{};e.updateUserPreferences({task_list_tracked_started_tasks:{...c||{},[t]:o}})})(t,o+1)},hasCompleteAddress:A}),{extension:U,setup:z}=D,{task:H}=t,q=Array.isArray(U)&&U.sort(ke),V=(e=>{const{task:o}=t,c=e.find(e=>e.key===o);return c||null})([...q||[],...z||[]]);if(H&&!V)return null;if(V)return Object(c.createElement)(fe,{taskContainer:V.container,query:t});const J="extended_task_list"===window.location.hash.substr(1);return Object(c.createElement)(c.Fragment,null,z&&(!v||H)&&(M?Object(c.createElement)(Ce.a,null):Object(c.createElement)(Se,{name:"task_list",eventName:"tasklist",expandingItems:"treatment"===(null==B?void 0:B.variationName),dismissedTasks:C||[],remindMeLaterTasks:T||[],isComplete:x,query:t,tasks:z,title:Object(n.__)("Get ready to start selling",'woocommerce'),trackedCompletedTasks:_||[],onComplete:()=>p({woocommerce_default_homepage_layout:"two_columns"}),onHide:()=>p({woocommerce_task_list_prompt_shown:!0,woocommerce_default_homepage_layout:"two_columns"})})),q&&Object(c.createElement)(ve.a,null,Object(c.createElement)(a.MenuGroup,{className:"woocommerce-layout__homescreen-display-options",label:Object(n.__)("Display",'woocommerce')},Object(c.createElement)(a.MenuItem,{className:"woocommerce-layout__homescreen-extension-tasklist-toggle",icon:!N&&s.a,isSelected:!N,role:"menuitemcheckbox",onClick:()=>{const e=!N;Object(l.recordEvent)(e?"extended_tasklist_hide":"extended_tasklist_show"),p({woocommerce_extended_task_list_hidden:e?"yes":"no"})}},Object(n.__)("Show things to do next",'woocommerce')))),q&&!N&&(J?Object(c.createElement)(d.ScrollTo,{offset:"-20"},F(q)):F(q)),I&&Object(c.createElement)(w,{onClose:()=>G(),onClickPurchaseLater:()=>G()}))}}}]);
Save