OwlCyberSecurity - MANAGER
Edit File: onboarding.js
"use strict";(globalThis.webpackChunkgoogle_listings_and_ads=globalThis.webpackChunkgoogle_listings_and_ads||[]).push([[352],{8321:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ye});var a=n(1609),o=n(8846),s=n(6474),i=n(6476),l=n(6087),r=n(3658),c=n(7401),g=n(8e3),d=n(7916),u=n(6473),p=n(1016),m=n(7723),h=n(7539),_=n(2455);const A=()=>(0,a.createElement)(h.A,{title:(0,m.__)("Get started with Google for WooCommerce","google-listings-and-ads"),helpButton:(0,a.createElement)(_.A,{eventContext:"setup-mc"}),backHref:(0,i.getNewPath)({},"/google/start"),onBackButtonClick:()=>{(0,u.ce)("gla_setup_mc",{triggered_by:"back-button",action:"leave"})}});var C=n(3741),f=n(7541),E=n(6520),y=n(8859),b=n(7240),S=n(6453);var k=n(5847),w=n(873),v=n(6523),G=n(5622),P=n(5455),I=n(5807),R=n(5640),x=n(7892),T=n(9370),F=n(3164),N=n(9826),M=n(3704),q=n(8242),W=n(1177),B=n(4790),j=n(1274),H=n(9452);const V=[{trackId:"why-do-i-need-a-wp-account",question:(0,m.__)("Why do I need a WordPress.com account?","google-listings-and-ads"),answer:(0,m.__)("We use a WordPress.com account to connect your site to the WooCommerce and Google servers. It ensures that requests (e.g. product feed, clicks, sales, etc) from your site are securely and correctly attributed to your store. It enables a connection to your self-hosted site, and provides a common authentication interface across disparate server configurations and architectures.","google-listings-and-ads")},{trackId:"why-do-i-need-a-google-mc-account",question:(0,m.__)("Why do I need a Google Merchant Center account?","google-listings-and-ads"),answer:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,m.__)("Google Merchant Center helps you sync your store and product data with Google and makes the information available for both free listings on the Shopping tab and Google Shopping Ads. That means everything about your stores and products is available to shoppers when they search on a Google property.","google-listings-and-ads")),(0,a.createElement)("p",null,(0,l.createInterpolateElement)((0,m.__)("If you create a new Merchant Center account through this application, it will be associated with Google’s Comparison Shopping Service (Google Shopping) by default. You can change the CSS associated with your account at any time. <link>Please find more information here</link>.","google-listings-and-ads"),{link:(0,a.createElement)(W.A,{context:"faqs",linkId:"find-a-partner",href:"https://comparisonshoppingpartners.withgoogle.com/find_a_partner/"})})))}],L=()=>(0,a.createElement)(H.A,{trackName:"gla_faq",context:"setup-mc-accounts",faqItems:V});var O=n(1378),Y=n(1351),D=n(1456);const U=()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,l.createInterpolateElement)((0,m.__)("If you are in the European Economic Area or Switzerland, your Merchant Center account must be associated with a Comparison Shopping Service (CSS). Please find more information at <link>Google Merchant Center Help</link> website.","google-listings-and-ads"),{link:(0,a.createElement)(W.A,{context:"setup-mc-accounts",linkId:"comparison-shopping-services",href:"https://support.google.com/merchants/topic/9080307"})})),(0,a.createElement)("p",null,(0,l.createInterpolateElement)((0,m.__)("If you create a new Merchant Center account through this application, it will be associated with Google Shopping, Google’s CSS, by default. You can change the CSS associated with your account at any time. Please find more information about our CSS Partners <link>here</link>.","google-listings-and-ads"),{link:(0,a.createElement)(W.A,{context:"setup-mc-accounts",linkId:"comparison-shopping-partners-find-a-partner",href:"https://comparisonshoppingpartners.withgoogle.com/find_a_partner/"})})),(0,a.createElement)("p",null,(0,m.__)("Once you have set up your Merchant Center account you can use our onboarding tool regardless of which CSS you use.","google-listings-and-ads"))),z=e=>{const{onContinue:t=()=>{}}=e,{jetpack:n}=(0,c.A)(),{google:o,scope:s}=(0,g.A)(),{googleMCAccount:i,isPreconditionReady:u,isLinkedToAds:p,isReady:h,isWPComAppGranted:_}=(0,d.A)(),{hasFinishedResolution:A}=(0,O.A)(),f=(0,D.A)(),{isGoogleAdsReady:E,isLinkedToMerchantCenter:y}=(0,Y.A)(),{updateGoogleMCContactInformation:b}=(0,r.j)(),[S,k]=(0,l.useState)(!1),w=!n,v="yes"===n?.active,G=v&&!o,P="yes"===o?.active&&s.gmcRequired&&!i;if(w||G||P)return(0,a.createElement)(C.A,null);const I=!(A&&(y||p)&&E&&h&&_&&f);return(0,a.createElement)(T.A,null,(0,a.createElement)(F.A,{title:(0,m.__)("Set up your accounts","google-listings-and-ads"),description:(0,m.__)("Connect the accounts required to use Google for WooCommerce.","google-listings-and-ads")}),(0,a.createElement)(q.A,{className:"gla-wp-google-accounts-section",title:(0,m.__)("Connect accounts","google-listings-and-ads"),description:(0,m.__)("The following accounts are required to use the Google for WooCommerce plugin.","google-listings-and-ads")},!v&&(0,a.createElement)(B.Ay,{jetpack:n}),(0,a.createElement)(j.A,{disabled:!v})),(0,a.createElement)(N.A,null,(0,a.createElement)(M.A,null,(0,a.createElement)(x.A,{isPrimary:!0,disabled:I,loading:S,text:(0,m.__)("Continue","google-listings-and-ads"),onClick:()=>{k(!0),b().then((()=>t())).catch((()=>k(!1)))}}))),(0,a.createElement)(q.A,{className:"gla-google-mc-disclaimer-section",description:(0,a.createElement)(U,null),disabledLeft:!u},(0,a.createElement)(L,null)))};var J=n(7343),Q=n(8806);const K=()=>(0,a.createElement)("div",{className:"gla-setup-free-listing-hero"},(0,a.createElement)(F.A,{className:"hero-text",title:(0,m.__)("Configure your product listings","google-listings-and-ads"),description:(0,a.createElement)("div",null,(0,a.createElement)("p",{className:"hero-text__subtitle"},(0,m.__)("Your product listings will look something like this.","google-listings-and-ads")),(0,a.createElement)("p",{className:"hero-text__body"},(0,m.__)("Your product details, estimated shipping info and tax details will be displayed across Google.","google-listings-and-ads")))}),(0,a.createElement)("img",{className:"gla-setup-free-listing-hero__image",src:Q,alt:(0,m.__)("Google Shopping search results example","google-listings-and-ads")}));function X(e){return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(K,null),(0,a.createElement)(T.A,null,(0,a.createElement)(J.A,{...e}),(0,a.createElement)(N.A,null,(0,a.createElement)(M.A,null,(0,a.createElement)(J.A.SubmitButton,null)))))}var $=n(8468),Z=n(1968),ee=n(8519),te=n(1203),ne=n(8473),ae=n(6893),oe=n(3666),se=n(8998),ie=n(3905);const le="complete-ads",re="skip-ads";var ce=n(9457);const ge=({onRequestClose:e,onSkipCreatePaidAds:t})=>(0,a.createElement)(ce.A,{title:(0,m.__)("Skip setting up ads?","google-listings-and-ads"),buttons:[(0,a.createElement)(x.A,{key:"cancel",isSecondary:!0,onClick:e},(0,m.__)("Cancel","google-listings-and-ads")),(0,a.createElement)(x.A,{key:"complete-setup",onClick:t,isPrimary:!0},(0,m.__)("Complete setup without setting up ads","google-listings-and-ads"))],onRequestClose:e},(0,a.createElement)("p",null,(0,m.__)("Enabling Performance Max is highly recommended to drive more sales and reach new audiences across Google channels like Search, YouTube and Discover.","google-listings-and-ads")),(0,a.createElement)("p",null,(0,m.__)("Performance Max uses the best of Google’s AI to show the most impactful ads for your products at the right time and place. Google will use your product data to create ads for this campaign.","google-listings-and-ads")),(0,a.createElement)("p",null,(0,a.createElement)(W.A,{href:"https://support.google.com/google-ads/answer/10724817",context:"skip-paid-ads-modal",linkId:"paid-ads-with-performance-max-campaigns-learn-more"},(0,m.__)("Learn more about Performance Max.","google-listings-and-ads"))));function de({isValidForm:e,onSkipCreatePaidAds:t=$.noop,loading:n,disabled:o}){const[s,i]=(0,l.useState)(!1),{googleAdsAccount:r}=(0,O.A)(),{billingStatus:c}=(0,ae.A)();return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(x.A,{isTertiary:!0,text:(0,m.__)("Skip ads creation","google-listings-and-ads"),loading:n,disabled:o,onClick:()=>{i(!0)}}),s&&(0,a.createElement)(ge,{onRequestClose:()=>{i(!1)},onSkipCreatePaidAds:()=>{i(!1);const n={google_ads_account_status:r?.status,billing_method_status:c?.status||"unknown",campaign_form_validation:e?"valid":"invalid"};(0,u.ce)("gla_onboarding_complete_button_click",n),t()}}))}const ue="gla-onboarding-paid-ads",{sessionStorage:pe}=window,me={setCampaign({amount:e}){const t=JSON.stringify({amount:e});pe.setItem(ue,t)},getCampaign(){const e=pe.getItem(ue);return null===e?null:JSON.parse(e)}};var he=n(4679);function _e(){const e=(0,Z.A)(),[t,n]=(0,l.useState)(null),{data:o}=(0,k.A)(),{highestDailyBudget:s,hasFinishedResolution:i}=(0,he.A)(o),[c]=(0,ee.A)(),{billingStatus:g}=(0,ae.A)(),{syncSettings:d}=(0,r.j)(),u=g?.status===ie.CX.APPROVED,p=async(t=$.noop)=>{try{await d(),await t()}catch(e){return n(null),void(0,se.h)(e,(0,m.__)("Unable to complete your setup.","google-listings-and-ads"))}const a={guide:ie.K4.SUBMISSION_SUCCESS};window.location.href=e+(0,oe.hP)(a)},h=async()=>{n(re),await p()},_={amount:s,...me.getCampaign()};return i&&o?(0,a.createElement)(ne.A,{initialCampaign:_,recommendedDailyBudget:s,onChange:(e,t)=>{t.amount>=s&&me.setCampaign(t)}},(0,a.createElement)(te.A,{headerTitle:(0,m.__)("Create a campaign to advertise your products","google-listings-and-ads"),continueButton:e=>{const{isValidForm:s,values:i}=e,{amount:l}=i,r=t===re||!s||!u;return(0,a.createElement)(x.A,{isPrimary:!0,disabled:r,onClick:async()=>{n(le);const e=c.bind(null,l,o);await p(e)},loading:t===le,text:(0,m.__)("Complete setup","google-listings-and-ads"),eventName:"gla_onboarding_complete_with_paid_ads_button_click",eventProps:{budget:l,audiences:o?.join(",")}})},skipButton:e=>{const{isValidForm:n}=e;return(0,a.createElement)(de,{isValidForm:n,onSkipCreatePaidAds:h,disabled:t===le,loading:t===re})},context:"setup-mc"})):(0,a.createElement)(C.A,null)}const Ae={accounts:"1",product_listings:"2",paid_ads:"3"},Ce=({savedStep:e})=>{const[t,n]=(0,l.useState)(e),{settings:s,saveSettings:i}=(0,w.A)(),{data:c}=(()=>{const{hasFinishedResolution:e}=(0,b.A)(),{hasFinishedResolution:t,data:n}=(0,y.A)(),{loading:a,data:o}=(0,S.A)({path:`${E.RV}/mc/target_audience/suggestions`});return{loading:!e||!t||a,data:t&&null===n?.location&&null===n?.countries?o:n}})(),{targetAudience:g,getFinalCountries:d}=(0,k.A)(),{hasFinishedResolution:p,data:h}=(0,v.A)(),{hasFinishedResolution:_,data:A}=(0,G.A)(),{saveTargetAudience:C}=(0,r.j)(),{saveShippingRates:x}=(0,P.A)(),{saveShippingTimes:T}=(0,I.A)(),{createNotice:F}=(0,R.A)();(0,f.A)(u.T1,{context:u.GH,step:t}),(0,l.useEffect)((()=>{null===g?.location&&c?.location&&C(c)}),[g,c,C]),(0,l.useEffect)((()=>{null===s?.shipping_rate&&i({...s,shipping_rate:"flat",shipping_time:"flat"})}),[s,i]);const N=e=>{const a=t;(0,u.dQ)("gla_setup_mc",a,e),n(e)},M=e=>{Number(e)<Number(t)&&((0,u.T)("gla_setup_mc",e),n(e))};function q(e,t){this(t).catch((()=>F("error",e)))}const W=p?h:null,B=_?A:null,j=g?.location?g:null,H=s?.shipping_rate?s:null;return(0,a.createElement)(o.Stepper,{className:"gla-setup-stepper",currentStep:t,steps:[{key:Ae.accounts,label:(0,m.__)("Set up your accounts","google-listings-and-ads"),content:(0,a.createElement)(z,{onContinue:()=>{N(Ae.product_listings)}}),onClick:M},{key:Ae.product_listings,label:(0,m.__)("Configure product listings","google-listings-and-ads"),content:(0,a.createElement)(X,{targetAudience:j,settings:H,shippingRates:W,shippingTimes:B,resolveFinalCountries:d,onTargetAudienceChange:q.bind(C,(0,m.__)("There was an error saving audience.","google-listings-and-ads")),onSettingsChange:q.bind(i,(0,m.__)("There was an error saving settings.","google-listings-and-ads")),onShippingRatesChange:q.bind(x,(0,m.__)("There was an error saving shipping rates.","google-listings-and-ads")),onShippingTimesChange:q.bind(T,(0,m.__)("There was an error saving shipping times.","google-listings-and-ads")),onContinue:()=>{N(Ae.paid_ads)},submitLabel:(0,m.__)("Continue","google-listings-and-ads")}),onClick:M},{key:Ae.paid_ads,label:(0,m.__)("Create a campaign","google-listings-and-ads"),content:(0,a.createElement)(_e,null),onClick:M}]})};var fe=n(3027);const Ee=()=>{const{hasFinishedResolution:e,data:t}=(0,fe.A)();if(!e&&!t)return(0,a.createElement)(C.A,null);if(e&&!t)return null;const{status:n,step:o}=t;return"complete"===n?((0,i.getHistory)().replace((0,i.getNewPath)({},"/google/dashboard")),null):(0,a.createElement)(Ce,{savedStep:Ae[o]})},ye=()=>((0,s.A)("full-page"),(0,p.A)(u.GH),function(e){const{jetpack:t}=(0,c.A)(),{google:n,scope:a}=(0,g.A)(),{googleMCAccount:o,isWPComAppGranted:s}=(0,d.A)(),{fetchWPComAppAuthorizationUrl:p}=(0,r.j)(),m=(0,l.useRef)(null),[,h]=(0,l.useReducer)((e=>e+1),0);if("connected"!==(0,i.getQuery)()["google-mc"])return!0;const _=!t,A="yes"===t?.active&&!n,C="yes"===n?.active&&a.gmcRequired&&!o;return _||A||C?null:(a.onboardingRequired&&!s?null===m.current&&(m.current=!1,(0,u.ce)("gla_enable_product_sync",{page:e,context:"auto-redirection"}),p().then((e=>{window.location.href=e})).catch((()=>{m.current=!0,h()}))):m.current=!0,m.current)}(u.GH)?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(A,null),(0,a.createElement)(Ee,null)):(0,a.createElement)(o.Spinner,null))}}]);