oont-contents/plugins/google-listings-and-ads/js/build/onboarding.js
2025-02-08 15:10:23 +01:00

1 line
No EOL
16 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(globalThis.webpackChunkgoogle_listings_and_ads=globalThis.webpackChunkgoogle_listings_and_ads||[]).push([[352],{550:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Ce});var a=n(1609),o=n(6474),s=n(7723),i=n(6476),l=n(7539),c=n(2455),r=n(6473);const g=()=>(0,a.createElement)(l.A,{title:(0,s.__)("Get started with Google for WooCommerce","google-listings-and-ads"),helpButton:(0,a.createElement)(c.A,{eventContext:"setup-mc"}),backHref:(0,i.getNewPath)({},"/google/start"),onBackButtonClick:()=>{(0,r.ce)("gla_setup_mc",{triggered_by:"back-button",action:"leave"})}});var d=n(3741),u=n(8846),m=n(6087),p=n(3658),h=n(7541),_=n(6520),f=n(8859),A=n(7240),y=n(6453);var C=n(5847),E=n(873),b=n(6523),S=n(5622),k=n(5455),w=n(5807),v=n(5640),G=n(7401),I=n(8e3),x=n(7916),P=n(7892),T=n(9370),N=n(3164),R=n(9826),F=n(3704),M=n(8242),q=n(1177),B=n(4790),D=n(1274),W=n(9452);const Y=[{trackId:"why-do-i-need-a-wp-account",question:(0,s.__)("Why do I need a WordPress.com account?","google-listings-and-ads"),answer:(0,s.__)("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,s.__)("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,s.__)("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,m.createInterpolateElement)((0,s.__)("If you create a new Merchant Center account through this application, it will be associated with Googles 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)(q.A,{context:"faqs",linkId:"find-a-partner",href:"https://comparisonshoppingpartners.withgoogle.com/find_a_partner/"})})))}],j=()=>(0,a.createElement)(W.A,{trackName:"gla_faq",context:"setup-mc-accounts",faqItems:Y});var O=n(1378),V=n(1351),H=n(1456);const L=()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,m.createInterpolateElement)((0,s.__)("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)(q.A,{context:"setup-mc-accounts",linkId:"comparison-shopping-services",href:"https://support.google.com/merchants/topic/9080307"})})),(0,a.createElement)("p",null,(0,m.createInterpolateElement)((0,s.__)("If you create a new Merchant Center account through this application, it will be associated with Google Shopping, Googles 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)(q.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,s.__)("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"))),U=e=>{const{onContinue:t=()=>{}}=e,{jetpack:n}=(0,G.A)(),{google:o,scope:i}=(0,I.A)(),{googleMCAccount:l,isPreconditionReady:c,isReady:r}=(0,x.A)(),{hasFinishedResolution:g}=(0,O.A)(),u=(0,H.A)(),h=(0,V.A)(),{updateGoogleMCContactInformation:_}=(0,p.j)(),[f,A]=(0,m.useState)(!1),y=!n,C="yes"===n?.active,E=C&&!o,b="yes"===o?.active&&i.gmcRequired&&!l;if(y||E||b)return(0,a.createElement)(d.A,null);const S=!(g&&h&&r&&u);return(0,a.createElement)(T.A,null,(0,a.createElement)(N.A,{title:(0,s.__)("Set up your accounts","google-listings-and-ads"),description:(0,s.__)("Connect the accounts required to use Google for WooCommerce.","google-listings-and-ads")}),(0,a.createElement)(M.A,{className:"gla-wp-google-accounts-section",title:(0,s.__)("Connect accounts","google-listings-and-ads"),description:(0,s.__)("The following accounts are required to use the Google for WooCommerce plugin.","google-listings-and-ads")},!C&&(0,a.createElement)(B.Ay,{jetpack:n}),(0,a.createElement)(D.A,{disabled:!C})),(0,a.createElement)(R.A,null,(0,a.createElement)(F.A,null,(0,a.createElement)(P.A,{isPrimary:!0,disabled:S,loading:f,text:(0,s.__)("Continue","google-listings-and-ads"),onClick:()=>{A(!0),_().then((()=>t())).catch((()=>A(!1)))}}))),(0,a.createElement)(M.A,{className:"gla-google-mc-disclaimer-section",description:(0,a.createElement)(L,null),disabledLeft:!c},(0,a.createElement)(j,null)))};var z=n(7343),J=n(8806);const K=()=>(0,a.createElement)("div",{className:"gla-setup-free-listing-hero"},(0,a.createElement)(N.A,{className:"hero-text",title:(0,s.__)("Configure your product listings","google-listings-and-ads"),description:(0,a.createElement)("div",null,(0,a.createElement)("p",{className:"hero-text__subtitle"},(0,s.__)("Your product listings will look something like this.","google-listings-and-ads")),(0,a.createElement)("p",{className:"hero-text__body"},(0,s.__)("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:J,alt:(0,s.__)("Google Shopping search results example","google-listings-and-ads")}));function Q(e){return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(K,null),(0,a.createElement)(T.A,null,(0,a.createElement)(z.A,{...e}),(0,a.createElement)(R.A,null,(0,a.createElement)(F.A,null,(0,a.createElement)(z.A.SubmitButton,null)))))}var X=n(8468),$=n(1968),Z=n(8519),ee=n(1203),te=n(8473),ne=n(6893),ae=n(3666),oe=n(8998),se=n(3905);const ie="complete-ads",le="skip-ads";var ce=n(9457);const re=({onRequestClose:e,onSkipCreatePaidAds:t})=>(0,a.createElement)(ce.A,{title:(0,s.__)("Skip setting up ads?","google-listings-and-ads"),buttons:[(0,a.createElement)(P.A,{key:"cancel",isSecondary:!0,onClick:e},(0,s.__)("Cancel","google-listings-and-ads")),(0,a.createElement)(P.A,{key:"complete-setup",onClick:t,isPrimary:!0},(0,s.__)("Complete setup without setting up ads","google-listings-and-ads"))],onRequestClose:e},(0,a.createElement)("p",null,(0,s.__)("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,s.__)("Performance Max uses the best of Googles 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)(q.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,s.__)("Learn more about Performance Max.","google-listings-and-ads"))));function ge({isValidForm:e,onSkipCreatePaidAds:t=X.noop,loading:n,disabled:o}){const[i,l]=(0,m.useState)(!1),{googleAdsAccount:c}=(0,O.A)(),{billingStatus:g}=(0,ne.A)();return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(P.A,{isTertiary:!0,text:(0,s.__)("Skip ads creation","google-listings-and-ads"),loading:n,disabled:o,onClick:()=>{l(!0)}}),i&&(0,a.createElement)(re,{onRequestClose:()=>{l(!1)},onSkipCreatePaidAds:()=>{l(!1);const n={google_ads_account_status:c?.status,billing_method_status:g?.status||"unknown",campaign_form_validation:e?"valid":"invalid"};(0,r.ce)("gla_onboarding_complete_button_click",n),t()}}))}const de="gla-onboarding-paid-ads",{sessionStorage:ue}=window,me={setCampaign({amount:e}){const t=JSON.stringify({amount:e});ue.setItem(de,t)},getCampaign(){const e=ue.getItem(de);return null===e?null:JSON.parse(e)}};var pe=n(4679);function he(){const e=(0,$.A)(),[t,n]=(0,m.useState)(null),{data:o}=(0,C.A)(),{highestDailyBudget:i,hasFinishedResolution:l}=(0,pe.A)(o),[c]=(0,Z.A)(),{billingStatus:r}=(0,ne.A)(),{syncSettings:g}=(0,p.j)(),u=r?.status===se.CX.APPROVED,h=async(t=X.noop)=>{try{await g(),await t()}catch(e){return n(null),void(0,oe.h)(e,(0,s.__)("Unable to complete your setup.","google-listings-and-ads"))}const a={guide:se.K4.SUBMISSION_SUCCESS};window.location.href=e+(0,ae.hP)(a)},_=async()=>{n(le),await h()},f={amount:i,...me.getCampaign()};return l&&o?(0,a.createElement)(te.A,{initialCampaign:f,recommendedDailyBudget:i,onChange:(e,t)=>{t.amount>=i&&me.setCampaign(t)}},(0,a.createElement)(ee.A,{headerTitle:(0,s.__)("Create a campaign to advertise your products","google-listings-and-ads"),continueButton:e=>{const{isValidForm:i,values:l}=e,{amount:r}=l,g=t===le||!i||!u;return(0,a.createElement)(P.A,{isPrimary:!0,disabled:g,onClick:async()=>{n(ie);const e=c.bind(null,r,o);await h(e)},loading:t===ie,text:(0,s.__)("Complete setup","google-listings-and-ads"),eventName:"gla_onboarding_complete_with_paid_ads_button_click",eventProps:{budget:r,audiences:o?.join(",")}})},skipButton:e=>{const{isValidForm:n}=e;return(0,a.createElement)(ge,{isValidForm:n,onSkipCreatePaidAds:_,disabled:t===ie,loading:t===le})},context:"setup-mc"})):(0,a.createElement)(d.A,null)}const _e={accounts:"1",product_listings:"2",paid_ads:"3"},fe=({savedStep:e})=>{const[t,n]=(0,m.useState)(e),{settings:o,saveSettings:i}=(0,E.A)(),{data:l}=(()=>{const{hasFinishedResolution:e}=(0,A.A)(),{hasFinishedResolution:t,data:n}=(0,f.A)(),{loading:a,data:o}=(0,y.A)({path:`${_.RV}/mc/target_audience/suggestions`});return{loading:!e||!t||a,data:t&&null===n?.location&&null===n?.countries?o:n}})(),{targetAudience:c,getFinalCountries:g}=(0,C.A)(),{hasFinishedResolution:d,data:G}=(0,b.A)(),{hasFinishedResolution:I,data:x}=(0,S.A)(),{saveTargetAudience:P}=(0,p.j)(),{saveShippingRates:T}=(0,k.A)(),{saveShippingTimes:N}=(0,w.A)(),{createNotice:R}=(0,v.A)();(0,h.A)(r.T1,{context:r.GH,step:t}),(0,m.useEffect)((()=>{null===c?.location&&l?.location&&P(l)}),[c,l,P]),(0,m.useEffect)((()=>{null===o?.shipping_rate&&i({...o,shipping_rate:"flat",shipping_time:"flat"})}),[o,i]);const F=e=>{const a=t;(0,r.dQ)("gla_setup_mc",a,e),n(e)},M=e=>{Number(e)<Number(t)&&((0,r.T)("gla_setup_mc",e),n(e))};function q(e,t){this(t).catch((()=>R("error",e)))}const B=d?G:null,D=I?x:null,W=c?.location?c:null,Y=o?.shipping_rate?o:null;return(0,a.createElement)(u.Stepper,{className:"gla-setup-stepper",currentStep:t,steps:[{key:_e.accounts,label:(0,s.__)("Set up your accounts","google-listings-and-ads"),content:(0,a.createElement)(U,{onContinue:()=>{F(_e.product_listings)}}),onClick:M},{key:_e.product_listings,label:(0,s.__)("Configure product listings","google-listings-and-ads"),content:(0,a.createElement)(Q,{targetAudience:W,settings:Y,shippingRates:B,shippingTimes:D,resolveFinalCountries:g,onTargetAudienceChange:q.bind(P,(0,s.__)("There was an error saving audience.","google-listings-and-ads")),onSettingsChange:q.bind(i,(0,s.__)("There was an error saving settings.","google-listings-and-ads")),onShippingRatesChange:q.bind(T,(0,s.__)("There was an error saving shipping rates.","google-listings-and-ads")),onShippingTimesChange:q.bind(N,(0,s.__)("There was an error saving shipping times.","google-listings-and-ads")),onContinue:()=>{F(_e.paid_ads)},submitLabel:(0,s.__)("Continue","google-listings-and-ads")}),onClick:M},{key:_e.paid_ads,label:(0,s.__)("Create a campaign","google-listings-and-ads"),content:(0,a.createElement)(he,null),onClick:M}]})};var Ae=n(3027);const ye=()=>{const{hasFinishedResolution:e,data:t}=(0,Ae.A)();if(!e&&!t)return(0,a.createElement)(d.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)(fe,{savedStep:_e[o]})},Ce=()=>((0,o.A)("full-page"),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(g,null),(0,a.createElement)(ye,null)))},4876:(e,t,n)=>{n.d(t,{NS:()=>u,RO:()=>d,Me:()=>m,Ay:()=>_});var a=n(1609),o=n(7723),s=n(6427),i=n(6087),l=n(9457),c=n(7892),r=n(7792),g=n(3658);const d="all-accounts",u="ads-account",m="api-data-fetch-feature",p={[d]:{title:(0,o.__)("Disconnect all accounts","google-listings-and-ads"),confirmButton:(0,o.__)("Disconnect all accounts","google-listings-and-ads"),confirmation:(0,o.__)("Yes, I want to disconnect all my accounts.","google-listings-and-ads"),contents:[(0,o.__)("I understand that I am disconnecting any WordPress.com account, Google account, Google Merchant Center account and Google Ads account connected to this extension.","google-listings-and-ads"),(0,o.__)("Any active product listings will continue to show on Google. They can be managed, edited, or deleted manually from Google Merchant Center (merchants.google.com).","google-listings-and-ads"),(0,o.__)("Any ongoing campaigns will continue to run. They can be managed, edited, or deleted manually from Google Ads (ads.google.com).","google-listings-and-ads")]},[u]:{title:(0,o.__)("Disconnect Google Ads account","google-listings-and-ads"),confirmButton:(0,o.__)("Disconnect Google Ads Account","google-listings-and-ads"),confirmation:(0,o.__)("Yes, I want to disconnect my Google Ads account.","google-listings-and-ads"),contents:[(0,o.__)("I understand that I am disconnecting my Google Ads account from this WooCommerce extension.","google-listings-and-ads"),(0,o.__)("Any ongoing campaigns will continue to run. They can be managed, edited, or deleted manually from Google Ads (ads.google.com).","google-listings-and-ads"),(0,o.__)("Some configurations for Google Ads created through WooCommerce may be lost. This cannot be undone.","google-listings-and-ads")]},[m]:{title:(0,o.__)("Disable data fetching","google-listings-and-ads"),confirmButton:(0,o.__)("Disable data fetching","google-listings-and-ads"),confirmation:(0,o.__)("Yes, I want to disable the data fetching feature.","google-listings-and-ads"),contents:[(0,o.__)("I understand that I am disabling the data fetching feature from this WooCommerce extension.","google-listings-and-ads"),(0,o.__)("Any ongoing campaigns and configuration will continue to run. They will be pushed to Google as in the previous versions of this extension.","google-listings-and-ads")]}};function h({disconnectTarget:e,onRequestClose:t,onDisconnected:n,disconnectAction:u}){const[m,h]=(0,i.useState)(!1),[_,f]=(0,i.useState)(!1),A=(0,g.j)(),{title:y,confirmButton:C,confirmation:E,contents:b}=p[e],S=()=>{_||t()};return(0,a.createElement)(l.A,{className:"gla-disconnect-accounts-modal",title:(0,a.createElement)(a.Fragment,null,(0,a.createElement)(r.A,{size:20}),y),isDismissible:!_,buttons:[(0,a.createElement)(c.A,{key:"1",isSecondary:!0,disabled:_,onClick:S},(0,o.__)("Never mind","google-listings-and-ads")),(0,a.createElement)(c.A,{key:"2",isPrimary:!0,isDestructive:!0,loading:_,disabled:!m,onClick:()=>{let a=e===d?A.disconnectAllAccounts:A.disconnectGoogleAdsAccount;u&&(a=u),f(!0),a().then((()=>{n(),t()})).catch((()=>{f(!1)}))}},C)],onRequestClose:S},b.map(((e,t)=>(0,a.createElement)("p",{key:t},e))),(0,a.createElement)(s.CheckboxControl,{label:E,checked:m,disabled:_,onChange:h}))}function _(e){return(0,a.createElement)(h,{...e})}}}]);