"use strict";(globalThis.webpackChunkgoogle_listings_and_ads=globalThis.webpackChunkgoogle_listings_and_ads||[]).push([[663],{923:(e,t,s)=>{s.r(t),s.d(t,{default:()=>O});var n=s(6474),o=s(6476),a=s(7723),i=s(7539),l=s(2455),c=s(6473),u=s(4848);const d=()=>(0,u.jsx)(i.A,{title:(0,a.__)("Set up your campaign","google-listings-and-ads"),helpButton:(0,u.jsx)(l.A,{eventContext:"setup-ads"}),backHref:(0,o.getNewPath)({},"/google/dashboard"),onBackButtonClick:()=>{(0,c.ce)("gla_setup_ads",{triggered_by:"back-button",action:"leave"})}});var r=s(8846),g=s(6087),_=s(7892),p=s(9370),h=s(3164),A=s(3704),x=s(9826),j=s(8678),y=s(458),m=s(3632),b=s(1378),C=s(8e3),k=s(3741),f=s(8242),v=s(1351);const S=e=>{const{onContinue:t=()=>{}}=e,{google:s}=(0,C.A)(),{googleAdsAccount:n}=(0,b.A)(),{isLinkedToMerchantCenter:o}=(0,v.A)();if(!s||"yes"===s.active&&!n)return(0,u.jsx)(k.A,{});const i=!o;return(0,u.jsxs)(p.A,{children:[(0,u.jsx)(h.A,{title:(0,a.__)("Set up your accounts","google-listings-and-ads"),description:(0,a.__)("Connect your Google account and your Google Ads account to set up a Performance Max campaign.","google-listings-and-ads")}),(0,u.jsxs)(f.A,{title:(0,a.__)("Connect accounts","google-listings-and-ads"),description:(0,a.__)("Any campaigns created through this app will appear in your Google Ads account. You will be billed directly through Google.","google-listings-and-ads"),children:[(0,u.jsx)(j.Az,{googleAccount:s,hideAccountSwitch:!0,helper:(0,a.__)("This Google account is connected to your store’s product feed.","google-listings-and-ads")}),(0,u.jsx)(y.Ay,{}),(0,u.jsx)(m.A,{})]}),(0,u.jsx)(x.A,{children:(0,u.jsx)(A.A,{children:(0,u.jsx)(_.A,{isPrimary:!0,disabled:i,onClick:t,children:(0,a.__)("Continue","google-listings-and-ads")})})})]})};var w=s(7541),B=s(5992),P=s(7917),T=s(8331),G=s(6893),F=s(1968),R=s(1650),N=s(5847),V=s(8519),D=s(6960),E=s(3323),M=s(3905);const{APPROVED:Y}=M.CX;function z(){const{isDirty:e,adapter:t}=(0,D.h5)(),s=e&&!t.isSubmitted;return(0,R.A)((0,a.__)("You have unsaved campaign data. Are you sure you want to leave?","google-listings-and-ads"),s),null}const H=()=>{const e=(0,g.useRef)(),{billingStatus:t}=(0,G.A)(),[s,n]=(0,V.A)(),i=(0,F.A)(),{data:l}=(0,N.A)(),d=(0,w.A)(c.eB);return l?(0,u.jsxs)(E.A,{countryCodes:l,onSubmit:e=>{const{level:t,dailyBudget:n,hasConfirmedEuPoliticalContent:a}=e;(0,c.ce)("gla_launch_paid_campaign_button_click",d({level:t,audiences:l.join(","),budget:n,has_confirmed_eu_political_content:a})),s(n,l,a,()=>{const e=(0,o.getNewPath)({guide:"campaign-creation-success"},"/google/dashboard");window.location.href=i+e})},children:[(0,u.jsx)(z,{}),(0,u.jsx)(P.A,{headerTitle:(0,a.__)("Create your campaign","google-listings-and-ads"),context:"setup-ads",continueButton:s=>(0,u.jsx)(_.A,{variant:"primary",text:(0,a.__)("Create campaign","google-listings-and-ads"),disabled:!s.isValidForm||t?.status!==Y,loading:n,onClick:()=>{e.current.resolve(s.values.dailyBudget).then(e=>{null===e?s.handleSubmit():Number.isFinite(e)&&s.setValues({level:"custom",amount:e})})}})}),(0,u.jsx)(T.A,{ref:e,countryCodes:l})]}):(0,u.jsx)(k.A,{})},L=()=>{const[e,t]=(0,g.useState)("1"),s=(0,g.useRef)(null),{hasFinishedResolution:n,hasGoogleAdsConnection:o}=(0,b.A)(),{hasAccess:i,hasFinishedResolution:l,step:d}=(0,B.A)();if((0,w.A)(c.T1,{context:c.lr,step:e}),null===s.current){if(!n||!l)return(0,u.jsx)(k.A,{});const e=o&&!0===i&&"conversion_action"!==d;s.current=e}const _=s=>{s<e&&((0,c.T)("gla_setup_ads",s),t(s))};let p=[{key:"1",label:(0,a.__)("Set up your accounts","google-listings-and-ads"),content:(0,u.jsx)(S,{onContinue:()=>{(()=>{const s=e;(0,c.dQ)("gla_setup_ads",s,"2"),t("2")})()}}),onClick:_},{key:"2",label:(0,a.__)("Create your campaign","google-listings-and-ads"),content:(0,u.jsx)(H,{}),onClick:_}];return s.current&&(p.shift(),p=p.map((e,t)=>({...e,key:(t+1).toString()}))),(0,u.jsx)(r.Stepper,{className:"gla-setup-stepper",currentStep:e,steps:p})},O=()=>((0,n.A)("full-page"),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(d,{}),(0,u.jsx)(L,{})]}))}}]);