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

1 line
No EOL
4 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

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([[663],{923:(e,t,n)=>{n.r(t),n.d(t,{default:()=>M});var a=n(1609),o=n(6474),l=n(6476),s=n(7723),i=n(7539),c=n(2455),u=n(6473);const g=()=>(0,a.createElement)(i.A,{title:(0,s.__)("Set up your campaign","google-listings-and-ads"),helpButton:(0,a.createElement)(c.A,{eventContext:"setup-ads"}),backHref:(0,l.getNewPath)({},"/google/dashboard"),onBackButtonClick:()=>{(0,u.ce)("gla_setup_ads",{triggered_by:"back-button",action:"leave"})}});var r=n(8846),d=n(6087),m=n(7892),p=n(9370),_=n(3164),A=n(3704),h=n(9826),E=n(8678),y=n(458),b=n(6141),C=n(1378),k=n(8e3),f=n(3741),S=n(8242),v=n(1351);const w=e=>{const{onContinue:t=()=>{}}=e,{google:n}=(0,k.A)(),{googleAdsAccount:o}=(0,C.A)(),l=(0,v.A)();if(!n||"yes"===n.active&&!o)return(0,a.createElement)(f.A,null);const i=!l;return(0,a.createElement)(p.A,null,(0,a.createElement)(_.A,{title:(0,s.__)("Set up your accounts","google-listings-and-ads"),description:(0,s.__)("Connect your Google account and your Google Ads account to set up a Performance Max campaign.","google-listings-and-ads")}),(0,a.createElement)(S.A,{title:(0,s.__)("Connect accounts","google-listings-and-ads"),description:(0,s.__)("Any campaigns created through this app will appear in your Google Ads account. You will be billed directly through Google.","google-listings-and-ads")},(0,a.createElement)(E.Az,{googleAccount:n,hideAccountSwitch:!0,helper:(0,s.__)("This Google account is connected to your stores product feed.","google-listings-and-ads")}),(0,a.createElement)(y.Ay,null),(0,a.createElement)(b.A,null)),(0,a.createElement)(h.A,null,(0,a.createElement)(A.A,null,(0,a.createElement)(m.A,{isPrimary:!0,disabled:i,onClick:t},(0,s.__)("Continue","google-listings-and-ads")))))};var P=n(7541),B=n(5992),G=n(8468),T=n(1203),x=n(6893),F=n(1968),R=n(1650),D=n(5847),N=n(8519),V=n(8473),Y=n(4679),j=n(3905);const{APPROVED:q}=j.CX,z=()=>{const{billingStatus:e}=(0,x.A)(),[t,n]=(0,d.useState)(!1),[o,i]=(0,d.useState)(!1),[c,g]=(0,N.A)(),r=(0,F.A)(),{data:p}=(0,D.A)(),{highestDailyBudget:_,hasFinishedResolution:A}=(0,Y.A)(p),h={amount:_};(0,d.useEffect)((()=>{if(o){const e=(0,l.getNewPath)({guide:"campaign-creation-success"},"/google/dashboard");window.location.href=r+e}}),[o,r]);const E=t&&!o;return(0,R.A)((0,s.__)("You have unsaved campaign data. Are you sure you want to leave?","google-listings-and-ads"),E),p&&A?(0,a.createElement)(V.A,{initialCampaign:h,onChange:(e,t)=>{n(!(0,G.isEqual)(h,t))},onSubmit:e=>{const{amount:t}=e;(0,u.ce)("gla_launch_paid_campaign_button_click",{audiences:p.join(","),budget:t}),c(t,p,(()=>{i(!0)}))},recommendedDailyBudget:_},(0,a.createElement)(T.A,{headerTitle:(0,s.__)("Create your campaign","google-listings-and-ads"),context:"setup-ads",continueButton:t=>(0,a.createElement)(m.A,{isPrimary:!0,text:(0,s.__)("Create campaign","google-listings-and-ads"),disabled:!t.isValidForm||e?.status!==q,loading:g,onClick:t.handleSubmit})})):(0,a.createElement)(f.A,null)},H=()=>{const[e,t]=(0,d.useState)("1"),n=(0,d.useRef)(null),{hasFinishedResolution:o,hasGoogleAdsConnection:l}=(0,C.A)(),{hasAccess:i,hasFinishedResolution:c,step:g}=(0,B.A)();if((0,P.A)(u.T1,{context:u.lr,step:e}),null===n.current){if(!o||!c)return(0,a.createElement)(f.A,null);const e=l&&!0===i&&"conversion_action"!==g;n.current=e}const m=n=>{n<e&&((0,u.T)("gla_setup_ads",n),t(n))};let p=[{key:"1",label:(0,s.__)("Set up your accounts","google-listings-and-ads"),content:(0,a.createElement)(w,{onContinue:()=>{(()=>{const n=e;(0,u.dQ)("gla_setup_ads",n,"2"),t("2")})()}}),onClick:m},{key:"2",label:(0,s.__)("Create your campaign","google-listings-and-ads"),content:(0,a.createElement)(z,null),onClick:m}];return n.current&&(p.shift(),p=p.map(((e,t)=>({...e,key:(t+1).toString()})))),(0,a.createElement)(r.Stepper,{className:"gla-setup-stepper",currentStep:e,steps:p})},M=()=>((0,o.A)("full-page"),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(g,null),(0,a.createElement)(H,null)))}}]);