7 lines
26 KiB
JavaScript
7 lines
26 KiB
JavaScript
"use strict";(globalThis.webpackChunkgoogle_listings_and_ads=globalThis.webpackChunkgoogle_listings_and_ads||[]).push([[945],{521:(e,a,s)=>{s.d(a,{A:()=>d});var t=s(7143),n=s(6520),o=s(7692),i=s(2775);const r="products",l={products:[],intervals:[],totals:{}};function d(e){const a=(0,i.A)();return(0,t.useSelect)(s=>{const{getReport:t}=s(n.Ui),i=t(r,e,a,"primary"),d=t(r,e,a,"secondary"),c=i.loaded&&d.loaded;let g=l;return c&&i.data&&d.data&&(g={products:i.data.products||l.products,intervals:i.data.intervals||l.intervals,totals:(0,o.bM)(i.data.totals,d.data.totals,i.reportQuery.fields)}),{data:g,loaded:c}},[e,a])}},3458:(e,a,s)=>{s.r(a),s.d(a,{default:()=>ra});var t=s(6087),n=s(7723),o=s(8846),i=s(6476),r=s(7892),l=s(2047),d=s(9927),c=s(1787),g=s(7374);var u=s(6473),m=s(4848);const p=e=>{const{trackEventReportId:a}=e,s=(()=>{const e=(0,i.getQuery)(),{period:a,compare:s,before:t,after:n}=(0,g.getDateParamsFromQuery)(e),{primary:o,secondary:r}=(0,g.getCurrentDates)(e);return{period:a,compare:s,before:t,after:n,primaryDate:o,secondaryDate:r}})();return(0,m.jsx)(o.DateRangeFilterPicker,{dateQuery:s,onRangeSelect:e=>{a&&(0,u.ce)("gla_datepicker_update",{report:a,...e}),(0,i.updateQueryString)(e)},isoDateFormat:"YYYY-MM-DD"})};var _=s(3905),h=s(1209),y=s(7419),x=s(5128),j=s(7143),A=s(6520),C=s(7692),f=s(2775);function b(e){const a=(0,f.A)();return(0,j.useSelect)(s=>{const{getDashboardPerformance:t}=s(A.Ui),n=t(e,a,"primary"),o=t(e,a,"secondary");let i=null;const r=n.loaded&&o.loaded;return r&&n.data&&o.data&&(i=(0,C.bM)(n.data,o.data)),{loaded:r,data:i}},[e,a])}const v=({loaded:e,data:a,children:s,noDataMessage:t})=>{let n;return n=e?a?(0,m.jsx)(o.SummaryList,{children:()=>s(a)}):(0,m.jsxs)("div",{className:"gla-summary-card__body",children:[(0,m.jsx)("p",{children:t.body}),(0,m.jsx)(r.A,{eventName:t.eventName,eventProps:{context:"dashboard",href:t.link},href:t.link,target:"_blank",isSmall:!0,isSecondary:!0,children:t.buttonLabel})]}):(0,m.jsx)(o.SummaryListPlaceholder,{numberOfItems:2}),n};var S=s(6427),k=s(6459);const w=({title:e,children:a})=>(0,m.jsxs)(S.Card,{className:"gla-summary-card",children:[(0,m.jsx)(S.CardHeader,{size:"medium",children:(0,m.jsx)(k.A,{variant:"title-small",children:e})}),a]});var N=s(1378),P=s(5955),E=s(4270),I=s(1212),G=s(2391),R=s(5170),M=s(1177);const F=()=>(0,m.jsxs)("div",{className:"gla-free-ad-credit-claim",children:[(0,m.jsx)(R.A,{}),(0,m.jsx)("div",{children:(0,t.createInterpolateElement)((0,n.__)("Claim $500 in ads credit when you spend your first $500 with Google Ads. <termLink>Terms and conditions apply</termLink>.","google-listings-and-ads"),{termLink:(0,m.jsx)(M.A,{context:"dashboard",linkId:"free-ad-credit-terms",href:"https://www.google.com/ads/coupons/terms/"})})})]});var T=s(850);function B(){const e=[{Icon:P.A,content:(0,n.__)("Reach more customer by advertising your products across Google Ads channels like Search, YouTube and Discover.","google-listings-and-ads")},{Icon:P.A,content:(0,n.__)("Set a daily budget and only pay when people click on your ads.","google-listings-and-ads")},{Icon:P.A,content:(0,t.createInterpolateElement)((0,n.__)("Performance Max uses the best of Google's AI to show the most impactful ads for your products at the right time and place. <link>Learn more about Performance Max technology.</link>","google-listings-and-ads"),{link:(0,m.jsx)(E.i,{href:"https://support.google.com/google-ads/answer/10724817",context:"campaign-creation-performance-max"})})}];return(0,m.jsx)("div",{className:"gla-paid-features__feature-list",children:e.map(({Icon:e,content:a},s)=>(0,m.jsxs)(S.Flex,{align:"flex-start",children:[(0,m.jsx)(e,{size:"18"}),(0,m.jsx)(S.FlexBlock,{children:a})]},s))})}const O=()=>(0,m.jsxs)(T.A,{size:"medium",className:"gla-paid-features",children:[(0,m.jsxs)(S.Flex,{align:"center",gap:9,className:"gla-paid-features__content",children:[(0,m.jsx)(S.FlexItem,{children:(0,m.jsx)(I.A,{})}),(0,m.jsx)(S.FlexBlock,{children:(0,m.jsx)(B,{})})]}),(0,m.jsx)(F,{}),(0,m.jsx)(G.A,{isPrimary:!0,isSecondary:!1,isSmall:!1,eventProps:{context:"add-paid-campaign-promotion"},children:(0,n.__)("Create Campaign","google-listings-and-ads")})]}),L=function(){const{googleAdsAccount:e}=(0,N.A)();return(0,m.jsx)("div",{className:"gla-summary-card__body",children:e?(0,m.jsx)(O,{}):(0,m.jsx)(o.Spinner,{})})};var U=s(7916);const D={precision:0},$=()=>{const e=(0,x.A)(D),{data:a,loaded:s}=b(_.k1);return(0,m.jsx)(v,{loaded:s,data:a,noDataMessage:{body:(0,n.__)("We're having trouble loading this data. Try again later, or track your performance in Google Merchant Center.","google-listings-and-ads"),link:"https://merchants.google.com/mc/reporting/dashboard",eventName:"gla_google_mc_link_click",buttonLabel:(0,n.__)("Open Google Merchant Center","google-listings-and-ads")},children:a=>[(0,m.jsx)(o.SummaryNumber,{label:(0,n.__)("Clicks","google-listings-and-ads"),value:e(a.clicks.value),prevValue:e(a.clicks.prevValue),delta:a.clicks.delta},"1"),(0,m.jsx)(o.SummaryNumber,{label:(0,n.__)("Total Spend","google-listings-and-ads"),value:(0,n.__)("Free","google-listings-and-ads"),delta:null},"2")]})},q=()=>{const{formatAmount:e}=(0,y.A)(),{data:a,loaded:s}=b(_.Mx);return(0,m.jsx)(v,{loaded:s,data:a,noDataMessage:{body:(0,n.__)("We're having trouble loading this data. Try again later, or track your performance in Google Ads.","google-listings-and-ads"),link:"https://ads.google.com/",eventName:"gla_google_ads_link_click",buttonLabel:(0,n.__)("Open Google Ads","google-listings-and-ads")},children:a=>[(0,m.jsx)(o.SummaryNumber,{label:(0,n.__)("Total Sales","google-listings-and-ads"),value:e(a.sales.value,!0),prevValue:e(a.sales.prevValue,!0),delta:a.sales.delta},"1"),(0,m.jsx)(o.SummaryNumber,{label:(0,n.__)("Total Spend","google-listings-and-ads"),value:e(a.spend.value,!0),prevValue:e(a.spend.prevValue,!0),delta:a.spend.delta},"2")]})};function H(){const{hasGoogleMCConnection:e}=(0,U.A)(),{loaded:a,data:s}=(0,h.A)();if(!a)return null;const t=!s?.length;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(w,{title:(0,n.__)("Google Ads","google-listings-and-ads"),children:t?(0,m.jsx)(L,{}):(0,m.jsx)(q,{})}),e&&(0,m.jsx)(w,{title:(0,n.__)("Product Feed (Limited Visibility)","google-listings-and-ads"),children:(0,m.jsx)($,{})})]})}var K=s(9457),Q=s(7043);const Y="create-another-campaign",Z="confirm";function V({onGuideRequestClose:e=()=>{}}){(0,t.useEffect)(()=>{(0,u.ce)("gla_modal_open",{context:_.K4.CAMPAIGN_CREATION_SUCCESS})},[]);const a=(0,t.useCallback)(a=>e(a,"dismiss"),[e]);return(0,m.jsxs)(K.A,{className:"gla-campaign-creation-success-guide",onRequestClose:a,buttons:[(0,m.jsx)(r.A,{isTertiary:!0,"data-action":Y,onClick:e,children:(0,n.__)("Create another campaign","google-listings-and-ads")},"0"),(0,m.jsx)(r.A,{isPrimary:!0,"data-action":Z,onClick:e,children:(0,n.__)("Got it","google-listings-and-ads")},"1")],children:[(0,m.jsx)("div",{className:"gla-campaign-creation-success-guide__header-image",children:(0,m.jsx)("img",{src:Q,alt:(0,n.__)("Drawing of a person who successfully launched a campaign","google-listings-and-ads"),width:"413",height:"160"})}),(0,m.jsx)(E.A,{title:(0,n.__)("You've set up a Performance Max Campaign!","google-listings-and-ads"),children:(0,t.createInterpolateElement)((0,n.__)("You can pause or edit your campaign at any time. For best results, we recommend allowing your campaign to run for at least 14 days without pausing or editing. <link>Learn more about Performance Max technology.</link>","google-listings-and-ads"),{link:(0,m.jsx)(E.i,{href:"https://support.google.com/google-ads/answer/10724817",context:"campaign-creation-performance-max"})})})]})}var W=s(6942),z=s.n(W),J=s(8237),X=s(2434);const ee=e=>{const{programId:a,onRequestClose:s}=e,[o,i]=(0,t.useState)(!1),l=(0,X.j)(),d=()=>{o||s()};return(0,m.jsxs)(K.A,{className:"gla-remove-program-modal",title:(0,n.__)("Permanently Remove?","google-listings-and-ads"),isDismissible:!o,buttons:[(0,m.jsx)(r.A,{isSecondary:!0,disabled:o,onClick:d,children:(0,n.__)("Keep Campaign","google-listings-and-ads")},"keep"),(0,m.jsx)(r.A,{isPrimary:!0,isDestructive:!0,loading:o,onClick:()=>{i(!0),l.deleteAdsCampaign(a).then(()=>s()).catch(()=>i(!1))},children:(0,n.__)("Remove Campaign","google-listings-and-ads")},"remove")],onRequestClose:d,children:[(0,m.jsx)("p",{children:(0,n.__)("Results typically improve with time. Removing a campaign will result in the loss of any optimisations learned from those campaigns.","google-listings-and-ads")}),(0,m.jsx)("p",{children:(0,n.__)("Once a campaign is removed, it cannot be re-enabled.","google-listings-and-ads")})]})},ae=e=>{const{programId:a}=e,[s,o]=(0,t.useState)(!1);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r.A,{isDestructive:!0,isLink:!0,onClick:()=>{o(!0)},children:(0,n.__)("Remove","google-listings-and-ads")}),s&&(0,m.jsx)(ee,{programId:a,onRequestClose:()=>{o(!1)}})]})};var se=s(3666);const te=({programId:e,onRequestClose:a})=>(0,m.jsxs)(K.A,{className:"gla-edit-program-prompt-modal",title:(0,n.__)("Before you edit…","google-listings-and-ads"),buttons:[(0,m.jsx)(r.A,{isSecondary:!0,onClick:()=>{a()},children:(0,n.__)("Don't edit","google-listings-and-ads")},"no"),(0,m.jsx)(r.A,{isPrimary:!0,onClick:()=>{const a=(0,se.Q4)(e);(0,i.getHistory)().push(a),(0,u.ce)("gla_dashboard_edit_program_click",{program_id:e,url:a})},children:(0,n.__)("Continue to edit","google-listings-and-ads")},"yes")],onRequestClose:a,children:[(0,m.jsx)("p",{children:(0,n.__)("Results typically improve with time.","google-listings-and-ads")}),(0,m.jsx)("p",{children:(0,n.__)("Editing will result in the loss of any optimisations learned over time.","google-listings-and-ads")}),(0,m.jsx)("p",{children:(0,n.__)("We recommend allowing your programs to run for at least 14 days after set up, without pausing or editing, for optimal performance.","google-listings-and-ads")})]});var ne=s(6494);const oe=e=>{const{className:a,programId:s,...t}=e;return(0,m.jsx)(ne.A,{button:(0,m.jsx)(r.A,{...t,isLink:!0,className:z()(a),children:(0,n.__)("Edit","google-listings-and-ads")}),modal:(0,m.jsx)(te,{programId:s})})};var ie=s(6734),re=s(5847),le=s(3741);const de=e=>{const{onPauseCampaign:a=()=>{},onRequestClose:s}=e;return(0,m.jsxs)(K.A,{className:"gla-pause-program-modal",title:(0,n.__)("Before you pause…","google-listings-and-ads"),buttons:[(0,m.jsx)(r.A,{isSecondary:!0,onClick:()=>{s()},children:(0,n.__)("Keep Active","google-listings-and-ads")},"1"),(0,m.jsx)(r.A,{isPrimary:!0,onClick:()=>{a()},children:(0,n.__)("Pause Campaign","google-listings-and-ads")},"2")],onRequestClose:s,children:[(0,m.jsx)("p",{children:(0,n.__)("Results typically improve with time. If you pause, your products won’t be shown to people looking for what you offer.","google-listings-and-ads")}),(0,m.jsx)("p",{children:(0,n.__)("Pausing a campaign will result in the loss of any optimisations learned from those campaigns.","google-listings-and-ads")})]})};var ce=s(2280),ge=s(2118);const ue=e=>{const{program:a}=e,[s,n]=(0,t.useState)(a.active),[o,i]=(0,t.useState)(!1),{updateAdsCampaign:r}=(0,X.j)(),{handleError:l}=(0,ce.A)(),d=async e=>{try{await r(a.id,{status:e})}catch(e){n(e=>!e),l(e)}};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(ge.A,{checked:s,onChange:e=>{!1!==e?(n(e),d("enabled")):i(!0)}}),o&&(0,m.jsx)(de,{programId:a.id,onPauseCampaign:()=>{i(!1),n(!1),d("paused")},onRequestClose:()=>{i(!1)}})]})};var me=s(9039);const pe=()=>(0,m.jsx)(me.A,{text:(0,n.__)("Product feed cannot be paused through WooCommerce. Go to Google Merchant Center for advanced settings.","google-listings-and-ads"),children:(0,m.jsx)(ge.A,{checked:!0,disabled:!0})});var _e=s(9788),he=s(7677),ye=s(658),xe=s(8493);const je=()=>(0,m.jsx)(xe.A,{intent:"success",children:(0,m.jsxs)(S.Flex,{gap:1,align:"center",justify:"flex-start",children:[(0,m.jsx)(he.A,{icon:ye.A,width:16}),(0,n.__)("Budget recommendation","google-listings-and-ads")]})});var Ae=s(3887),Ce=s(7280);const fe="gla-all-programs-table-card",be="gla-campaign-edit-button",ve={id:"id",title:"name",dailyBudget:"amount",country:"country",enabled:"status"};function Se({countryCodes:e,countryNameMap:a}){const[s]=e;return(0,m.jsxs)("span",{children:[a[s],e.length>=2&&(0,n.sprintf)(
|
||
// translators: %d: number of countries, with minimum value of 1.
|
||
// translators: %d: number of countries, with minimum value of 1.
|
||
(0,n.__)(" + %d more","google-listings-and-ads"),e.length-1)]})}const ke=e=>{const a=(0,i.getQuery)(),{formatAmount:s}=(0,y.A)(),[o,r]=(0,t.useState)({key:"id",direction:"asc"}),{data:l}=(0,re.A)(),{data:d}=(0,h.A)(),{campaigns:c}=(0,Ae.A)(),g=(0,ie.A)(),p=(0,Ce.$)();(0,t.useEffect)(()=>{if(!d?.length||!c?.length)return;const e=new Set(c.map(e=>e.campaign_id)),a=d.filter(a=>e.has(a.id)).map(e=>e.id);a.length&&(0,u.ce)("gla_raise_budget_recommendation_badge_campaigns",{context:"programs-table-card",campaign_ids:a})},[d,c]);const x=(0,t.useMemo)(()=>{if(!d)return[];const e=ve[o.key];return e?[...d].sort((a,s)=>{let t=a[e],n=s[e];switch(o.key){case"country":t=Array.isArray(a.displayCountries)?a.displayCountries.join("-"):"",n=Array.isArray(s.displayCountries)?s.displayCountries.join("-"):"";break;case"dailyBudget":t=Number(t),n=Number(n);break;case"enabled":t="enabled"===t?1:0,n="enabled"===n?1:0}const i="asc"===o.direction?1:-1;return"string"==typeof t&&"string"==typeof n?String(t).localeCompare(String(n))*i:t<n?-1*i:t>n?1*i:0}):[...d]},[d,o]);if(!l||!d)return(0,m.jsx)(le.A,{});let j=null;if(d.filter(({type:e})=>e===_.$g).length){const e=`.${fe} .${be}`;j=(0,m.jsx)(_e.A,{referenceElementCssSelector:e})}const A=e=>o?.key!==e?{}:{defaultSort:o.key===e,defaultOrder:o.direction},C=[{key:"title",label:(0,n.__)("Program","google-listings-and-ads"),isLeftAligned:!0,required:!0,isSortable:!0,...A("title")},{key:"country",label:(0,n.__)("Country","google-listings-and-ads"),isLeftAligned:!0,isSortable:!0,...A("country")},{key:"dailyBudget",label:(0,n.__)("Daily budget","google-listings-and-ads"),isSortable:!0,...A("dailyBudget")},{key:"enabled",label:(0,n.__)("Enabled","google-listings-and-ads"),isSortable:!0,...A("enabled")},{key:"actions",label:"",required:!0}],f=[{id:_.Q,title:(0,n.__)("Product feed","google-listings-and-ads"),dailyBudget:(0,n.__)("Free","google-listings-and-ads"),country:(0,m.jsx)(Se,{countryCodes:l,countryNameMap:g}),active:!0,disabledEdit:!1},...x.map(e=>{return{id:e.id,title:(0,m.jsxs)(S.Flex,{gap:2,align:"center",justify:"flex-start",wrap:!0,children:[e.name,(a=e.id,!p.includes(`${a}`)&&c.some(e=>e.campaign_id===a)&&(0,m.jsxs)(m.Fragment,{children:[" ",(0,m.jsx)(je,{})]}))]}),dailyBudget:s(e.amount,!0),country:(0,m.jsx)(Se,{countryCodes:e.displayCountries,countryNameMap:g}),active:"enabled"===e.status,disabledEdit:e.type!==_.$g};var a})],b=(0,m.jsx)(J.A,{className:fe,title:(0,n.__)("Programs","google-listings-and-ads"),actions:(0,m.jsx)(G.A,{eventProps:{context:"programs-table-card"}}),headers:C,rowKey:e=>e[0].id,rows:f.map(e=>{const a=e.id===_.Q,s=z()({[be]:!a&&!e.disabledEdit});return[{display:e.title,id:e.id.toString()},{display:e.country},{display:e.dailyBudget},{display:a?(0,m.jsx)(pe,{}):(0,m.jsx)(ue,{program:e})},{display:e.id!==_.Q&&(0,m.jsxs)("div",{className:"program-actions",children:[(0,m.jsx)(oe,{className:s,programId:e.id,disabled:e.disabledEdit}),(0,m.jsx)(ae,{programId:e.id})]})}]}),totalRows:f.length,rowsPerPage:f.length,query:a,onQueryChange:i.onQueryChange,onSort:(e,a)=>{r({key:e,direction:a})},...e});return(0,m.jsxs)(m.Fragment,{children:[j,b]})};var we=s(3921),Ne=s(8468),Pe=s(6474),Ee=s(5834),Ie=s(9415),Ge=s(4307),Re=s(7539),Me=s(2455),Fe=s(3323),Te=s(7917),Be=s(4831),Oe=s(1540),Le=s(1650),Ue=s(4138);const De="gla_paid_campaign_step",$e="edit-ads",qe=(0,se.uZ)(),He=(0,m.jsx)(Me.A,{eventContext:$e});function Ke(e){const a=new Set([(0,i.getNewPath)({step:_.km.CAMPAIGN}),(0,i.getNewPath)({step:_.km.ASSET_GROUP})]),s=e.pathname+e.search;return!a.has(s)}const Qe=()=>{(0,Pe.A)("full-content");const[e,a]=(0,t.useState)(!1),[s,r]=(0,t.useState)(!1),{handleError:l}=(0,ce.A)(),{updateAdsCampaign:d,createCampaignAssetGroup:c,updateCampaignAssetGroup:g}=(0,X.j)(),p=(0,Ee.A)(),y=Number(p.programId),{loaded:x,data:j}=(0,h.A)(),{hasFinishedResolution:A,invalidateResolution:C,data:f}=(0,Ie.A)("getCampaignAssetGroups",y),b=j?.find(e=>e.id===y),v=f?.at(0);(0,t.useEffect)(()=>{b&&b.type!==_.$g&&(0,i.getHistory)().replace(qe)},[b]);const S=function(e){return Object.values(_.km).includes(e)?e:_.km.CAMPAIGN}(p.step);(0,Le.A)((0,n.__)("You have unsaved campaign data. Are you sure you want to leave?","google-listings-and-ads"),e&&!s,Ke);const k=e=>{const a=(0,i.getNewPath)({...p,step:e});(0,i.getHistory)().push(a)};return x&&A?b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Re.A,{title:(0,n.sprintf)(
|
||
// translators: %s: campaign's name.
|
||
// translators: %s: campaign's name.
|
||
(0,n.__)("Edit %s","google-listings-and-ads"),b.name),helpButton:He,backHref:qe}),(0,m.jsx)(Fe.A,{initialCampaign:{level:"current",id:b.id,currentAmount:b.amount,hasConfirmedEuPoliticalContent:b.eu_political_advertising_confirmation},countryCodes:b.displayCountries,assetEntityGroup:v,onSubmit:async(e,a)=>{const{action:s}=a.submitter.dataset,{dailyBudget:t,hasConfirmedEuPoliticalContent:n}=e;r(!0);try{if(await d(b.id,{amount:t,eu_political_advertising_confirmation:n}),s===Oe.zK){let a=v;a||(a=(await c(y)).assetGroup);const s=a.id,t=(0,Ge.A)(a,e);await g(s,t),C()}}catch(e){return l(e),r(!1),void a.signalFailedSubmission()}(0,i.getHistory)().push((0,se.uZ)())},onChange:(e,s)=>{const t=s.dailyBudget!==b.amount,n=!!v&&!(0,Ne.isEqual)(v.display_url_path,s.display_url_path),o=!!v&&(0,Ge.m)(v,s).length>0;a(t||n||o)},children:(0,m.jsx)(o.Stepper,{currentStep:S,steps:[{key:_.km.CAMPAIGN,label:(0,n.__)("Edit campaign","google-listings-and-ads"),content:(0,m.jsx)(Te.A,{context:$e,headerTitle:(0,n.__)("Edit your campaign","google-listings-and-ads"),continueButton:e=>(0,m.jsx)(Be.A,{formProps:e,onClick:()=>{return e=_.km.ASSET_GROUP,(0,u.dQ)(De,_.Z3[S],_.Z3[e],$e),void k(e);var e}})}),onClick:e=>{(0,u.T)(De,_.Z3[e],$e),k(e)}},{key:_.km.ASSET_GROUP,label:(0,n.__)("Optimize your campaign","google-listings-and-ads"),content:(0,m.jsx)(Oe.Ay,{campaign:b})}]})}),(0,m.jsx)(Ue.A,{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Re.A,{title:(0,n.__)("Edit Campaign","google-listings-and-ads"),helpButton:He,backHref:qe}),(0,m.jsx)("div",{children:(0,n.__)("Error in loading your ads campaign. Please try again later.","google-listings-and-ads")})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Re.A,{title:(0,n.__)("Loading…","google-listings-and-ads"),helpButton:He,backHref:qe}),(0,m.jsx)(le.A,{})]})};var Ye=s(1455),Ze=s.n(Ye),Ve=s(5640);const We="gla_paid_campaign_step",ze="create-ads",Je=(0,se.uZ)(),Xe=()=>{(0,Pe.A)("full-content");const{hasGoogleMCConnection:e}=(0,U.A)(),[a,s]=(0,t.useState)(_.km.CAMPAIGN),r=(0,t.useRef)(null),{createAdsCampaign:l,createAdsWithAssetsCampaign:d,updateCampaignAssetGroup:c}=(0,X.j)(),{handleError:g}=(0,ce.A)(),{createNotice:p}=(0,Ve.A)(),{data:h}=(0,re.A)();return h?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Re.A,{title:(0,n.__)("Create your campaign","google-listings-and-ads"),helpButton:(0,m.jsx)(Me.A,{eventContext:ze}),backHref:Je}),(0,m.jsx)(Fe.A,{countryCodes:h,onSubmit:async(a,s)=>{const{action:t}=s.submitter.dataset;try{const{dailyBudget:s,hasConfirmedEuPoliticalContent:o}=a;if(e){if(null===r.current){const e=await l(s,h,o);r.current=e.createdCampaign.id}if(t===Oe.zK){const e=r.current,s=`${A.RV}/ads/campaigns/asset-groups?campaign_id=${e}`,[t]=await Ze()({path:s}),n=(0,Ge.A)(t,a);await c(t.id,n)}}else await d(s,h,(0,Ge.A)({final_url:"",display_url_path:["",""],assets:{}},a),o);p("success",(0,n.__)("You’ve successfully created a campaign!","google-listings-and-ads"))}catch(e){return g(e),void s.signalFailedSubmission()}(0,i.getHistory)().push((0,se.uZ)({campaign:"saved"}))},children:(0,m.jsx)(o.Stepper,{currentStep:a,steps:[{key:_.km.CAMPAIGN,label:(0,n.__)("Create campaign","google-listings-and-ads"),content:(0,m.jsx)(Te.A,{headerTitle:(0,n.__)("Create your campaign","google-listings-and-ads"),context:ze,continueButton:e=>(0,m.jsx)(Be.A,{formProps:e,onClick:()=>{var e;e=_.km.ASSET_GROUP,(0,u.dQ)(We,_.Z3[a],_.Z3[e],ze),s(e)}})}),onClick:e=>{(0,u.T)(We,_.Z3[e],ze),s(e)}},{key:_.km.ASSET_GROUP,label:(0,n.__)("Optimize your campaign","google-listings-and-ads"),content:(0,m.jsx)(Oe.Ay,{})}]})}),(0,m.jsx)(Ue.A,{})]}):null};var ea=s(5246),aa=s(7663),sa=s(2635),ta=s(7008),na=s(3312),oa=s(4488),ia=s(1414);const ra=()=>{const[e,a]=(0,t.useState)(!1),{hasGoogleMCConnection:s}=(0,U.A)(),g=(0,t.useCallback)((e,s)=>{const t=s||e.currentTarget.dataset.action,n={...(0,i.getQuery)(),guide:void 0};(0,i.getHistory)().replace((0,i.getNewPath)(n)),t===Y?(0,i.getHistory)().push((0,se.uB)()):t===Z&&a(!0),(0,u.ce)("gla_modal_closed",{context:_.K4.CAMPAIGN_CREATION_SUCCESS,action:t})},[a]),h=(0,i.getQuery)();switch(h.subpath){case se.$K.editCampaign:return(0,m.jsx)(ia.A,{context:"edit-ads",children:(0,m.jsx)(Qe,{})});case se.$K.createCampaign:return(0,m.jsx)(ia.A,{context:"create-ads",children:(0,m.jsx)(Xe,{})})}const y="dashboard",{enableReports:x}=_.Th,j=()=>(0,m.jsx)(o.Link,{href:(0,i.getNewPath)(null,"/google/reports"),children:(0,m.jsx)(r.A,{isPrimary:!0,children:(0,n.__)("View Reports","google-listings-and-ads")})}),A=h?.guide===_.K4.CAMPAIGN_CREATION_SUCCESS,C=h?.guide===_.K4.SUBMISSION_SUCCESS,f=(0,we.A)();return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"gla-dashboard",children:[(0,m.jsx)(aa.A,{}),(0,m.jsx)(sa.A,{}),(0,m.jsx)(l.A,{context:"dashboard"}),(0,m.jsx)(d.A,{}),(0,m.jsx)(ta.A,{}),(0,m.jsx)(ea.A,{}),(0,m.jsx)(na.A,{}),(0,m.jsxs)("div",{className:"gla-dashboard__filter",children:[(0,m.jsx)(p,{trackEventReportId:y}),x&&s&&(0,m.jsx)(j,{})]}),(0,m.jsx)("div",{className:"gla-dashboard__performance",children:(0,m.jsx)(H,{})}),(0,m.jsxs)(ia.A,{context:"dashboard",children:[(0,m.jsx)("div",{className:"gla-dashboard__programs",children:(0,m.jsx)(ke,{trackEventReportId:y})}),(0,m.jsx)(Ue.A,{})]})]}),A&&(0,m.jsx)(V,{onGuideRequestClose:g}),C&&(0,m.jsx)(oa.A,{}),e&&f&&(0,m.jsx)(c.A,{label:(0,n.__)("How easy was it to create a Google Ad campaign?","google-listings-and-ads"),secondLabel:(0,n.__)("How easy was it to understand the requirements for the Google Ad campaign creation?","google-listings-and-ads"),eventContext:_.K4.CAMPAIGN_CREATION_SUCCESS})]})}},4488:(e,a,s)=>{s.d(a,{A:()=>C});var t=s(6476),n=s(6087),o=s(7723),i=s(8428),r=s(4270),l=s(7892),d=s(2391),c=s(3905),g=s(5744),u=s(3666),m=s(8317),p=s(9692),_=s(6473),h=s(4848);const y="gla_modal_closed",x=e=>{const a=c.Th.mcSetupComplete?(0,u.hP)():(0,u.uZ)();(0,t.getHistory)().replace(a);let s="dismiss";e&&(s=(e.currentTarget||e.target).dataset.action||s),(0,_.ce)(y,{context:c.K4.SUBMISSION_SUCCESS,action:s})},j=(0,h.jsxs)("div",{className:"gla-submission-success-guide__logo-block",children:[(0,h.jsx)("div",{className:"gla-submission-success-guide__logo-item gla-submission-success-guide__logo-item--woocommerce",children:(0,h.jsx)("img",{src:m,alt:(0,o.__)("WooCommerce Logo","google-listings-and-ads"),width:"187.5"})}),(0,h.jsx)("div",{className:"gla-submission-success-guide__logo-separator-line"}),(0,h.jsx)("div",{className:"gla-submission-success-guide__logo-item",children:(0,h.jsx)("img",{src:p,alt:(0,o.__)("Google Logo","google-listings-and-ads"),width:"85"})})]}),A=[{image:j,content:(0,h.jsxs)(r.A,{title:(0,o.__)("You’ve successfully set up Google for WooCommerce! 🎉","google-listings-and-ads"),children:[(0,h.jsx)("p",{children:(0,o.__)("Your products are being synced and reviewed. Google reviews product listings in 3-5 days.","google-listings-and-ads")}),(0,h.jsx)("p",{children:c.Th.adsSetupComplete?(0,o.__)("No ads will launch yet and you won’t be charged until Google approves your listings. Updates are available in your WooCommerce dashboard.","google-listings-and-ads"):(0,n.createInterpolateElement)((0,o.__)("<productFeedLink>Manage and edit your product feed in WooCommerce.</productFeedLink> We will also notify you of any product feed issues to ensure your products get approved and perform well on Google.","google-listings-and-ads"),{productFeedLink:(0,h.jsx)(r.i,{href:(0,u.hP)(),context:"product-feed"})})})]}),action:c.Th.adsSetupComplete?(0,h.jsx)(l.A,{isPrimary:!0,"data-action":"view-product-feed",onClick:x,children:(0,o.__)("View product feed","google-listings-and-ads")}):void 0},{image:j,content:(0,h.jsxs)(r.A,{title:(0,o.__)("Improve conversion tracking accuracy to improve campaign performance","google-listings-and-ads"),children:[(0,h.jsx)("p",{children:(0,o.__)("Set up Enhanced Conversions, a feature designed to improve your measurement accuracy by collecting privacy-conscious data without the need for third-party cookies.","google-listings-and-ads")}),(0,h.jsx)("p",{children:(0,n.createInterpolateElement)((0,o.__)("<link>Learn more</link> about Enhanced Conversions.","google-listings-and-ads"),{link:(0,h.jsx)(r.i,{href:"https://support.google.com/google-ads/answer/9888656",context:"enhanced-conversions"})})})]}),actions:(0,h.jsx)(l.A,{isPrimary:!0,"data-action":"view-enhanced-conversions-settings",eventName:y,eventProps:{context:c.K4.SUBMISSION_SUCCESS,action:"view-enhanced-conversions-settings"},onClick:()=>{x(),(0,t.getHistory)().push((0,u.FN)())},children:(0,o.__)("Set up Enhanced Conversions","google-listings-and-ads")})},{image:j,content:(0,h.jsxs)(r.A,{title:(0,o.__)("Spend $500 to get $500 in Google Ads credits","google-listings-and-ads"),children:[(0,h.jsx)("p",{children:(0,o.__)("New to Google Ads? Get $500 in ad credit when you spend $500 within your first 60 days* You can edit or cancel your campaign at any time.","google-listings-and-ads")}),(0,h.jsx)("cite",{children:(0,n.createInterpolateElement)((0,o.__)("*Full terms and conditions <link>here</link>.","google-listings-and-ads"),{link:(0,h.jsx)(r.i,{href:"https://www.google.com/ads/coupons/terms/",context:"terms-of-ads-coupons"})})})]}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.A,{isSecondary:!0,"data-action":"maybe-later",onClick:x,children:(0,o.__)("Maybe later","google-listings-and-ads")}),(0,h.jsx)(d.A,{isPrimary:!0,isSecondary:!1,isSmall:!1,eventName:y,eventProps:{context:c.K4.SUBMISSION_SUCCESS,action:"create-paid-campaign"},children:(0,o.__)("Create campaign","google-listings-and-ads")})]})}];c.Th.adsSetupComplete&&A.pop();const C=()=>((0,n.useEffect)(()=>{(0,_.ce)("gla_modal_open",{context:c.K4.SUBMISSION_SUCCESS}),g.A.set(c.rS.CAN_ONBOARDING_SETUP_CES_PROMPT_OPEN,!0)},[]),(0,h.jsx)(i.A,{className:"gla-submission-success-guide",backButtonText:(0,o.__)("Back","google-listings-and-ads"),pages:A,onFinish:x}))}}]); |