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

109 lines
No EOL
198 KiB
JavaScript
Raw 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([[223],{559:(e,t,n)=>{n.d(t,{x:()=>_,A:()=>w});var a=n(1609),o=n(7723),s=n(6942),l=n.n(s),r=n(7677),i=n(8690),c=n(8242),d=n(8771);const u=n.p+"images/js/src/images/logo/5585d65b9d8c575e5a1f.gogole-g-logo.svg",g=n.p+"images/js/src/images/logo/6daf36ba57db9c82b6e0.google-merchant-center-logo.svg",m=n.p+"images/js/src/images/logo/389bc604a859dff92f15.google-ads-logo.svg",p=n.p+"images/js/src/images/logo/25a37606f64ef10ff60e.wp-logo.svg",h=n.p+"images/js/src/images/829c5735b6338e133556.final-url-icon.svg",_={EMPTY:"empty",WPCOM:"wpcom",GOOGLE:"google",GOOGLE_MERCHANT_CENTER:"google_merchant_center",GOOGLE_ADS:"google_ads",ADDRESS:"address",FINAL_URL:"final_url"},E=(0,a.createElement)("img",{src:u,alt:(0,o.__)("Google Logo","google-listings-and-ads"),width:"40",height:"40"}),f=(0,a.createElement)("img",{src:g,alt:(0,o.__)("Google Merchant Center Logo","google-listings-and-ads"),width:"40",height:"40"}),A=(0,a.createElement)("img",{src:m,alt:(0,o.__)("Google Ads Logo","google-listings-and-ads"),width:"40",height:"40"}),y=(0,a.createElement)("img",{src:p,alt:(0,o.__)("WordPress.com Logo","google-listings-and-ads"),width:"40",height:"40"}),v=(0,a.createElement)("img",{src:h,alt:(0,o.__)("Final URL icon","google-listings-and-ads"),width:"50"}),b={[_.EMPTY]:{},[_.WPCOM]:{icon:y,title:"WordPress.com"},[_.GOOGLE]:{icon:E,title:(0,o.__)("Google","google-listings-and-ads")},[_.GOOGLE_MERCHANT_CENTER]:{icon:f,title:(0,o.__)("Google Merchant Center","google-listings-and-ads"),description:(0,o.__)("Required to sync products and list on Google.","google-listings-and-ads")},[_.GOOGLE_ADS]:{icon:A,title:(0,o.__)("Google Ads","google-listings-and-ads"),description:(0,o.__)("Required to set up conversion measurement and create campaigns.","google-listings-and-ads")},[_.ADDRESS]:{icon:(0,a.createElement)(r.A,{icon:i.A,size:32}),title:(0,o.__)("Store address","google-listings-and-ads")},[_.FINAL_URL]:{icon:v,title:(0,o.__)("Final URL","google-listings-and-ads")}},C={center:!1,top:"gla-account-card__styled--align-top"},k={...C,toDetail:"gla-account-card__indicator--align-to-detail"};function w({className:e,disabled:t=!1,appearance:n=_.EMPTY,icon:o=b[n].icon,title:s=b[n].title,description:r=b[n].description,helper:i,alignIcon:u="center",indicator:g,alignIndicator:m="center",detail:p,expandedDetail:h=!1,actions:E,children:f,...A}){const y=l()("gla-account-card",!!t&&"gla-account-card--is-disabled",!!h&&"gla-account-card--is-expanded-detail",e),v=l()("gla-account-card__icon",C[u]),w=l()("gla-account-card__indicator",k[m]);return(0,a.createElement)(c.A.Card,{className:y,...A},(0,a.createElement)(c.A.Card.Body,null,(0,a.createElement)("div",{className:"gla-account-card__body-layout"},o&&(0,a.createElement)("div",{className:v},o),(0,a.createElement)("div",{className:"gla-account-card__subject"},s&&(0,a.createElement)(d.A.Title,{className:"gla-account-card__title"},s),r&&(0,a.createElement)("div",{className:"gla-account-card__description"},r),i&&(0,a.createElement)("div",{className:"gla-account-card__helper"},i)),p&&(0,a.createElement)("div",{className:"gla-account-card__detail"},p),g&&(0,a.createElement)("div",{className:w},g),E&&(0,a.createElement)("div",{className:"gla-account-card__actions"},E))),f)}},6960:(e,t,n)=>{n.d(t,{Ay:()=>g,h5:()=>i,Gl:()=>c});var a=n(1609),o=n(6087),s=n(8846),l=n(8468);const r=(0,o.createContext)(null);function i(){const e=(0,o.useContext)(r);if(null===e)throw new Error("useAdaptiveFormContext was used outside of its context provider AdaptiveForm.");return e}function c(e,t=e){const{getInputProps:n,adapter:a}=i();return{...n(e),helper:a.renderRequestedValidation(t)}}const d="submitting",u="submitted",g=(0,o.forwardRef)((function({onSubmit:e,extendAdapter:t,children:n,...i},c){const g=(0,o.useRef)(),m=(0,o.useRef)({submitter:null}),[p,h]=(0,o.useState)([]),[_,E]=(0,o.useState)(),f=(0,o.useCallback)(((...e)=>{h((t=>[...t,e]))}),[]);(0,o.useEffect)((()=>{_&&m.current.setValueCompatibly(..._)}),[_]),(0,o.useImperativeHandle)(c,(()=>({setValue:f,...g.current})));const A=function(){const e=(0,o.useRef)(!1);return(0,o.useEffect)((()=>(e.current=!0,()=>{e.current=!1})),[]),(0,o.useCallback)((()=>e.current),[])}(),[y,v]=(0,o.useState)(0),b=(0,o.useCallback)((()=>{v((e=>e+1))}),[]),C=(0,o.useCallback)((()=>{v(0)}),[]),[k,w]=(0,o.useState)(null),N=k===d,S=k===u;return e&&(i.onSubmit=async function(t){w(d);let n=!1;const a={submitter:m.current.submitter,signalFailedSubmission(){n=!0}};await e.call(this,t,a),A()&&(m.current.submitter=null,w(n?null:u))}),(0,a.createElement)(s.Form,{...i,ref:g},(({setValue:e,setValues:o,getInputProps:s,handleSubmit:i,...c})=>{if(m.current.setValueCompatibly=(t,n)=>{o?o({[t]:n}):e(t,n)},c.setValue=f,c.getInputProps=e=>{const t=s(e);return{...t,onChange:function(n){(function(e){return(e?.nativeEvent||e)instanceof Event})(n)&&(n="checkbox"===n.target.type?!(0,l.get)(t.values,e):n.target.value),m.current.setValueCompatibly(e,n)}}},p.length&&setTimeout((()=>E(p.shift()))),c.handleSubmit=function(e){return m.current.submitter=e?.currentTarget||null,i.call(this,e)},c.adapter={isSubmitting:N,isSubmitted:S,submitter:m.current.submitter,validationRequestCount:y,requestedShowValidation:y>0,showValidation:b,hideValidation:C},"function"==typeof t){const e=t(c);Object.assign(c.adapter,e)}return(0,a.createElement)(r.Provider,{value:c},"function"==typeof n?n(c):n)}))}))},2661:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(7723),s=n(5703),l=n(7568),r=n(5530),i=n(1378);const c=e=>{const{existingAccounts:t}=(0,r.A)(),{googleAdsAccount:n,hasGoogleAdsConnection:c}=(0,i.A)(),d=t?.some((e=>e.id===n?.id));if(!d&&c){const e=new URL((0,s.getSetting)("homeUrl")).host;return(0,a.createElement)(l.A,{autoSelectFirstOption:!0,nonInteractive:!0,value:n.id,options:[{value:n.id,label:(0,o.sprintf)(
// translators: 1: account domain, 2: account ID.
// translators: 1: account domain, 2: account ID.
(0,o.__)("%1$s (%2$s)","google-listings-and-ads"),e,n.id)}]})}const u=t?.map((e=>({value:e.id,label:`${e.name} (${e.id})`})));return(0,a.createElement)(l.A,{options:u,autoSelectFirstOption:!0,...e})}},6494:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1609),o=n(6087);const s=e=>{const{button:t,modal:n}=e,{onClick:s=()=>{}}=t.props,{onRequestClose:l=()=>{}}=n.props,[r,i]=(0,o.useState)(!1);return(0,a.createElement)(a.Fragment,null,(0,o.cloneElement)(t,{onClick:(...e)=>{i(!0),s(...e)}}),r&&(0,o.cloneElement)(n,{onRequestClose:(...e)=>{i(!1),l(...e)}}))}},7892:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(6427),s=n(8846),l=n(6942),r=n.n(l),i=n(6473);const c=e=>{const{className:t,disabled:n,loading:l,eventName:c,eventProps:d,text:u,onClick:g=()=>{},...m}=e,p=n||l,h=["app-button",t];let _;return l&&(_=(0,a.createElement)(s.Spinner,null)),u&&(_=(0,a.createElement)(a.Fragment,null,l&&(0,a.createElement)(s.Spinner,null),u),m.icon&&h.push("app-button--icon-with-text"),"right"===m.iconPosition&&h.push("app-button--icon-position-right")),(0,a.createElement)(o.Button,{className:r()(...h),disabled:p,"aria-disabled":p,text:_,onClick:(...e)=>{c&&(0,i.ce)(c,d),g(...e)},...m})}},1177:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1609),o=n(2848);const s=e=>{const{context:t,linkId:n,href:s,...l}=e;return(0,a.createElement)(o.A,{eventProps:{context:t,link_id:n,href:s},type:"external",target:"_blank",href:s,...l,eventName:"gla_documentation_link_click"})}},5092:(e,t,n)=>{n.d(t,{A:()=>u});var a=n(1609),o=n(6942),s=n.n(o),l=n(7723),r=n(6087),i=n(6427),c=n(399);const d="app-input-control",u=(0,r.forwardRef)((({className:e,noPointerEvents:t=!1,maxCharacterCount:n=0,kindCharacterCount:o,...r},u)=>{const g=[d,e];let m;if(t&&g.push(`${d}--no-pointer-events`),n>0&&o){const e=(0,c.A)(o)(r.value?.trim()||"");m=(0,l.sprintf)(
// translators: 1: number of character count. 2: the maximum number of character count.
// translators: 1: number of character count. 2: the maximum number of character count.
(0,l.__)("%1$d/%2$d characters","google-listings-and-ads"),e,n),e>n&&g.push(`${d}--error-character-count`)}return(0,a.createElement)("div",{className:s()(g)},(0,a.createElement)(i.__experimentalInputControl,{ref:u,...r}),m&&(0,a.createElement)("div",{className:"app-input-control__character-count"},m))}))},6499:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(1609),o=n(6087),s=n(5092);const l=(e,t)=>{const{decimalSeparator:n}=t,a=new RegExp("[^0-9-"+n+"]",["g"]),o=parseFloat((""+e).replace(/\((.*)\)/,"-$1").replace(a,"").replace(n,"."));return isNaN(o)?0:o};var r=n(3772);const i=e=>({...(0,r.A)(),precision:0,...e});var c=n(5128);const d=e=>{const{value:t,numberSettings:n,onChange:r=()=>{},onBlur:d=()=>{},...u}=e,g=i(n),m=(e=>{const t=i(e);return(0,c.A)(t)})(n),[,p]=(0,o.useReducer)((e=>e+1),0),h=m(t),_=e=>{const t=l(e,g),n=m(t);return l(n,g)};return(0,a.createElement)(s.A,{value:h,onChange:e=>{const t=_(e);r(t),p()},onBlur:e=>{const t=_(e.target.value);d(e,t)},...u})}},5588:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),o=n(3772),s=n(6499);const l=e=>{const t=(0,o.A)();return(0,a.createElement)(s.A,{suffix:t.code,numberSettings:t,...e})}},9457:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(1609),o=n(6427),s=n(6942),l=n.n(s);const r={auto:!1,visible:"app-modal__styled--overflow-visible"},i=({className:e,overflow:t="auto",buttons:n=[],children:s,...i})=>{const c=l()("gla-admin-page","app-modal",r[t],e);return(0,a.createElement)(o.Modal,{className:c,...i},s,n.length>=1&&(0,a.createElement)("div",{className:"app-modal__footer"},n))}},8683:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(1609),o=n(6942),s=n.n(o),l=n(6427);const r=e=>{const{className:t,label:n,value:o,selected:r,collapsible:i=!1,children:c,...d}=e,u=r===o;return(0,a.createElement)("div",{className:s()("app-radio-content-control",t)},(0,a.createElement)(l.RadioControl,{...d,selected:r,checked:u,options:[{label:n,value:o}],help:""}),(!i||u)&&(0,a.createElement)("div",{className:"app-radio-content-control__content"},c))}},7568:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(6427),s=n(6087),l=n(6942),r=n.n(l),i=n(8468);const c=e=>{const{options:t=[],className:n,onChange:l=i.noop,value:c,autoSelectFirstOption:d=!1,nonInteractive:u=!1,...g}=e,m=(0,s.useRef)(!0===d);(0,s.useEffect)((()=>{m.current&&void 0===c&&t.length&&(m.current=!1,l(t[0].value))}),[c,t,l]);let p={options:t,value:c,onChange:l,...g};const h=d&&1===t?.length||u;return h&&(p={...p,readOnly:!0,suffix:" ",tabIndex:"-1"}),(0,a.createElement)("div",{className:r()("app-select-control",n,{"app-select-control--is-non-interactive":h})},(0,a.createElement)(o.SelectControl,{...p}))}},3741:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1609),o=n(8846);const s=()=>(0,a.createElement)("div",{className:"app-spinner"},(0,a.createElement)(o.Spinner,null))},2118:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1609),o=n(6427);const s=e=>(0,a.createElement)("div",{className:"app-standalone-toggle-control"},(0,a.createElement)(o.ToggleControl,{...e}))},1670:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(6087),s=n(6427),l=n(8846),r=n(6942),i=n.n(r);const c=e=>{const{selectedKey:t,tabs:n}=e;return(0,a.createElement)(s.NavigableMenu,{role:"tablist",orientation:"horizontal",className:"subsubsub gla-sub-nav"},n.map(((e,s)=>{const r=e.key===t;return(0,a.createElement)(o.Fragment,{key:e.key},(0,a.createElement)(l.Link,{className:i()({current:r}),tabIndex:r?null:-1,id:`${e.key}`,href:e.href,role:"tab","aria-selected":r,"aria-controls":`${e.key}-view`,"aria-current":!!r&&"page"},e.title+" "),s<n.length-1?" | ":" ")})))}},347:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(6427),s=n(8846),l=n(6942),r=n.n(l);const i=({tabId:e,href:t,children:n,selected:o,...l})=>(0,a.createElement)(s.Link,{role:"tab",tabIndex:o?null:-1,"aria-selected":o,id:e,href:t,...l},n),c=e=>{const{selectedKey:t,tabs:n}=e;return(0,a.createElement)("div",{className:"app-tab-nav"},(0,a.createElement)(o.NavigableMenu,{role:"tablist",orientation:"horizontal",className:"app-tab-nav__tabs"},n.map((e=>(0,a.createElement)(i,{className:r()("components-button","app-tab-nav__tabs-item",{"is-active":e.key===t}),tabId:`${e.key}`,"aria-controls":`${e.key}-view`,selected:e.key===t,key:e.key,href:e.href},e.title)))))}},2159:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),o=n(6942),s=n.n(o);const l=e=>{const{className:t,...n}=e;return(0,a.createElement)("div",{className:s()("app-table-card-div",t),...n})}},8237:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(8846),s=n(2159),l=n(6473);const r=(e,t,n)=>{const a=t.includes(n)?"on":"off";(0,l.ce)("gla_table_header_toggle",{report:e,column:n,status:a})},i=(e,t,n)=>{(0,l.ce)("gla_table_sort",{report:e,column:t,direction:n})},c=e=>{const{trackEventReportId:t,...n}=e;function l(e,n){return function(...a){t&&e(t,...a),n&&n(...a)}}return(0,a.createElement)(s.A,null,(0,a.createElement)(o.TableCard,{...n,onColumnsChange:l(r,e.onColumnsChange),onSort:l(i,e.onSort)}))}},6459:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),o=n(6942),s=n.n(o);const l=({variant:e,className:t="",children:n,as:o="p",...l})=>{const r=o;return(0,a.createElement)(r,{...l,className:s()("gla-app-text",t,{[`gla-app-text--${e}`]:e})},n)}},9039:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(6427),s=n(6087),l=n(5703);const r={"top-start":"top right",top:"top center"};function i(e){if((0,l.isWpVersion)("6.4","<")){const{placement:t,...n}=e,a=r[t];if(a)return{...n,position:a}}return e}const c=e=>{const{children:t,...n}=e;let l;const r=s.Children.toArray(t);return 1===r.length&&(l=r[0].props?.disabled),(0,a.createElement)(o.Tooltip,{...i(n)},(0,a.createElement)("div",{className:"gla-tooltip__children-container",disabled:l},t))}},4566:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(6942),s=n.n(o),l=n(7723),r=n(6427),i=n(4848);const c=e=>{const{className:t}=e;return(0,a.createElement)(r.Flex,{className:s()("gla-connected-icon-label",t),align:"center",gap:1},(0,a.createElement)(r.FlexItem,null,(0,a.createElement)(i.A,null)),(0,a.createElement)(r.FlexItem,null,(0,l.__)("Connected","google-listings-and-ads")))}},3354:(e,t,n)=>{n.d(t,{h:()=>x,S:()=>A});var a=n(1609),o=n(7723),s=n(6087),l=n(8846),r=n(4818),i=n(6476),c=n(5595),d=n(559),u=n(7892),g=n(6319),m=n(7677),p=n(5603);function h({editHref:e,editEventName:t,loading:n,content:s,appearance:l,warning:r}){const{subpath:c}=(0,i.getQuery)(),g=(0,a.createElement)(u.A,{isSecondary:!0,href:e,text:(0,o.__)("Edit","google-listings-and-ads"),eventName:t,eventProps:{path:(0,i.getPath)(),subpath:c}});let h,_;return n?h=(0,a.createElement)("span",{className:"gla-contact-info-preview-card__placeholder","aria-busy":"true",title:(0,o.__)("Loading…","google-listings-and-ads")}):r?(_=(0,a.createElement)(a.Fragment,null,(0,a.createElement)(m.A,{icon:p.A,size:24,className:"gla-contact-info-preview-card__notice-icon"}),r),h=(0,a.createElement)("span",{className:"gla-contact-info-preview-card__notice-details"},s)):h=s,(0,a.createElement)(d.A,{appearance:l,className:"gla-contact-info-preview-card",icon:null,title:_,description:h,indicator:g})}var _=n(2848);function E(e){const t={address_1:(0,o._x)("address line","The field name of the address line in store address","google-listings-and-ads"),city:(0,o._x)("city","The field name of the city in store address","google-listings-and-ads"),country:(0,o._x)("country/state","The field name of the country in store address","google-listings-and-ads"),postcode:(0,o._x)("postcode/zip","The field name of the postcode in store address","google-listings-and-ads")};return e.missingRequiredFields.map((e=>{const n=t[e]||e;return(0,o.sprintf)(
// translators: %s: The missing field name of store address.
// translators: %s: The missing field name of store address.
(0,o.__)("The %s of store address is required.","google-listings-and-ads"),n)}))}var f=n(6473);const A=()=>{const{loaded:e,data:t,refetch:n}=(0,c.A)(),{isAddressFilled:m}=t,p=(0,i.getPath)(),{subpath:h}=(0,i.getQuery)(),A=(0,s.useRef)(null);e&&A.current&&(A.current(t),A.current=null);const y=(0,a.createElement)(u.A,{isSecondary:!0,icon:r.A,iconSize:20,iconPosition:"right",text:(0,o.__)("Update store address","google-listings-and-ads"),onClick:()=>{n(),A.current=e=>{const t={path:p,subpath:h,country_code:e.countryCode,missing_fields:e.missingRequiredFields.join(",")};(0,f.ce)("gla_wc_store_address_validation",t)}},disabled:!e}),v=(0,a.createElement)(_.A,{target:"_blank",type:"external",href:"admin.php?page=wc-settings",eventName:"gla_edit_wc_store_address",eventProps:{path:p,subpath:h}});let b=(0,a.createElement)(l.Spinner,null);if(e){const{address:e,address2:n,city:o,state:s,country:l,postcode:r}=t,i=[o,s?`${s} - ${l}`:l,r].filter(Boolean).join(", ");b=(0,a.createElement)(a.Fragment,null,e&&(0,a.createElement)("div",null,e),n&&(0,a.createElement)("div",null,n),(0,a.createElement)("div",null,i))}const C=(0,a.createElement)("p",null,m?(0,s.createInterpolateElement)((0,o.__)("Were using your store address for Google verification. This information wont be public. Edit in <link>WooCommerce settings</link> if needed and update to review the changes.","google-listings-and-ads"),{link:v}):(0,s.createInterpolateElement)((0,o.__)("Your store address is required by Google for verification. This information wont be public. Complete that in <link>WooCommerce settings</link> and update to review the changes.","google-listings-and-ads"),{link:v})),k=(0,a.createElement)(a.Fragment,null,b,!m&&(0,a.createElement)(g.A,{messages:E(t)}));return(0,a.createElement)(d.A,{className:"gla-store-address-card",appearance:d.x.ADDRESS,alignIcon:"top",alignIndicator:"top",description:C,detail:k,indicator:y})};function y({editHref:e,learnMore:t}){const{loaded:n,data:s}=(0,c.A)("mc");let l,r;if(n){const{isAddressFilled:e,isMCAddressDifferent:n,address:i,address2:c,city:d,state:u,country:g,postcode:m}=s;e&&!n?l=[i,c,d,u?`${u} - ${g}`:g,m].filter(Boolean).join(", "):(r=(0,o.__)("Please add your store address","google-listings-and-ads"),l=(0,a.createElement)(a.Fragment,null,(0,o.__)("Google requires the store address for all stores using Google Merchant Center. ","google-listings-and-ads"),t))}return(0,a.createElement)(h,{appearance:d.x.ADDRESS,editHref:e,editEventName:"gla_edit_mc_store_address",loading:!n,warning:r,content:l})}var v=n(3666),b=n(8242),C=n(1177);const k="contact-information-read-more",w="https://woocommerce.com/document/google-for-woocommerce/get-started/requirements/#contact-information",N=(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,o.__)("Your contact information is required for verification by Google.","google-listings-and-ads")),(0,a.createElement)("p",null,(0,o.__)("It would be shared with Google Merchant Center for store verification and would not be displayed to customers.","google-listings-and-ads"))),S=(0,o.__)("Contact information","google-listings-and-ads");function x(){return(0,a.createElement)(b.A,{title:S,description:N},(0,a.createElement)(y,{editHref:(0,v.Xb)(),learnMore:(0,a.createElement)(C.A,{context:"settings-no-store-address-notice",linkId:k,href:w},(0,o.__)("Learn more","google-listings-and-ads"))}))}},8463:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),o=n(6942),s=n.n(o);const l=e=>{const{className:t,...n}=e;return(0,a.createElement)("div",{className:s()("gla-content-button-layout",t),...n})}},1787:(e,t,n)=>{n.d(t,{A:()=>m});var a=n(1609),o=n(7723),s=n(7752),l=n(3905),r=n(5744),i=n(6087),c=n(7143),d=n(6520);const u=(e,t=d.mY)=>{const n=((e=d.mY)=>(0,c.useSelect)((t=>t(e).getNotices()),[e]))(t).find((t=>t.content===e));return(0,i.useEffect)((()=>{const{removeNotice:e}=(0,c.dispatch)(t);return()=>{n&&e(n.id)}}),[n,t]),n||null};var g=n(6473);const m=({eventContext:e,label:t,secondLabel:n})=>(u(t,"core/notices2"),(0,a.createElement)(s.CustomerEffortScore,{label:t,title:t,firstQuestion:t,secondQuestion:n,recordScoreCallback:(t,n,a)=>{(0,g.ce)("gla_ces_feedback",{context:e,score:t,comments:a||""})},onNoticeShownCallback:()=>{r.A.remove(l.rS.CAN_ONBOARDING_SETUP_CES_PROMPT_OPEN),(0,g.ce)("gla_ces_snackbar_open",{context:e})},onNoticeDismissedCallback:()=>{(0,g.ce)("gla_ces_snackbar_closed",{context:e})},onModalShownCallback:()=>{(0,g.ce)("gla_ces_modal_open",{context:e})},icon:(0,a.createElement)("span",{style:{height:21,width:21},role:"img","aria-label":(0,o.__)("Pencil icon","google-listings-and-ads")},"✏️")}))},2047:(e,t,n)=>{n.d(t,{A:()=>u});var a=n(1609),o=n(7723),s=n(6427),l=n(6087),r=n(1378),i=n(3772),c=n(1177),d=n(3905);const u=({context:e})=>{const{googleAdsAccount:t}=(0,r.A)(),{code:n}=(0,i.A)();return t&&t.status===d.Wn.CONNECTED&&t.currency!==n?(0,a.createElement)(s.Notice,{className:"gla-different-currency-notice",status:"warning",isDismissible:!1},(0,l.createInterpolateElement)((0,o.__)("Note: The currency set in your Google Ads account is <adsCurrency />, which is different from your store currency, <storeCurrency />. <readMoreLink>Read more</readMoreLink>","google-listings-and-ads"),{adsCurrency:(0,a.createElement)("strong",null,t.currency),storeCurrency:(0,a.createElement)("strong",null,n),readMoreLink:(0,a.createElement)(c.A,{className:"gla-different-currency-notice__link",href:"https://support.google.com/google-ads/answer/9841530",context:e,linkId:"setting-up-currency"})})):null}},8987:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(1609),o=n(8846),s=n(7723),l=n(6473);const r=()=>{},i=({productId:e,eventName:t,eventProps:n})=>{const i=`post.php?action=edit&post=${e}`,c=t?()=>(0,l.Ff)(t,n):r;return(0,a.createElement)(o.Link,{href:i,onClick:c,type:"wp-admin"},(0,s.__)("Edit","google-listings-and-ads"))}},6588:(e,t,n)=>{n.d(t,{A:()=>g});var a=n(1609),o=n(7723),s=n(3832),l=n(6087),r=n(7892),i=n(3905),c=n(6520),d=n(6599),u=n(5640);const g=e=>{const{createNotice:t}=(0,u.A)(),[n,g]=(0,l.useState)(!1),m={next_page_name:i.Th.mcSetupComplete?"settings":"setup-mc"},p=(0,s.addQueryArgs)(`${c.RV}/rest-api/authorize`,m),[h]=(0,d.A)({path:p});return(0,a.createElement)(r.A,{isSecondary:!0,loading:n,onClick:async()=>{try{g(!0);const e=await h();g(!1),window.location.href=e.auth_url}catch(e){g(!1),t("error",(0,o.__)("Unable to enable new product sync. Please try again later.","google-listings-and-ads"))}},...e})}},332:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(7723),s=n(6427),l=n(6087),r=n(7916),i=n(6588);const c=()=>{const{hasFinishedResolution:e,googleMCAccount:t}=(0,r.A)();return e&&t?.notification_service_enabled&&!t?.wpcom_rest_api_status?(0,a.createElement)(s.Notice,{status:"info",isDismissible:!1},(0,l.createInterpolateElement)((0,o.__)("<p>We will soon transition to a new and improved method for synchronizing product data with Google.</p><enableButton>Get early access</enableButton>","google-listings-and-ads"),{enableButton:(0,a.createElement)(i.A,{eventName:"gla_enable_product_sync_click",eventProps:{context:"banner"}}),p:(0,a.createElement)("p",null)})):null}},2178:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1609),o=n(3207);const s=({size:e=18})=>(0,a.createElement)(o.A,{className:"gla-error-icon",size:e})},2448:(e,t,n)=>{n.d(t,{A:()=>N});var a=n(1609),o=n(7723),s=n(6087),l=n(8468),r=n(5556),i=n.n(r),c=n(6476),d=n(7374),u=n(4111),g=n.n(u),m=n(8846),p=n(6427),h=n(6459);class _ extends s.Component{constructor({getLabels:e,param:t,query:n}){super(...arguments),this.state={selected:[]},this.clearQuery=this.clearQuery.bind(this),this.updateQuery=this.updateQuery.bind(this),this.updateLabels=this.updateLabels.bind(this),this.onButtonClicked=this.onButtonClicked.bind(this),n[t]&&e(n[t],n).then(this.updateLabels)}componentDidUpdate({param:e,query:t},{selected:n}){const{getLabels:a,param:o,query:s}=this.props,{selected:r}=this.state;if(e!==o||n.length>0&&0===r.length)return void this.clearQuery();const i=(0,c.getIdsFromQuery)(t[o]),d=(0,c.getIdsFromQuery)(s[o]);(0,l.isEqual)(i.sort(),d.sort())||a(s[o],s).then(this.updateLabels)}clearQuery(){const{param:e,path:t,query:n}=this.props;this.setState({selected:[]}),(0,c.updateQueryString)({[e]:void 0},t,n)}updateLabels(e){this.setState({selected:e})}updateQuery(){const{param:e,path:t,query:n}=this.props,{selected:a}=this.state,o=a.map((e=>e.key));(0,c.updateQueryString)({[e]:o.join(",")},t,n)}onButtonClicked(e){this.updateQuery(e),(0,l.isFunction)(this.props.onClick)&&this.props.onClick(e)}render(){const{labels:e,type:t,autocompleter:n}=this.props,{selected:s}=this.state;return(0,a.createElement)(p.Card,{className:"woocommerce-filters__compare"},(0,a.createElement)(p.CardHeader,null,(0,a.createElement)(h.A,{variant:"subtitle-small"},e.title)),(0,a.createElement)(p.CardBody,null,(0,a.createElement)(m.Search,{autocompleter:n,type:t,selected:s,placeholder:e.placeholder,onChange:e=>{this.setState({selected:e})}})),(0,a.createElement)(p.CardFooter,{justify:"flex-start"},(0,a.createElement)(m.CompareButton,{count:s.length,helpText:e.helpText,onClick:this.onButtonClicked},e.update),s.length>0&&(0,a.createElement)(p.Button,{isLink:!0,onClick:this.clearQuery},(0,o.__)("Clear all","woocommerce"))))}}_.propTypes={getLabels:i().func.isRequired,labels:i().shape({placeholder:i().string,title:i().string,update:i().string}),param:i().string.isRequired,path:i().string.isRequired,query:i().object,type:i().string.isRequired,autocompleter:i().object},_.defaultProps={labels:{},query:{}};var E=n(8107),f=n(6942),A=n.n(f),y=n(7677),v=n(3988);const b="all";class C extends s.Component{constructor(e){super(e);const t=this.getFilter();if(this.state={nav:t.path||[],animate:null,selectedTag:null},this.selectSubFilter=this.selectSubFilter.bind(this),this.getVisibleFilters=this.getVisibleFilters.bind(this),this.updateSelectedTag=this.updateSelectedTag.bind(this),this.onTagChange=this.onTagChange.bind(this),this.onContentMount=this.onContentMount.bind(this),this.goBack=this.goBack.bind(this),t.settings&&t.settings.getLabels){const{query:e}=this.props,{param:n,getLabels:a}=t.settings;a(e[n],e).then(this.updateSelectedTag)}}componentDidUpdate({query:e}){const{query:t,config:n}=this.props;if(e[n.param]!==t[[n.param]]){const e=this.getFilter();if(e&&"Search"===e.component){this.setState({nav:e.path||[]});const{param:n,getLabels:a}=e.settings;a(t[n],t).then(this.updateSelectedTag)}}}updateSelectedTag(e){this.setState({selectedTag:e[0]})}getFilter(e){const{config:t,query:n}=this.props,a=(0,c.flattenFilters)(t.filters);return e=e||n[t.param]||t.defaultValue||b,(0,l.find)(a,{value:e})||{}}getButtonLabel(e){if("Search"===e.component){const{selectedTag:t}=this.state;return[t&&t.label,(0,l.get)(e,"settings.labels.button")]}return e?[e.label]:[]}getVisibleFilters(e,t){if(0===t.length)return e;const n=t[0],a=(0,l.find)(e,{value:n});return this.getVisibleFilters(a&&a.subFilters,t.slice(1))}selectSubFilter(e){this.setState((t=>({nav:[...t.nav,e],animate:"left"})))}goBack(){this.setState((e=>({nav:e.nav.slice(0,-1),animate:"right"})))}update(e,t={}){const{path:n,query:a,config:o,onFilterSelect:s}=this.props,l=(0,c.getPersistedQuery)(a),r={[o.param]:(o.defaultValue||b)===e?void 0:e,...t};o.staticParams.forEach((e=>{r[e]=a[e]})),(0,c.updateQueryString)(r,n,l),s(r)}onTagChange(e,t,n,a){const o=(0,l.last)(a),{value:s,settings:r}=e,{param:i}=r;o?(this.update(s,{[i]:o.key}),t()):this.update(n.defaultValue||b),this.updateSelectedTag([o])}renderButton(e,t,n){if(e.component){const{type:o,labels:s,autocompleter:r}=e.settings,i=this.getFilter().value===e.value?this.state.selectedTag:null;return(0,a.createElement)(m.Search,{autocompleter:r,className:"woocommerce-filters-filter__search",type:o,placeholder:s.placeholder,selected:i?[i]:[],onChange:(0,l.partial)(this.onTagChange,e,t,n),inlineTags:!0,staticResults:!0})}const o=n=>{t(n),this.update(e.value,e.query||{}),this.setState({selectedTag:null})},s=(0,l.partial)(this.selectSubFilter,e.value),r=this.getFilter(),i=r.value===e.value||r.path&&(0,l.includes)(r.path,e.value);return(0,a.createElement)(p.Button,{className:"woocommerce-filters-filter__button",onClick:n=>{i?t(n):e.subFilters?s(n):o(n)}},e.label)}onContentMount(e){const{nav:t}=this.state,n=t.length&&this.getFilter(t[t.length-1])?1:0,a=E.focus.tabbable.find(e)[n];setTimeout((()=>{a.focus()}),0)}render(){const{config:e}=this.props,{nav:t,animate:n}=this.state,s=this.getVisibleFilters(e.filters,t),r=!!t.length&&this.getFilter(t[t.length-1]),i=this.getFilter();return(0,a.createElement)("div",{className:"woocommerce-filters-filter"},e.label&&(0,a.createElement)("span",{className:"woocommerce-filters-label"},e.label,":"),(0,a.createElement)(p.Dropdown,{contentClassName:"woocommerce-filters-filter__content",position:"bottom",expandOnMobile:!0,headerTitle:(0,o.__)("filter report to show:","woocommerce"),renderToggle:({isOpen:e,onToggle:t})=>(0,a.createElement)(m.DropdownButton,{onClick:t,isOpen:e,labels:this.getButtonLabel(i)}),renderContent:({onClose:o})=>(0,a.createElement)(m.AnimationSlider,{animationKey:t,animate:n,onExited:this.onContentMount},(()=>(0,a.createElement)("ul",{className:"woocommerce-filters-filter__content-list"},r&&(0,a.createElement)("li",{className:"woocommerce-filters-filter__content-list-item"},(0,a.createElement)(p.Button,{className:"woocommerce-filters-filter__button",onClick:this.goBack},(0,a.createElement)(y.A,{icon:v.A}),r.label)),s.map((t=>(0,a.createElement)("li",{key:t.value,className:A()("woocommerce-filters-filter__content-list-item",{"is-selected":i.value===t.value||i.path&&(0,l.includes)(i.path,t.value)})},this.renderButton(t,o,e)))))))}))}}C.propTypes={config:i().shape({label:i().string,staticParams:i().array.isRequired,param:i().string.isRequired,defaultValue:i().string,showFilters:i().func.isRequired,filters:i().arrayOf(i().shape({chartMode:i().oneOf(["item-comparison","time-comparison"]),component:i().string,label:i().string,path:i().string,subFilters:i().array,value:i().string.isRequired}))}).isRequired,path:i().string.isRequired,query:i().object,onFilterSelect:i().func},C.defaultProps={query:{},onFilterSelect:()=>{}};const k=C;class w extends s.Component{constructor(){super(),this.renderCard=this.renderCard.bind(this),this.onRangeSelect=this.onRangeSelect.bind(this)}renderCard(e){const{siteLocale:t,advancedFilters:n,query:o,path:s,onAdvancedFilterAction:r,currency:i}=this.props,{filters:c,param:d}=e;if(!o[d])return null;if(0===o[d].indexOf("compare")){const e=(0,l.find)(c,{value:o[d]});if(!e)return null;const{settings:t={}}=e;return(0,a.createElement)("div",{key:d,className:"woocommerce-filters__advanced-filters"},(0,a.createElement)(_,{path:s,query:o,...t}))}return"advanced"===o[d]?(0,a.createElement)("div",{key:d,className:"woocommerce-filters__advanced-filters"},(0,a.createElement)(m.AdvancedFilters,{siteLocale:t,currency:i,config:n,path:s,query:o,onAdvancedFilterAction:r})):void 0}onRangeSelect(e){const{query:t,path:n,onDateSelect:a}=this.props;(0,c.updateQueryString)(e,n,t),a(e)}getDateQuery(e){const{period:t,compare:n,before:a,after:o}=(0,d.getDateParamsFromQuery)(e),{primary:s,secondary:l}=(0,d.getCurrentDates)(e);return{period:t,compare:n,before:a,after:o,primaryDate:s,secondaryDate:l}}render(){const{dateQuery:e,filters:t,query:n,path:l,showDatePicker:r,onFilterSelect:i,isoDateFormat:c}=this.props;return(0,a.createElement)(s.Fragment,null,(0,a.createElement)(m.H,{className:"screen-reader-text"},(0,o.__)("Filters","woocommerce")),(0,a.createElement)(m.Section,{component:"div",className:"woocommerce-filters"},(0,a.createElement)("div",{className:"woocommerce-filters__basic-filters"},r&&(0,a.createElement)(m.DateRangeFilterPicker,{key:JSON.stringify(n),dateQuery:e||this.getDateQuery(n),onRangeSelect:this.onRangeSelect,isoDateFormat:c}),t.map((e=>e.showFilters(n)?(0,a.createElement)(k,{key:e.param,config:e,query:n,path:l,onFilterSelect:i}):null))),t.map(this.renderCard)))}}w.propTypes={siteLocale:i().string,advancedFilters:i().object,filters:i().array,path:i().string.isRequired,query:i().object,showDatePicker:i().bool,onDateSelect:i().func,onFilterSelect:i().func,onAdvancedFilterAction:i().func,currency:i().object,dateQuery:i().shape({period:i().string.isRequired,compare:i().string.isRequired,before:i().object,after:i().object,primaryDate:i().shape({label:i().string.isRequired,range:i().string.isRequired}).isRequired,secondaryDate:i().shape({label:i().string.isRequired,range:i().string.isRequired})}),isoDateFormat:i().string},w.defaultProps={siteLocale:"en_US",advancedFilters:{},filters:[],query:{},showDatePicker:!0,onDateSelect:()=>{},currency:g()().getCurrencyConfig()};const N=w},8428:(e,t,n)=>{n.d(t,{A:()=>p});var a=n(1609),o=n(6942),s=n.n(o),l=n(6087),r=n(7723),i=n(6427),c=n(8468),d=n(5573);const u=()=>(0,a.createElement)(d.SVG,{width:"8",height:"8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(d.Circle,{cx:"4",cy:"4",r:"4"}));function g({currentPage:e,numberOfPages:t,setCurrentPage:n}){return(0,a.createElement)("ul",{className:"components-guide__page-control","aria-label":(0,r.__)("Guide controls")},(0,c.times)(t,(o=>(0,a.createElement)("li",{key:o,"aria-current":o===e?"step":void 0},(0,a.createElement)(i.Button,{key:o,icon:(0,a.createElement)(u,null),"aria-label":(0,r.sprintf)(/* translators: 1: current page number 2: total number of pages */ /* translators: 1: current page number 2: total number of pages */
(0,r.__)("Page %1$d of %2$d"),o+1,t),onClick:()=>n(o)})))))}function m(e){const t=(0,l.useRef)();return(0,l.useLayoutEffect)((()=>{const{ownerDocument:e}=t.current,{activeElement:n,body:a}=e;n&&n!==a||t.current.focus()}),[]),(0,a.createElement)(i.Button,{...e,ref:t})}function p({className:e,contentLabel:t,backButtonText:n,finishButtonText:o,renderFinish:c=e=>e,onFinish:d,pages:u}){const[p,h]=(0,l.useState)(0),_=p>0,E=p<u.length-1,f=()=>{_&&h(p-1)},A=()=>{E&&h(p+1)};if(0===u.length)return null;let y=null;E||(y=c((0,a.createElement)(m,{className:"components-guide__finish-button",onClick:d},o||(0,r.__)("Finish"))));const v=s()("gla-admin-page","components-guide",e);return(0,a.createElement)(i.Modal,{className:v,contentLabel:t,onRequestClose:d},(0,a.createElement)(i.KeyboardShortcuts,{key:p,shortcuts:{left:f,right:A}}),(0,a.createElement)("div",{className:"components-guide__container"},(0,a.createElement)("div",{className:"components-guide__page"},u[p].image,u.length>1&&(0,a.createElement)(g,{currentPage:p,numberOfPages:u.length,setCurrentPage:h}),u[p].content),(0,a.createElement)("div",{className:"components-guide__footer"},_&&(0,a.createElement)(i.Button,{className:"components-guide__back-button",onClick:f},n||(0,r.__)("Previous")),E&&(0,a.createElement)(i.Button,{className:"components-guide__forward-button",onClick:A},(0,r.__)("Next")),y)))}},9452:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(1609),o=n(7723),s=n(6427),l=n(6942),r=n.n(l),i=n(6473);const c=(e,t,n)=>a=>{(0,i.ce)(e,{id:t,action:a?"expand":"collapse",context:n})};function d({trackName:e,faqItems:t,className:n,context:l}){return(0,a.createElement)(s.Panel,{className:r()("gla-faqs-panel",n),header:(0,o.__)("Frequently asked questions","google-listings-and-ads")},t.map((({trackId:t,question:n,answer:o})=>(0,a.createElement)(s.PanelBody,{key:t,title:n,initialOpen:!1,onToggle:c(e,t,l)},(0,a.createElement)(s.PanelRow,null,o)))))}},6141:(e,t,n)=>{n.d(t,{A:()=>m});var a=n(1609),o=n(7723),s=n(6087),l=n(5170),r=n(1177),i=n(2848),c=n(9457);const d=[["DZ",250,"USD"],["AR",25e3,"ARS"],["AM",300,"USD"],["AU",600,"AUD"],["AT",400,"EUR"],["AZ",300,"USD"],["BH",300,"USD"],["BY",300,"USD"],["BE",400,"EUR"],["BO",350,"USD"],["BA",350,"EUR"],["BR",1200,"BRL"],["BG",700,"BGN"],["CA",600,"CAD"],["CL",350,"USD"],["CN",3e3,"CNY"],["CO",350,"USD"],["CR",350,"USD"],["HR",2500,"HRK"],["CY",350,"EUR"],["CZ",8500,"CZK"],["DK",3e3,"DKK"],["DO",350,"USD"],["EC",350,"USD"],["EG",3e3,"EGP"],["SV",350,"USD"],["EE",350,"EUR"],["FI",400,"EUR"],["FR",400,"EUR"],["GE",300,"USD"],["DE",400,"EUR"],["GR",350,"EUR"],["GT",350,"USD"],["HN",350,"USD"],["HK",3e3,"HKD"],["HU",12e4,"HUF"],["IS",400,"EUR"],["IN",2e4,"INR"],["ID",3e6,"IDR"],["IE",400,"EUR"],["IL",1500,"ILS"],["IT",400,"EUR"],["JP",6e4,"JPY"],["JO",250,"USD"],["KZ",300,"USD"],["KE",300,"USD"],["KR",6e5,"KRW"],["KW",300,"USD"],["LV",350,"EUR"],["LB",250,"USD"],["LY",250,"USD"],["LT",350,"EUR"],["LU",400,"EUR"],["MK",300,"USD"],["MY",1500,"MYR"],["MT",350,"EUR"],["MX",7e3,"MXN"],["ME",350,"EUR"],["MA",250,"USD"],["NL",400,"EUR"],["NZ",600,"NZD"],["NI",350,"USD"],["NG",300,"USD"],["NO",4e3,"NOK"],["OM",250,"USD"],["PK",400,"USD"],["PS",250,"USD"],["PA",350,"USD"],["PY",350,"USD"],["PE",350,"USD"],["PH",2e4,"PHP"],["PL",1200,"PLN"],["PT",400,"EUR"],["PR",350,"USD"],["QA",300,"USD"],["RO",1500,"RON"],["RU",3e4,"RUB"],["SA",1300,"SAR"],["RS",350,"EUR"],["SG",600,"SGD"],["SK",350,"EUR"],["SI",350,"EUR"],["ZA",6e3,"ZAR"],["ES",400,"EUR"],["LK",400,"USD"],["SE",4e3,"SEK"],["CH",400,"CHF"],["TW",12e3,"TWD"],["TH",12e3,"THB"],["TN",250,"USD"],["TR",2500,"TRY"],["UA",1e4,"UAH"],["AE",1600,"AED"],["GB",400,"GBP"],["US",500,"USD"],["UY",350,"USD"],["VE",350,"USD"],["VN",56e5,"VND"]];var u=n(6734);const g=e=>{const t=(0,u.A)();return(0,a.createElement)(c.A,{className:"gla-free-ad-credit-country-modal",title:(0,o.__)("Check your maximum free credit","google-listings-and-ads"),...e},(0,a.createElement)("p",null,(0,o.__)("Whatever you spend in the next month will be added back to your Google Ads account as free credit, up to a maximum limit depending on your stores country.","google-listings-and-ads")),(0,a.createElement)("table",null,(0,a.createElement)("tbody",null,d.map(((e,n)=>{const[o,s,l]=e;return(0,a.createElement)("tr",{key:n},(0,a.createElement)("td",null,t[o]),(0,a.createElement)("td",null,`${s} ${l}`))})))))},m=()=>{const[e,t]=(0,s.useState)(!1);return(0,a.createElement)("div",{className:"gla-free-ad-credit"},(0,a.createElement)(l.A,null),(0,a.createElement)("div",null,(0,a.createElement)("div",{className:"gla-free-ad-credit__title"},(0,o.__)("Spend $500 to get $500 in Google Ads credits!","google-listings-and-ads")),(0,a.createElement)("div",{className:"gla-free-ad-credit__description"},(0,s.createInterpolateElement)((0,o.__)("New to Google Ads? Get $500 in ad credit when you spend $500 within your first 60 days. Check how much credit you can receive in your country <checkLink>here</checkLink>. <termLink>Terms and conditions apply</termLink>.","google-listings-and-ads"),{checkLink:(0,a.createElement)(i.A,{eventName:"gla_free_ad_credit_country_click",eventProps:{context:"setup-ads"},href:"#",type:"wp-admin",onClick:()=>{t(!0)}}),termLink:(0,a.createElement)(r.A,{context:"setup-ads",linkId:"free-ad-credit-terms",href:"https://www.google.com/ads/coupons/terms/"})})),e&&(0,a.createElement)(g,{onRequestClose:()=>{t(!1)}})))}},7343:(e,t,n)=>{n.d(t,{A:()=>ze});var a=n(1609),o=n(6087),s=n(6427),l=n(8846),r=n(8468),i=n(3741),c=n(7892),d=n(6960),u=n(6319),g=n(7723);const m=new Set(["all","selected"]),p=new Set(["automatic","flat","manual"]),h=new Set(["flat","manual"]),_=e=>e.rate>0,E=e=>!!e.some(_)&&e.some((e=>e.options.free_shipping_threshold>0));var f=n(8683),A=n(8242),y=n(8771),v=n(8864),b=n(9491),C=n(6942),k=n.n(C),w=n(8107),N=n(2224);const S=({tags:e=[],disabled:t,maxVisibleTags:n=0,onChange:s=()=>{}})=>{const[r,i]=(0,o.useState)(!1),d=Math.max(0,n),u=r||!d?e:e.slice(0,d);if(!e.length)return null;const m=n=>()=>{t||s(e.filter((e=>e.id!==n)))};return(0,a.createElement)("div",{className:"woocommerce-tree-select-control__tags"},u.map(((t,n)=>{if(!t.label)return null;const o=(0,g.sprintf)(
// translators: 1: Tag Label, 2: Current Tag index, 3: Total amount of tags.
// translators: 1: Tag Label, 2: Current Tag index, 3: Total amount of tags.
(0,g.__)("%1$s (%2$d of %3$d)","google-listings-and-ads"),t.label,n+1,e.length);return(0,a.createElement)(l.Tag,{key:t.id,id:t.id,label:t.label,screenReaderLabel:o,remove:m})})),d>0&&e.length>d&&(0,a.createElement)(c.A,{isTertiary:!0,className:"woocommerce-tree-select-control__show-more",onClick:()=>{i(!r)}},r?(0,g.__)("Show less","google-listings-and-ads"):(0,g.sprintf)(
// translators: %d: The number of extra tags to show
// translators: %d: The number of extra tags to show
(0,g.__)("+ %d more","google-listings-and-ads"),e.length-d)))},x="__WC_TREE_SELECT_COMPONENT_ROOT__",R="ArrowUp",T="ArrowDown",I=(0,o.forwardRef)((({tags:e=[],instanceId:t,placeholder:n,isExpanded:o,disabled:s,maxVisibleTags:l,value:i="",onFocus:c=()=>{},onTagsChange:d=()=>{},onInputChange:u=()=>{},onControlClick:g=r.noop},m)=>{const p=e.length>0,h=!p&&!o;return(0,a.createElement)("div",{className:k()("components-base-control","woocommerce-tree-select-control__control",{"is-disabled":s,"has-tags":p}),onClick:e=>{m.current.focus(),g(e)}},p&&(0,a.createElement)(S,{disabled:s,tags:e,maxVisibleTags:l,onChange:d}),(0,a.createElement)("div",{className:"components-base-control__field"},(0,a.createElement)("input",{ref:m,id:`woocommerce-tree-select-control-${t}__control-input`,type:"search",placeholder:h?n:"",autoComplete:"off",className:"woocommerce-tree-select-control__control-input",role:"combobox","aria-autocomplete":"list",value:i,"aria-expanded":o,disabled:s,onFocus:c,onChange:u,onKeyDown:t=>{if("Backspace"===t.key){if(i)return;d(e.slice(0,-1)),t.preventDefault()}}})))}));var G=n(7677),F=n(3756),P=n(2485),M=n(8351);const O=({option:e,checked:t,className:n,...o})=>{var s,l;return e?(0,a.createElement)("div",{className:n},(0,a.createElement)("div",{className:"components-base-control__field"},(0,a.createElement)("span",{className:"components-checkbox-control__input-container"},(0,a.createElement)("input",{id:`inspector-checkbox-control-${null!==(s=e.key)&&void 0!==s?s:e.value}`,className:"components-checkbox-control__input",type:"checkbox",tabIndex:"-1",value:e.value,checked:t,...o}),t&&(0,a.createElement)(G.A,{icon:M.A,role:"presentation",className:"components-checkbox-control__checked"})),(0,a.createElement)("label",{className:"components-checkbox-control__label",htmlFor:`inspector-checkbox-control-${null!==(l=e.key)&&void 0!==l?l:e.value}`},e.label))):null},D=({options:e=[],onChange:t=()=>{},onExpanderClick:n=r.noop,onToggleExpanded:o=r.noop})=>e.map((e=>{var l;const r=e.value===x,{hasChildren:i,checked:c,partialChecked:d,expanded:u}=e;return(0,a.createElement)("div",{key:`${null!==(l=e.key)&&void 0!==l?l:e.value}`,role:i?"treegroup":"treeitem","aria-expanded":i?u:void 0,className:k()("woocommerce-tree-select-control__node",i&&"has-children")},(0,a.createElement)(s.Flex,{justify:"flex-start"},!r&&(0,a.createElement)("button",{className:k()("woocommerce-tree-select-control__expander",!i&&"is-hidden"),tabIndex:"-1",onClick:t=>{n(t),o(e)}},(0,a.createElement)(G.A,{icon:u?F.A:P.A})),(0,a.createElement)(O,{className:k()("components-base-control","woocommerce-tree-select-control__option",d&&"is-partially-checked"),option:e,checked:c,onChange:n=>{t(n.target.checked,e)},onKeyDown:t=>{((e,t)=>{t.hasChildren&&("ArrowRight"!==e.key||t.expanded?"ArrowLeft"===e.key&&t.expanded&&o(t):o(t))})(t,e)}})),i&&u&&(0,a.createElement)("div",{className:k()("woocommerce-tree-select-control__children",r&&"woocommerce-tree-select-control__main")},(0,a.createElement)(D,{options:e.children,onChange:t,onExpanderClick:n,onToggleExpanded:o})))})),U=D,L=({id:e,label:t,selectAllLabel:n=(0,g.__)("All","google-listings-and-ads"),help:s,placeholder:l,className:i,disabled:c,options:d=[],value:u=[],maxVisibleTags:m,onChange:p=()=>{},onDropdownVisibilityChange:h=r.noop})=>{let _=(0,b.useInstanceId)(L);_=null!=e?e:_;const[E,f]=(0,o.useState)(!1),[A,y]=(0,o.useState)([]),[v,C]=(0,o.useState)(""),S=(0,o.useRef)(),G=(0,o.useRef)(),F=(0,o.useRef)();F.current=h;const P=(0,o.useRef)({filteredOptionsMap:new Map});P.current.expandedValues=A,P.current.selectedValues=u;const M=!c&&E,O=!1!==n?{label:n,value:x,children:d}:null,D=(0,N.A)(O?[O]:d),q=(0,b.__experimentalUseFocusOutside)((()=>{f(!1)})),B=v.trim().toLowerCase(),$=B.length>=3?B:"",V=(0,o.useMemo)((()=>{const e={};return P.current.filteredOptionsMap.clear(),D.forEach((function t(n,a){const{children:o=[]}=n;var s;n.parent=a,o.forEach((e=>t(e,n.value))),o.length||(e[null!==(s=n.key)&&void 0!==s?s:n.value]=n)})),e}),[D]),j=(0,o.useMemo)((()=>{const{current:e}=P,t=e.filteredOptionsMap.get($);if(t)return t;const n=Boolean($),o={hasChildren:{get(){return this.children?.length>0}},leaves:{get(){return this.hasChildren?this.children.flatMap((e=>e.hasChildren?e.leaves:e)):[]}},checked:{get(){return this.hasChildren?this.leaves.every((e=>e.checked)):e.selectedValues.includes(this.value)}},partialChecked:{get(){return!!this.hasChildren&&!this.checked&&this.leaves.some((e=>e.checked||e.partialChecked))}},expanded:{get(){return n||this.value===x||e.expandedValues.includes(this.value)}}},s=(e,{children:t=[],...l})=>{if(t.length){if(l.children=t.reduce(s,[]),!l.children.length)return e}else if(n){const t=l.label.toLowerCase().indexOf($);if(-1===t)return e;l.label=((e,t)=>{const o=t+$.length;return n?(0,a.createElement)("span",null,(0,a.createElement)("span",null,e.substring(0,t)),(0,a.createElement)("strong",null,e.substring(t,o)),(0,a.createElement)("span",null,e.substring(o))):e})(l.label,t)}return Object.defineProperties(l,o),e.push(l),e},l=D.reduce(s,[]);return e.filteredOptionsMap.set($,l),l}),[D,$]);(0,o.useEffect)((()=>{F.current(M)}),[M]);const W=e=>{y(e.expanded?A.filter((t=>e.value!==t)):[...A,e.value])};return(0,a.createElement)("div",{...q,onKeyDown:e=>{if(c)return;"Escape"===e.key&&f(!1),"Enter"===e.key&&(f(!0),e.preventDefault());const t={[R]:-1,[T]:1}[e.key];if(t&&G.current&&j.length){const n=w.focus.focusable.find(G.current).filter((e=>"checkbox"===e.type)),a=n.indexOf(e.target),o=Math.max(a+t,-1)%n.length;n.at(o).focus(),e.preventDefault()}},className:k()("woocommerce-tree-select-control",i)},!!t&&(0,a.createElement)("label",{htmlFor:`woocommerce-tree-select-control-${_}__control-input`,className:"woocommerce-tree-select-control__label"},t),(0,a.createElement)(I,{ref:S,disabled:c,tags:d.length?u.map((e=>{const t=V[e];return{id:e,label:t?.label}})):[],isExpanded:M,onFocus:()=>{f(!0)},onControlClick:()=>{c||f(!0)},instanceId:_,placeholder:l,label:t,maxVisibleTags:m,value:v,onTagsChange:e=>{p([...e.map((e=>e.id))])},onInputChange:e=>{C(e.target.value)}}),M&&(0,a.createElement)("div",{ref:G,className:"woocommerce-tree-select-control__tree",role:"tree",tabIndex:"-1"},(0,a.createElement)(U,{options:j,onChange:(e,t)=>{t.hasChildren?((e,t)=>{let n;const a=t.leaves.filter((t=>t.checked!==e)).map((e=>e.value));e?(t.expanded||W(t),n=u.concat(a)):n=u.filter((e=>!a.includes(e))),p(n)})(e,t):((e,t)=>{const n=e?[...u,t.value]:u.filter((e=>e!==t.value));p(n)})(e,t),C(""),A.includes(t.parent)||S.current.focus()},onExpanderClick:e=>{const t=w.focus.focusable.find(G.current),n=t.indexOf(e.currentTarget)+1;t.at(n).focus()},onToggleExpanded:W})),s&&(0,a.createElement)("div",{className:"woocommerce-tree-select-control__help"},s))},q=L;var B=n(9415);const $=[];function V({countryCodes:e,className:t,...n}){const s=(0,b.useViewportMatch)("medium","<")?5:10,l=function(e){const{data:{countries:t,continents:n},hasFinishedResolution:a}=(0,B.A)("getMCCountriesAndContinents");return(0,o.useMemo)((()=>{if(!a)return $;const o=e||Object.keys(t);return Object.entries(n).reduce(((e,[n,a])=>{const s=a.countries.reduce(((e,n)=>(o.includes(n)&&e.push({value:n,label:t[n].name}),e)),[]);return s.length&&e.push({value:n,label:a.name,children:s}),e}),[])}),[e,t,n,a])}(e);return(0,a.createElement)(q,{className:k()("gla-supported-country-select",t),placeholder:(0,g.__)("Start typing to filter countries…","google-listings-and-ads"),selectAllLabel:(0,g.__)("All countries","google-listings-and-ads"),maxVisibleTags:s,options:l,...n})}var j=n(850);const W=()=>{const{getInputProps:e,adapter:{renderRequestedValidation:t}}=(0,d.h5)();return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(A.A,{className:"gla-choose-audience-section",title:(0,g.__)("Audience","google-listings-and-ads"),description:(0,a.createElement)("p",null,(0,g.__)("Where do you want to sell your products?","google-listings-and-ads"))},(0,a.createElement)(A.A.Card,null,(0,a.createElement)(A.A.Card.Body,null,(0,a.createElement)(y.A,null,(0,a.createElement)(y.A.Title,null,(0,g.__)("Location","google-listings-and-ads")),(0,a.createElement)(y.A.HelperText,null,(0,g.__)("Your store should already have the appropriate shipping and tax rates (if required) for potential customers in your selected location(s).","google-listings-and-ads")),(0,a.createElement)(j.A,{size:"medium"},(0,a.createElement)(f.A,{...e("location"),collapsible:!0,label:(0,g.__)("Selected countries only","google-listings-and-ads"),value:"selected"},(0,a.createElement)(V,{multiple:!0,...e("countries"),help:(0,g.__)("Cant find a country? Only supported countries can be selected.","google-listings-and-ads")}),t("countries")),(0,a.createElement)(f.A,{...e("location"),label:(0,g.__)("All countries","google-listings-and-ads"),value:"all"},(0,a.createElement)(v.A,null,(0,g.__)("Your listings will be shown in all supported countries.","google-listings-and-ads")))))))))};var z=n(1177),Y=n(4978),H=n(6494),Q=n(3772);var K=n(5588);const J=e=>{const t={};return 0===e.countries.length&&(t.countries=(0,g.__)("Please specify at least one country.","google-listings-and-ads")),Number.isFinite(e.rate)||(t.rate=(0,g.__)("Please enter the estimated shipping rate.","google-listings-and-ads")),e.rate<0&&(t.rate=(0,g.__)("The estimated shipping rate cannot be less than 0.","google-listings-and-ads")),t};var Z=n(9457);const X=({countryOptions:e,initialValues:t,renderButtons:n=r.noop,onSubmit:s,onRequestClose:i})=>{const[c,d]=(0,o.useState)(!1);return(0,a.createElement)(l.Form,{initialValues:t,validate:J,onSubmit:s},(t=>{const{values:o,getInputProps:s}=t;return(0,a.createElement)(Z.A,{overflow:"visible",shouldCloseOnEsc:!c,shouldCloseOnClickOutside:!c,title:(0,g.__)("Estimate a shipping rate","google-listings-and-ads"),buttons:n(t),onRequestClose:i},(0,a.createElement)(j.A,null,(0,a.createElement)(V,{label:(0,g.__)("If customer is in","google-listings-and-ads"),countryCodes:e,onDropdownVisibilityChange:d,...s("countries")}),(0,a.createElement)(K.A,{label:(0,g.__)("Then the estimated shipping rate displayed in the product listing is","google-listings-and-ads"),suffix:o.currency,...s("rate")})))}))},ee=({countryOptions:e,initialValues:t,onSubmit:n,onRequestClose:o=r.noop})=>(0,a.createElement)(X,{countryOptions:e,initialValues:t,renderButtons:e=>{const{isValidForm:t,handleSubmit:n}=e;return[(0,a.createElement)(c.A,{key:"submit",isPrimary:!0,disabled:!t,onClick:()=>{o(),n()}},(0,g.__)("Add shipping rate","google-listings-and-ads"))]},onSubmit:n,onRequestClose:o}),te=({countryOptions:e,initialValues:t,onSubmit:n,onRequestClose:o=r.noop,onDelete:s=r.noop})=>{const l=()=>{o(),s()};return(0,a.createElement)(X,{countryOptions:e,initialValues:t,renderButtons:e=>{const{isValidForm:t,handleSubmit:n}=e;return[(0,a.createElement)(c.A,{key:"delete",isTertiary:!0,isDestructive:!0,onClick:l},(0,g.__)("Delete","google-listings-and-ads")),(0,a.createElement)(c.A,{key:"submit",isPrimary:!0,disabled:!t,onClick:()=>{o(),n()}},(0,g.__)("Update shipping rate","google-listings-and-ads"))]},onSubmit:n,onRequestClose:o})};var ne=n(6734);const ae=5,oe=e=>{const{countries:t,firstN:n=ae,textWithMore:s,textWithoutMore:l}=e,r=(0,ne.A)(),i=t.slice(0,n).map((e=>r[e])),c=t.length>i.length?s:l;return(0,o.createInterpolateElement)((0,g.sprintf)(c,i.join(", "),t.length-i.length),{strong:(0,a.createElement)("strong",null)})},se=e=>{const{countries:t}=e;return(0,a.createElement)("div",null,(0,a.createElement)(oe,{countries:t,textWithMore:
// translators: 1: list of country names separated by comma, up to 5 countries; 2: the remaining count of countries.
// translators: 1: list of country names separated by comma, up to 5 countries; 2: the remaining count of countries.
(0,g.__)("Shipping rate for <strong>%1$s</strong> + %2$d more","google-listings-and-ads"),textWithoutMore:
// translators: 1: list of country names separated by comma.
// translators: 1: list of country names separated by comma.
(0,g.__)("Shipping rate for <strong>%1$s</strong>","google-listings-and-ads")}))},le=({countryOptions:e,value:t,onChange:n,onDelete:o})=>{const{countries:s,currency:r,rate:i}=t;return(0,a.createElement)("div",{className:"gla-shipping-rate-input-control"},(0,a.createElement)(K.A,{label:(0,a.createElement)("div",{className:"label"},(0,a.createElement)(se,{countries:s}),(0,a.createElement)(H.A,{button:(0,a.createElement)(c.A,{isTertiary:!0},(0,g.__)("Edit","google-listings-and-ads")),modal:(0,a.createElement)(te,{countryOptions:e,initialValues:t,onSubmit:n,onDelete:o})})),suffix:r,value:i,onBlur:(e,a)=>{i!==a&&n({...t,rate:a})}}),0===i&&(0,a.createElement)("div",{className:"gla-input-pill-div"},(0,a.createElement)(l.Pill,null,(0,g.__)("Free shipping for all orders","google-listings-and-ads"))))},re={options:{}};function ie({audienceCountries:e,value:t,helper:n,onChange:o}){const{code:s}=(0,Q.A)(),{handleAddSubmit:l,getChangeHandler:r,getDeleteHandler:i}=(({value:e,onChange:t})=>({handleAddSubmit:({countries:n,currency:a,rate:o})=>{const s=n.map((e=>({...re,country:e,currency:a,rate:o})));t(e.concat(s))},getChangeHandler:n=>a=>{const o=e.filter((e=>!(n.countries.includes(e.country)&&!a.countries.includes(e.country))));a.countries.forEach((e=>{const t=o.findIndex((t=>t.country===e)),n=o[t],s={...re,...n,country:e,currency:a.currency,rate:a.rate};_(s)||(s.options.free_shipping_threshold=void 0),t>=0?o[t]=s:o.push(s)})),t(o)},getDeleteHandler:n=>()=>{const a=e.filter((e=>!n.countries.includes(e.country)));t(a)}}))({value:t,onChange:o});return(0,a.createElement)(A.A.Card,null,(0,a.createElement)(A.A.Card.Body,null,(0,a.createElement)(A.A.Card.Title,null,(0,g.__)("Estimated shipping rates","google-listings-and-ads")),(0,a.createElement)(j.A,{size:"large"},(()=>{const n=(e=>{const t=new Map;return e.forEach((e=>{const{country:n,currency:a,rate:o}=e,s=`${a} ${o} `,l=t.get(s)||{countries:[],currency:a,rate:o};l.countries.push(n),t.set(s,l)})),Array.from(t.values())})(t);if(0===n.length){const t={countries:e,currency:s,rate:void 0};return(0,a.createElement)(le,{countryOptions:e,value:t,onChange:r(t),onDelete:i(t)})}const o=e.filter((e=>!t.some((t=>t.country===e))));return(0,a.createElement)(a.Fragment,null,n.map((t=>(0,a.createElement)(le,{key:t.countries.join("-"),countryOptions:e,value:t,onChange:r(t),onDelete:i(t)}))),o.length>=1&&(0,a.createElement)("div",null,(0,a.createElement)(H.A,{button:(0,a.createElement)(c.A,{isSecondary:!0,icon:(0,a.createElement)(Y.A,null)},(0,g.__)("Add another rate","google-listings-and-ads")),modal:(0,a.createElement)(ee,{countryOptions:o,initialValues:{countries:o,currency:s,rate:0},onSubmit:l})})))})()),n))}const ce=()=>{const{adapter:e}=(0,d.h5)(),t=(0,d.Gl)("shipping_country_rates");return(0,a.createElement)(ie,{audienceCountries:e.audienceCountries,...t})};var de=n(873),ue=n(3027);const ge=()=>{const{getInputProps:e,values:t}=(0,d.h5)(),{settings:n}=(0,de.A)(),{hasFinishedResolution:s,data:l}=(0,ue.A)(),r=e("shipping_rate"),i=!n?.shipping_rates_count&&s&&"incomplete"===l?.status;return(0,a.createElement)(A.A,{title:(0,g.__)("Shipping rates","google-listings-and-ads"),description:(0,a.createElement)("div",null,(0,a.createElement)("p",null,(0,g.__)("Your estimated shipping rates and times will be shown to potential customers on Google.","google-listings-and-ads")),(0,a.createElement)("p",null,(0,a.createElement)(z.A,{context:"setup-mc-shipping",linkId:"shipping-read-more",href:"https://support.google.com/merchants/answer/7050921"},(0,g.__)("Read more","google-listings-and-ads"))))},(0,a.createElement)(A.A.Card,null,(0,a.createElement)(A.A.Card.Body,null,(0,a.createElement)(j.A,{size:"large"},!i&&(0,a.createElement)(f.A,{...r,label:(0,g.__)("Automatically sync my stores shipping settings to Google.","google-listings-and-ads"),value:"automatic",collapsible:!0},(0,a.createElement)(v.A,null,(0,g.__)("My current settings and any future changes to my stores shipping rates and classes will be automatically synced to Google Merchant Center.","google-listings-and-ads"))),(0,a.createElement)(f.A,{...r,label:(0,g.__)("My shipping settings are simple. I can manually estimate flat shipping rates.","google-listings-and-ads"),value:"flat",collapsible:!0}),(0,a.createElement)(f.A,{...r,label:(0,g.__)("My shipping settings are complex. I will enter my shipping rates and times manually in Google Merchant Center.","google-listings-and-ads"),value:"manual",collapsible:!0},(0,a.createElement)(v.A,null,(0,o.createInterpolateElement)((0,g.__)("I understand that if I dont set this up manually in <link>Google Merchant Center</link>, my products will be disapproved by Google.","google-listings-and-ads"),{link:(0,a.createElement)(z.A,{context:"setup-mc-shipping",linkId:"shipping-manual",href:"https://www.google.com/retail/solutions/merchant-center/"})})))))),"flat"===t.shipping_rate&&(0,a.createElement)(ce,null))},me=e=>{const t={};return 0===e.countries.length&&(t.countries=(0,g.__)("Please specify at least one country.","google-listings-and-ads")),Number.isInteger(e.time)||(t.time=(0,g.__)("Please enter the estimated shipping time.","google-listings-and-ads")),(e.time<0||e.maxTime<0)&&(t.time=(0,g.__)("The estimated shipping time cannot be less than 0.","google-listings-and-ads")),e.time>e.maxTime&&(t.time=(0,g.__)("The minimum shipping time must not be more than the maximum shipping time.","google-listings-and-ads")),t};var pe=n(5095),he=n(4596),_e=n(6499);const Ee=({step:e=1,min:t=0,max:n=250,time:l,handleBlur:r,handleIncrement:i,field:c="time"})=>{const[d,u]=(0,o.useState)(l),m=(0,o.useRef)(null);function p(e){const a=parseFloat(d||0)+e;a>=t&&a<=n&&(u(a),m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{i(a,c)}),600))}return(0,o.useEffect)((()=>{u(0===l?"":l)}),[l]),(0,a.createElement)(_e.A,{step:e,placeholder:null===l?"":(0,g.__)("Same Day","google-listings-and-ads"),suffix:(0,a.createElement)(a.Fragment,null,parseInt(d,10)>=1&&(0,a.createElement)("span",{className:"gla-countries-time-suffix"},(0,g._n)("day","days",parseInt(d,10),"google-listings-and-ads")),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(s.Button,{className:"woocommerce-number-control__increment",icon:pe.A,size:"small",onMouseDown:()=>p(e),"aria-label":(0,g.__)("Increment","google-listings-and-ads"),tabIndex:-1}),(0,a.createElement)(s.Button,{icon:he.A,className:"woocommerce-number-control__decrement",size:"small",onMouseDown:()=>p(-e),"aria-label":(0,g.__)("Decrement","google-listings-and-ads"),tabIndex:-1}))),value:d,onBlur:(e,a)=>{a>=t&&a<=n&&r(a,c)},className:"gla-countries-time-stepper"})},fe=({handleBlur:e,handleIncrement:t,time:n,maxTime:o})=>(0,a.createElement)(s.Flex,{justify:"space-between",gap:"4"},(0,a.createElement)(s.FlexItem,null,(0,a.createElement)("div",{className:"gla-countries-time-input"},(0,a.createElement)(Ee,{handleBlur:e,time:n,handleIncrement:t,field:"time"}))),(0,a.createElement)(s.FlexItem,null,(0,a.createElement)("span",null,(0,g.__)("to","google-listings-and-ads"))),(0,a.createElement)(s.FlexItem,null,(0,a.createElement)("div",{className:"gla-countries-time-input"},(0,a.createElement)(Ee,{handleBlur:e,handleIncrement:t,time:o,field:"maxTime"})))),Ae=({countries:e,onRequestClose:t,onSubmit:n})=>{const[r,i]=(0,o.useState)(!1);return(0,a.createElement)(l.Form,{initialValues:{countries:e,time:0,maxTime:0},validate:me,onSubmit:e=>{n(e),t()}},(n=>{const{getInputProps:o,isValidForm:l,handleSubmit:d,errors:u}=n,m=(e,t)=>{o(t).onChange(e)};return(0,a.createElement)(Z.A,{overflow:"visible",shouldCloseOnEsc:!r,shouldCloseOnClickOutside:!r,title:(0,g.__)("Estimate shipping time","google-listings-and-ads"),buttons:[(0,a.createElement)(c.A,{key:"save",isPrimary:!0,disabled:!l,onClick:d},(0,g.__)("Add shipping time","google-listings-and-ads"))],onRequestClose:t},(0,a.createElement)(j.A,null,(0,a.createElement)(V,{label:(0,g.__)("If customer is in","google-listings-and-ads"),countryCodes:e,onDropdownVisibilityChange:i,...o("countries")}),(0,a.createElement)("div",{className:"label"},(0,g.__)("Then the estimated shipping times displayed in the product listing are:","google-listings-and-ads")),(0,a.createElement)(s.Flex,{direction:"column",className:"gla-countries-time-input-container"},(0,a.createElement)(s.FlexItem,null,(0,a.createElement)(fe,{time:o("time").value,maxTime:o("maxTime").value,handleBlur:m,handleIncrement:m}),(0,a.createElement)("ul",{className:"gla-validation-errors"},(0,a.createElement)("li",null,u.time))))))}))},ye=e=>{const[t,n]=(0,o.useState)(!1);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.A,{isSecondary:!0,icon:(0,a.createElement)(Y.A,null),onClick:()=>{n(!0)}},(0,g.__)("Add another time","google-listings-and-ads")),t&&(0,a.createElement)(Ae,{onRequestClose:()=>{n(!1)},...e}))},ve=e=>{const{countries:t}=e;return(0,a.createElement)("div",null,(0,a.createElement)(oe,{countries:t,textWithMore:
// translators: 1: list of country names separated by comma, up to 5 countries; 2: the remaining count of countries.
// translators: 1: list of country names separated by comma, up to 5 countries; 2: the remaining count of countries.
(0,g.__)("Shipping time for <strong>%1$s</strong> + %2$d more","google-listings-and-ads"),textWithoutMore:
// translators: 1: list of country names separated by comma.
// translators: 1: list of country names separated by comma.
(0,g.__)("Shipping time for <strong>%1$s</strong>","google-listings-and-ads")}))},be=({audienceCountries:e,time:t,onDelete:n,onSubmit:r,onRequestClose:i})=>{const[d,u]=(0,o.useState)(!1),m=Array.from(new Set([...t.countries,...e])),p=()=>{n(t.countries)};return(0,a.createElement)(l.Form,{initialValues:{countries:t.countries,time:t.time,maxTime:t.maxTime},validate:me,onSubmit:e=>{const n=new Set(e.countries),a=t.countries.filter((e=>!n.has(e)));r(e,a)}},(e=>{const{getInputProps:t,isValidForm:n,handleSubmit:o,errors:l}=e,r=(e,n)=>{t(n).onChange(e)};return(0,a.createElement)(Z.A,{overflow:"visible",shouldCloseOnEsc:!d,shouldCloseOnClickOutside:!d,title:(0,g.__)("Estimate shipping time","google-listings-and-ads"),buttons:[(0,a.createElement)(c.A,{key:"delete",isTertiary:!0,isDestructive:!0,onClick:p},(0,g.__)("Delete","google-listings-and-ads")),(0,a.createElement)(c.A,{key:"save",isPrimary:!0,disabled:!n,onClick:o},(0,g.__)("Update shipping time","google-listings-and-ads"))],onRequestClose:i},(0,a.createElement)(j.A,null,(0,a.createElement)(V,{label:(0,g.__)("If customer is in","google-listings-and-ads"),countryCodes:m,onDropdownVisibilityChange:u,...t("countries")}),(0,a.createElement)("div",{className:"label"},(0,g.__)("Then the estimated shipping times displayed in the product listing are","google-listings-and-ads")),(0,a.createElement)(s.Flex,{direction:"column",className:"gla-countries-time-input-container"},(0,a.createElement)(s.FlexItem,null,(0,a.createElement)(fe,{time:t("time").value,maxTime:t("maxTime").value,handleBlur:r,handleIncrement:r}),(0,a.createElement)("ul",{className:"gla-validation-errors"},(0,a.createElement)("li",null,l.time))))))}))},Ce=({audienceCountries:e,time:t,onChange:n,onDelete:s})=>{const[l,r]=(0,o.useState)(!1);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.A,{className:"gla-edit-time-button",isTertiary:!0,onClick:()=>{r(!0)}},(0,g.__)("Edit","google-listings-and-ads")),l&&(0,a.createElement)(be,{audienceCountries:e,time:t,onSubmit:(...e)=>{n(...e),r(!1)},onDelete:e=>{s(e),r(!1)},onRequestClose:()=>{r(!1)}}))},ke=({value:e,audienceCountries:t,onChange:n,onDelete:o})=>{const{countries:l,time:r,maxTime:c}=e;return t?(0,a.createElement)(s.Flex,{direction:"column",className:"gla-countries-time-input-container"},(0,a.createElement)(s.FlexItem,null,(0,a.createElement)("div",{className:"label"},(0,a.createElement)(ve,{countries:l}),(0,a.createElement)(Ce,{audienceCountries:t,onChange:n,onDelete:o,time:e}))),(0,a.createElement)(s.FlexItem,null,(0,a.createElement)(fe,{time:r,maxTime:c,handleBlur:(t,a)=>{e[a]!==t&&n({...e,[a]:t})},handleIncrement:(t,a)=>{n({...e,[a]:t})}}))):(0,a.createElement)(i.A,null)};var we=n(172);function Ne({value:e,audienceCountries:t,onChange:n}){const o=e.length,s=new Map(e.map((e=>[e.countryCode,e]))),l=t.filter((e=>!s.has(e))),r=l.length,i=(0,we.A)(e);function c(t){n(e.filter((e=>!t.includes(e.countryCode))))}function d({countries:e,time:t,maxTime:a},o=[]){o.forEach((e=>s.delete(e))),e.forEach((e=>{s.set(e,{countryCode:e,time:t,maxTime:a})})),n(Array.from(s.values()))}return 0===i.length&&i.push({countries:t,time:null,maxTime:null}),(0,a.createElement)("div",{className:"countries-time"},(0,a.createElement)(j.A,null,i.map((e=>(0,a.createElement)("div",{key:e.countries.join("-"),className:"countries-time-input-form"},(0,a.createElement)(ke,{value:e,audienceCountries:t,onChange:d,onDelete:c})))),o>=1&&r>=1&&(0,a.createElement)("div",{className:"add-time-button"},(0,a.createElement)(ye,{countries:l,onSubmit:function({countries:t,time:a,maxTime:o}){const s=t.map((e=>({countryCode:e,time:a,maxTime:o})));n(e.concat(s))}}))))}const Se=()=>{const{getInputProps:e,adapter:{audienceCountries:t,renderRequestedValidation:n}}=(0,d.h5)();return t?(0,a.createElement)(A.A.Card,null,(0,a.createElement)(A.A.Card.Body,null,(0,a.createElement)(A.A.Card.Title,null,(0,g.__)("Estimated shipping times","google-listings-and-ads")),(0,a.createElement)(Ne,{...e("shipping_country_times"),audienceCountries:t}),n("shipping_country_times"))):(0,a.createElement)(i.A,null)},xe=()=>(0,a.createElement)(A.A,{title:(0,g.__)("Shipping times","google-listings-and-ads"),description:(0,a.createElement)("div",null,(0,a.createElement)("p",null,(0,g.__)("Your shipping times will be shown to potential customers on Google.","google-listings-and-ads")),(0,a.createElement)("p",null,(0,a.createElement)(z.A,{context:"setup-mc-shipping",linkId:"shipping-read-more",href:"https://support.google.com/merchants/answer/7050921"},(0,g.__)("Read more","google-listings-and-ads"))))},(0,a.createElement)(Se,null)),Re=({value:e,onChange:t})=>(0,a.createElement)(s.CheckboxControl,{label:(0,g.__)("Free shipping over a specific order value","google-listings-and-ads"),checked:e,onChange:t}),Te=e=>{const t={};return 0===e.countries.length&&(t.countries=(0,g.__)("Please specify at least one country.","google-listings-and-ads")),e.threshold>0||(t.threshold=(0,g.__)("The minimum order amount must be greater than 0.","google-listings-and-ads")),t},Ie=({countryOptions:e,renderButtons:t,initialValues:n,onSubmit:s,onRequestClose:r})=>{const[i,c]=(0,o.useState)(!1);return(0,a.createElement)(l.Form,{initialValues:n,validate:Te,onSubmit:s},(n=>{const{getInputProps:o,values:s,setValue:l}=n;return(0,a.createElement)(Z.A,{overflow:"visible",shouldCloseOnEsc:!i,shouldCloseOnClickOutside:!i,title:(0,g.__)("Minimum order to qualify for free shipping","google-listings-and-ads"),buttons:t(n),onRequestClose:r},(0,a.createElement)(j.A,null,(0,a.createElement)(V,{label:(0,g.__)("If customer is in","google-listings-and-ads"),countryCodes:e,onDropdownVisibilityChange:c,...o("countries")}),(0,a.createElement)(K.A,{label:(0,g.__)("Then they qualify for free shipping if their order is over","google-listings-and-ads"),suffix:s.currency,...o("threshold"),onBlur:(e,t)=>{o("threshold").onBlur(e),l("threshold",t>0?t:void 0)}})))}))},Ge=({countryOptions:e,initialValues:t,onSubmit:n,onRequestClose:o})=>(0,a.createElement)(Ie,{countryOptions:e,initialValues:t,renderButtons:e=>{const{isValidForm:t,handleSubmit:n}=e;return[(0,a.createElement)(c.A,{key:"save",isPrimary:!0,disabled:!t,onClick:()=>{o(),n()}},(0,g.__)("Add minimum order","google-listings-and-ads"))]},onSubmit:n,onRequestClose:o}),Fe=({countryOptions:e,initialValues:t,onSubmit:n,onRequestClose:o,onDelete:s})=>{const l=()=>{o(),s()};return(0,a.createElement)(Ie,{countryOptions:e,initialValues:t,renderButtons:e=>{const{isValidForm:t,handleSubmit:n}=e;return[(0,a.createElement)(c.A,{key:"delete",isTertiary:!0,isDestructive:!0,onClick:l},(0,g.__)("Delete","google-listings-and-ads")),(0,a.createElement)(c.A,{key:"save",isPrimary:!0,disabled:!t,onClick:()=>{o(),n()}},(0,g.__)("Update minimum order","google-listings-and-ads"))]},onSubmit:n,onRequestClose:o})},Pe=e=>{const{countries:t}=e;return(0,a.createElement)("div",null,(0,a.createElement)(oe,{countries:t,textWithMore:
// translators: 1: list of country names separated by comma, up to 5 countries; 2: the remaining count of countries.
// translators: 1: list of country names separated by comma, up to 5 countries; 2: the remaining count of countries.
(0,g.__)("Minimum order for <strong>%1$s</strong> + %2$d more","google-listings-and-ads"),textWithoutMore:
// translators: 1: list of country names separated by comma.
// translators: 1: list of country names separated by comma.
(0,g.__)("Minimum order for <strong>%1$s</strong>","google-listings-and-ads")}))},Me=e=>{const{countryOptions:t,value:n,onChange:o,onDelete:s}=e,{countries:l,threshold:r,currency:i}=n,{values:u}=(0,d.h5)();return u.offer_free_shipping?(0,a.createElement)(K.A,{className:"gla-minimum-order-input-control",label:(0,a.createElement)("div",{className:"gla-minimum-order-input-control__label"},(0,a.createElement)("div",{className:"gla-minimum-order-input-control__label_country"},(0,a.createElement)(Pe,{countries:l}),(0,a.createElement)(H.A,{button:(0,a.createElement)(c.A,{isTertiary:!0},(0,g.__)("Edit","google-listings-and-ads")),modal:(0,a.createElement)(Fe,{countryOptions:t,initialValues:n,onSubmit:o,onDelete:s})})),(0,a.createElement)(a.Fragment,null,`Cost (${i})`)),value:r,onBlur:(e,t)=>{t!==n.threshold&&o({countries:l,threshold:t>0?t:void 0,currency:i})}}):null},Oe=(e,t,n)=>e.map((e=>{const a={...e,options:{...e.options}};return n?.countries.includes(a.country)?a.options.free_shipping_threshold=n.threshold:t?.countries.includes(a.country)&&(a.options.free_shipping_threshold=void 0),a})),De=({value:e=[],helper:t,onChange:n})=>{const o=(0,d.Gl)("offer_free_shipping");return(0,a.createElement)(A.A.Card,{className:"gla-minimum-order-card"},(0,a.createElement)(A.A.Card.Body,null,(0,a.createElement)(A.A.Card.Title,null,(0,g.__)("Only select if applicable","google-listings-and-ads")),(0,a.createElement)(j.A,{size:"large"},(0,a.createElement)(Re,{...o}),(()=>{const t=e.filter(_),o=(e=>{const t=new Map;return e.forEach((e=>{const{options:{free_shipping_threshold:n},currency:a}=e,o=`${n} ${a}`,s=t.get(o)||{countries:[],threshold:n,currency:a};s.countries.push(e.country),t.set(o,s)})),Array.from(t.values())})(t),s=t.map((e=>e.country)),l=t=>a=>{n(Oe(e,t,a))},r=t=>()=>{n(Oe(e,t))};if(1===o.length)return(0,a.createElement)(Me,{countryOptions:s,value:o[0],onChange:l(o[0]),onDelete:r(o[0])});const i=o.filter((e=>void 0!==e.threshold)),d=o.find((e=>void 0===e.threshold));return(0,a.createElement)(a.Fragment,null,i.map((e=>(0,a.createElement)(Me,{key:e.countries.join("-"),countryOptions:s,value:e,onChange:l(e),onDelete:r(e)}))),d&&(0,a.createElement)("div",null,(0,a.createElement)(H.A,{button:(0,a.createElement)(c.A,{isSecondary:!0,icon:(0,a.createElement)(Y.A,null)},(0,g.__)("Add another condition","google-listings-and-ads")),modal:(0,a.createElement)(Ge,{countryOptions:d.countries,initialValues:d,onSubmit:t=>{n(Oe(e,null,t))}})})))})()),t))},Ue=()=>{const e=(0,d.Gl)("shipping_country_rates","free_shipping_threshold");return(0,a.createElement)(A.A,{title:(0,g.__)("Order value condition","google-listings-and-ads"),description:(0,a.createElement)("div",null,(0,a.createElement)("p",null," ",(0,g.__)("Optional","google-listings-and-ads")," "))},(0,a.createElement)(De,{...e}))},Le=()=>{const{values:e}=(0,d.h5)(),t="flat"===e.shipping_time,n="flat"===e.shipping_rate&&e.shipping_country_rates.some(_);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(W,null),(0,a.createElement)(ge,null),n&&(0,a.createElement)(Ue,null),t&&(0,a.createElement)(xe,null))},qe=["locale","language","location","countries"],Be=["shipping_rate","shipping_time"],$e=()=>!0,{Fill:Ve,Slot:je}=(0,s.createSlotFill)("gla/SetupFreeListings/SubmitButton"),We=({targetAudience:e,resolveFinalCountries:t,onTargetAudienceChange:n=r.noop,settings:s,onSettingsChange:l=r.noop,shippingRates:f,onShippingRatesChange:A=r.noop,shippingTimes:y,onShippingTimesChange:v=r.noop,onRequestSubmit:b=$e,onContinue:C=r.noop,submitLabel:k})=>{const w=(0,o.useRef)();if(!(e&&s&&f&&y))return(0,a.createElement)(i.A,null);const N=e=>{const n=t(e),{shipping_country_times:a}=e;return((e,t,n)=>{const a={};return m.has(e.location)||(a.location=(0,g.__)("Please select a location option.","google-listings-and-ads")),"selected"===e.location&&0===e.countries.length&&(a.countries=(0,g.__)("Please select at least one country.","google-listings-and-ads")),p.has(e.shipping_rate)||(a.shipping_rate=(0,g.__)("Please select a shipping rate option.","google-listings-and-ads")),"flat"===e.shipping_rate&&(e.shipping_country_rates.length<n.length||e.shipping_country_rates.some((e=>e.rate<0)))&&(a.shipping_country_rates=(0,g.__)("Please specify estimated shipping rates for all the countries, and the rate cannot be less than 0.","google-listings-and-ads")),"flat"===e.shipping_rate&&!0===e.offer_free_shipping&&e.shipping_country_rates.every((e=>void 0===e.options.free_shipping_threshold))&&(a.free_shipping_threshold=(0,g.__)("Please enter minimum order for free shipping.","google-listings-and-ads")),h.has(e.shipping_time)||(a.shipping_time=(0,g.__)("Please select a shipping time option.","google-listings-and-ads")),"flat"===e.shipping_time&&(t.length<n.length||t.some((e=>e.time<0||e.maxTime<0)))&&(a.shipping_country_times=(0,g.__)("Please specify estimated shipping times for all the countries, and the time cannot be less than 0.","google-listings-and-ads")),"flat"===e.shipping_time&&t.some((e=>e.time>e.maxTime))&&(a.shipping_country_times=(0,g.__)("The minimum shipping time must not be more than the maximum shipping time.","google-listings-and-ads")),a})(e,a,n)};return(0,a.createElement)("div",{className:"gla-setup-free-listings"},(0,a.createElement)(d.Ay,{ref:w,initialValues:{locale:e.locale,language:e.language,location:e.location,countries:e.countries||[],shipping_rate:s.shipping_rate,shipping_time:s.shipping_time,offer_free_shipping:E(f),shipping_country_rates:f,shipping_country_times:y},extendAdapter:e=>({audienceCountries:t(e.values),renderRequestedValidation:t=>e.adapter.requestedShowValidation?(0,a.createElement)(u.A,{messages:e.errors[t]}):null}),onChange:(e,a)=>{const{setValue:o}=w.current;if("shipping_country_rates"===e.name)A(a.shipping_country_rates),e.value.some(_)||o("offer_free_shipping",void 0);else if("offer_free_shipping"===e.name){if(!1===e.value){const e=a.shipping_country_rates.map((e=>({...e,options:{...e.options,free_shipping_threshold:void 0}})));o("shipping_country_rates",e)}}else if("shipping_country_times"===e.name){const t=!N(a).hasOwnProperty(e.name);!a.shipping_country_times.some((e=>null===e.time||null===e.maxTime))&&t&&v(a.shipping_country_times)}else if(Be.includes(e.name)){let t=!0;if("shipping_rate"===e.name){const n="manual"===e.value?"manual":"flat";n!==a.shipping_time&&(t=!1,o("shipping_time",n))}t&&l((e=>(0,r.pick)(e,Be))(a))}else qe.includes(e.name)&&(n((0,r.pick)(a,qe)),["shipping_country_rates","shipping_country_times"].forEach((e=>{const n=t(a),s=a[e],l=s.filter((e=>n.includes(e.country||e.countryCode)));l.length!==s.length&&o(e,l)})))},validate:N,onSubmit:C},(e=>{const{isValidForm:t,handleSubmit:n,adapter:o}=e;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(Le,null),(0,a.createElement)(Ve,null,(0,a.createElement)(c.A,{isPrimary:!0,loading:o.isSubmitting,onClick:async e=>{if(t){if(!await b())return;return n(e)}o.showValidation()}},k)))})))};We.SubmitButton=je;const ze=We},8678:(e,t,n)=>{n.d(t,{Az:()=>b,mU:()=>g,dR:()=>_,w5:()=>v,Ay:()=>k,TQ:()=>h});var a=n(1609),o=n(8e3),s=n(3741),l=n(559),r=n(7723),i=n(6087),c=n(3905),d=n(7892),u=n(1177);const g=(0,a.createElement)(u.A,{context:"setup-mc-accounts",linkId:"required-google-permissions",href:"https://woocommerce.com/document/google-for-woocommerce/get-started/setup-and-configuration/#required-google-permissions"});var m=n(5640),p=n(1830);const h=(e,t)=>{const{createNotice:n}=(0,m.A)(),[a,o]=(0,p.A)(e,t);return[async()=>{try{const{url:e}=await a();window.location.href=e}catch(e){n("error",(0,r.__)("Unable to connect your Google account. Please try again later.","google-listings-and-ads"))}},o]},_=({additionalScopeEmail:e})=>{const t=c.Th.mcSetupComplete?"reconnect":"setup-mc",[n,{loading:o,data:s}]=h(t,e);return(0,a.createElement)(l.A,{appearance:l.x.GOOGLE,alignIcon:"top",description:(0,a.createElement)(a.Fragment,null,e,(0,a.createElement)("p",null,(0,a.createElement)("em",null,(0,i.createInterpolateElement)((0,r.__)("<alert>Uh-oh!</alert> You did not allow WooCommerce sufficient access to your Google account. You must allow all required permissions in the Google authorization page to proceed. <link>Read more</link>","google-listings-and-ads"),{alert:(0,a.createElement)("span",{className:"gla-authorize-google-account-card__error-text"}),link:g})))),alignIndicator:"top",indicator:(0,a.createElement)(d.A,{isSecondary:!0,isDestructive:!0,loading:o||s,eventName:"gla_google_account_connect_button_click",eventProps:{context:t,action:"scope"},text:(0,r.__)("Allow full access","google-listings-and-ads"),onClick:n})})};var E=n(4566),f=n(8242),A=n(6520),y=n(6599);const v=({text:e=(0,r.__)("Or, connect to a different Google account","google-listings-and-ads"),...t})=>{const[n,{loading:o}]=(()=>{const{createNotice:e,removeNotice:t}=(0,m.A)(),[n,{loading:a}]=(0,y.A)({path:`${A.RV}/mc/connection`,method:"DELETE"}),[o,{loading:s}]=(0,y.A)({path:`${A.RV}/ads/connection`,method:"DELETE"}),[l,{loading:i}]=(0,y.A)({path:`${A.RV}/google/connect`,method:"DELETE"}),[c,{loading:d,data:u}]=(0,p.A)("setup-mc");return[async()=>{const{notice:a}=await e("info",(0,r.__)("Connecting to a different Google account, please wait…","google-listings-and-ads"));try{await n(),await o(),await l();const{url:e}=await c();window.location.href=e}catch(n){t(a.id),e("error",(0,r.__)("Unable to connect to a different Google account. Please try again later.","google-listings-and-ads"))}},{loading:a||s||i||d||u}]})();return(0,a.createElement)(d.A,{isLink:!0,disabled:o,text:e,eventName:"gla_google_account_connect_different_account_button_click",onClick:n,...t})},b=({googleAccount:e,helper:t,hideAccountSwitch:n=!1})=>(0,a.createElement)(l.A,{appearance:l.x.GOOGLE,description:e.email,helper:t,indicator:(0,a.createElement)(E.A,null)},!n&&(0,a.createElement)(f.A.Card.Footer,null,(0,a.createElement)(v,null))),C=({disabled:e})=>{const t=c.Th.mcSetupComplete?"reconnect":"setup-mc",[n,{loading:o,data:s}]=h(t);return(0,a.createElement)(l.A,{appearance:l.x.GOOGLE,disabled:e,alignIcon:"top",description:(0,a.createElement)(a.Fragment,null,(0,r.__)("Required to sync with Google Merchant Center and Google Ads.","google-listings-and-ads"),(0,a.createElement)("p",null,(0,a.createElement)("em",null,(0,i.createInterpolateElement)((0,r.__)("You will be prompted to give WooCommerce access to your Google account. Please check all the checkboxes to give WooCommerce all required permissions. <link>Read more</link>","google-listings-and-ads"),{link:g})))),alignIndicator:"top",indicator:(0,a.createElement)(d.A,{isSecondary:!0,disabled:e,loading:o||s,eventName:"gla_google_account_connect_button_click",eventProps:{context:t,action:"authorization"},text:(0,r.__)("Connect","google-listings-and-ads"),onClick:n})})};function k({disabled:e=!1}){const{google:t,scope:n,hasFinishedResolution:r}=(0,o.A)();if(!r)return(0,a.createElement)(l.A,{description:(0,a.createElement)(s.A,null)});const i="yes"===t?.active;return i&&n.glaRequired?(0,a.createElement)(b,{googleAccount:t}):i&&!n.glaRequired?(0,a.createElement)(_,{additionalScopeEmail:t.email}):(0,a.createElement)(C,{disabled:e})}},458:(e,t,n)=>{n.d(t,{My:()=>w,AV:()=>P,Ez:()=>y,iZ:()=>A,Ay:()=>Y});var a=n(1609),o=n(6427),s=n(7723),l=n(3905),r=n(6028),i=n(8e3),c=n(1378),d=n(559),u=n(4566),g=n(8242),m=n(8468),p=n(6087),h=n(3658),_=n(7892),E=n(7541),f=n(6473);const A=({onDisconnected:e=m.noop})=>{const{disconnectGoogleAdsAccount:t}=(0,h.j)(),[n,o]=(0,p.useState)(!1),l=(0,E.A)(f.T1);return(0,a.createElement)(_.A,{isTertiary:!0,loading:n,text:(0,s.__)("Or, connect to a different Google Ads account","google-listings-and-ads"),eventName:"gla_ads_account_disconnect_button_click",eventProps:l(),onClick:()=>{o(!0),t(!0).then((()=>e())).catch((()=>o(!1)))}})};function y({googleAdsAccount:e,hideAccountSwitch:t=!1,children:n,...l}){return(0,a.createElement)(d.A,{appearance:d.x.GOOGLE_ADS,description:(0,a.createElement)(o.ExternalLink,{href:"https://ads.google.com/aw/overview"},(r=e.id,(0,s.sprintf)((0,s.__)("Account %s","google-listings-and-ads"),r))),indicator:(0,a.createElement)(u.A,null),...l},n,!t&&(0,a.createElement)(g.A.Card.Footer,null,(0,a.createElement)(A,null)));var r}var v=n(5559);const b=()=>{const{fetchGoogleAdsAccountStatus:e}=(0,h.j)();return(0,v.A)(e,30),(0,a.createElement)(p.Fragment,null,(0,a.createElement)("p",{className:"gla-ads-claim-account-notice"},(0,s.__)("Claim your new Google Ads account to complete this setup.","google-listings-and-ads")),(0,a.createElement)(g.A.Card.Footer,null,(0,a.createElement)(A,null)))};var C=n(4297),k=n(5992);const w=({onClick:e=m.noop,...t})=>{const{inviteLink:n}=(0,k.A)(),o=(0,E.A)(f.T1);return n?(0,a.createElement)(_.A,{...t,eventName:"gla_open_ads_account_claim_invitation_button_click",eventProps:o(),onClick:t=>{const{defaultView:a}=t.target.ownerDocument,o=(0,C.A)(a,600,800);a.open(n,"_blank",o),e(t)}}):null};var N=n(9457);const S=({onRequestClose:e})=>{const{hasAccess:t}=(0,k.A)();return(0,p.useEffect)((()=>{t&&e()}),[e,t]),(0,a.createElement)(N.A,{className:"gla-ads-invite-modal",title:(0,s.__)("Claim your Google Ads account","google-listings-and-ads"),buttons:[(0,a.createElement)(w,{key:"1",isPrimary:!0,onClick:e},(0,s.__)("Claim account in Google Ads","google-listings-and-ads"))],onRequestClose:e},(0,a.createElement)("p",null,(0,s.__)("Claiming your account lets you access Google Ads and sets up conversion measurement. You must claim your account in the next 20 days.","google-listings-and-ads")),(0,a.createElement)("p",null,(0,s.__)("When you claim your account, youll be asked to set up billing. This step is optional and you only need to complete it if you want to create Google Ads campaigns. If you dont want to set up billing, close the window after youve clicked Continue on the next page.","google-listings-and-ads")))};var x=n(1177);const R=({onCreateAccount:e=()=>{},onRequestClose:t=()=>{}})=>{const[n,l]=(0,p.useState)(!1),r=(0,E.A)(f.T1);return(0,a.createElement)(N.A,{className:"gla-ads-terms-modal",title:(0,s.__)("Create Google Ads Account","google-listings-and-ads"),buttons:[(0,a.createElement)(_.A,{key:"1",isPrimary:!0,disabled:!n,eventName:"gla_ads_account_create_button_click",eventProps:r(),onClick:()=>{e(),t()}},(0,s.__)("Create account","google-listings-and-ads"))],onRequestClose:t},(0,a.createElement)("p",{className:"main"},(0,s.__)("By creating a Google Ads account, you agree to the following terms and conditions:","google-listings-and-ads")),(0,a.createElement)("p",null,(0,p.createInterpolateElement)((0,s.__)("You agree to comply with Googles terms and policies, including <policylink>Shopping ads policies</policylink> and <termslink>Google Ads Terms and Conditions</termslink>.","google-listings-and-ads"),{policylink:(0,a.createElement)(x.A,{context:"setup-ads",linkId:"shopping-ads-policies",href:"https://support.google.com/merchants/answer/6149970"}),termslink:(0,a.createElement)(x.A,{context:"setup-ads",linkId:"google-ads-terms-of-service",href:"https://support.google.com/adspolicy/answer/54818"})})),(0,a.createElement)(o.CheckboxControl,{label:(0,s.__)("I have read and accept these terms","google-listings-and-ads"),checked:n,onChange:l}))},T=({onCreateAccount:e})=>{const[t,n]=(0,p.useState)(!1);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_.A,{isSecondary:!0,text:(0,s.__)("Create account","google-listings-and-ads"),onClick:()=>{n(!0)}}),t&&(0,a.createElement)(R,{onCreateAccount:e,onRequestClose:()=>{n(!1)}}))};var I=n(70);const G=e=>{const{allowShowExisting:t,onShowExisting:n}=e,[o,l]=(0,p.useState)(!1),{googleAdsAccount:r}=(0,c.A)(),{hasAccess:i,step:u}=(0,k.A)(),[m,{loading:h,action:E}]=(0,I.A)(),f=Boolean(r.id&&!1===i),A=async()=>{await m(),l(!0)};return(0,p.useEffect)((()=>{!0===i&&"conversion_action"===u&&m()}),[i,m,u]),(0,a.createElement)(d.A,{appearance:d.x.GOOGLE_ADS,alignIcon:"top",indicator:(()=>{if(h){const e="create"===E?(0,s.__)("Creating…","google-listings-and-ads"):(0,s.__)("Updating…","google-listings-and-ads");return(0,a.createElement)(_.A,{loading:!0,text:e})}return f?(0,a.createElement)(w,{isSecondary:!0},(0,s.__)("Claim Account","google-listings-and-ads")):(0,a.createElement)(T,{onCreateAccount:A})})()},t&&!f&&(0,a.createElement)(g.A.Card.Footer,null,(0,a.createElement)(_.A,{isLink:!0,disabled:h,onClick:n},(0,s.__)("Or, use your existing Google Ads account","google-listings-and-ads"))),f&&(0,a.createElement)(p.Fragment,null,o&&(0,a.createElement)(S,{onRequestClose:()=>{l(!1)}}),(0,a.createElement)(b,null)))};var F=n(5530);const P=({accountID:e,...t})=>{const n=(0,E.A)(f.T1);return(0,a.createElement)(_.A,{isSecondary:!0,disabled:!e,eventName:"gla_ads_account_connect_button_click",eventProps:n({id:Number(e)}),...t},(0,s.__)("Connect","google-listings-and-ads"))};var M=n(8463),O=n(8441),D=n(8771),U=n(6599),L=n(5640),q=n(2661);const B=e=>{const{accounts:t,onCreateNew:n=()=>{}}=e,[l,r]=(0,p.useState)(),[i,u]=(0,p.useState)(!1),[m]=(0,U.A)({path:"/wc/gla/ads/accounts",method:"POST",data:{id:l}}),{refetchGoogleAdsAccount:E}=(0,c.A)(),{createNotice:f}=(0,L.A)(),{fetchGoogleAdsAccountStatus:A}=(0,h.j)(),y=t.length>1;return(0,a.createElement)(d.A,{className:"gla-connect-ads",alignIcon:"top",appearance:d.x.GOOGLE_ADS},(0,a.createElement)(o.CardDivider,null),(0,a.createElement)(g.A.Card.Body,null,(0,a.createElement)(D.A.Title,null,(0,s.__)("Connect to an existing account","google-listings-and-ads")),y&&(0,a.createElement)(D.A.Body,null,(0,p.createInterpolateElement)((0,s.__)("If you manage multiple sub-accounts in Google Ads, please connect the relevant sub-account, not a manager account. <link>Learn more</link>","google-listings-and-ads"),{link:(0,a.createElement)(x.A,{context:"setup-ads-connect-account",linkId:"connect-sub-account",href:"https://support.google.com/google-ads/answer/6139186"})})),(0,a.createElement)(M.A,null,(0,a.createElement)(q.A,{value:l,onChange:r}),i?(0,a.createElement)(O.A,{text:(0,s.__)("Connecting…","google-listings-and-ads")}):(0,a.createElement)(P,{accountID:l,onClick:async()=>{if(l){u(!0);try{await m(),await A(),await E()}catch(e){u(!1),f("error",(0,s.__)("Unable to connect your Google Ads account. Please try again later.","google-listings-and-ads"))}}}}))),(0,a.createElement)(g.A.Card.Footer,null,(0,a.createElement)(_.A,{isTertiary:!0,disabled:i,onClick:n},(0,s.__)("Or, create a new Google Ads account","google-listings-and-ads"))))},$=()=>{const{existingAccounts:e}=(0,F.A)(),[t,n]=(0,p.useState)(!1),{googleAdsAccount:o}=(0,c.A)(),{hasAccess:s,step:l}=(0,k.A)();return e?0===e.length||t||o.id&&!0!==s||!0===s&&"conversion_action"===l?(0,a.createElement)(G,{allowShowExisting:t,onShowExisting:()=>{n(!1)}}):(0,a.createElement)(B,{accounts:e,onCreateNew:()=>{n(!0)}}):(0,a.createElement)(r.A,null)};var V=n(1830);const j=({additionalScopeEmail:e})=>{const t=l.Th.mcSetupComplete?"setup-ads":"setup-mc",{createNotice:n}=(0,L.A)(),[o,{loading:r,data:i}]=(0,V.A)(t,e);return(0,a.createElement)(d.A,{appearance:d.x.GOOGLE_ADS,alignIcon:"top",indicator:(0,a.createElement)(_.A,{isSecondary:!0,loading:r||i,onClick:()=>{o().then((({url:e})=>{window.location.href=e})).catch((()=>{n("error",(0,s.__)("Unable to get Google authorization page. Please try again later.","google-listings-and-ads"))}))},text:(0,s.__)("Allow full access","google-listings-and-ads"),eventName:"gla_google_account_connect_button_click",eventProps:{context:"setup-ads",action:"scope"}})})},W=()=>(0,a.createElement)(d.A,{disabled:!0,appearance:d.x.GOOGLE_ADS});var z=n(4391);function Y(){const{google:e,scope:t,hasFinishedResolution:n}=(0,i.A)(),{googleAdsAccount:d,hasFinishedResolution:u}=(0,c.A)(),{hasAccess:g,step:m,hasFinishedResolution:p}=(0,k.A)();if(!n||!u||!p||null===d)return(0,a.createElement)(r.A,null);if(!e||"no"===e.active)return(0,a.createElement)(W,null);if(!t.adsRequired)return(0,a.createElement)(j,{additionalScopeEmail:e.email});if(d.status===l.Wn.DISCONNECTED||!0!==g||!0===g&&"conversion_action"===m)return(0,a.createElement)($,null);const h=(0,z.A)(d);return(0,a.createElement)(y,{googleAdsAccount:d},h?(0,a.createElement)(o.Notice,{status:"success",isDismissible:!1},(0,s.__)("Conversion measurement has been set up. You can create a campaign later.","google-listings-and-ads")):null)}},1274:(e,t,n)=>{n.d(t,{A:()=>K});var a=n(1609),o=n(8e3),s=n(3741),l=n(559),r=n(8678),i=n(7723),c=n(6087),d=n(6427),u=n(3905),g=n(7892),m=n(1177);const p=({disabled:e})=>{const t=u.Th.mcSetupComplete?"reconnect":"setup-mc",[n,{loading:o,data:s}]=(0,r.TQ)(t),[p,h]=(0,c.useState)(!1);return(0,a.createElement)(l.A,{appearance:l.x.GOOGLE,disabled:e,alignIcon:"top",className:"gla-google-combo-service-account-card--google",description:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,i.__)("Required to sync with Google Merchant Center and Google Ads.","google-listings-and-ads")),(0,a.createElement)(d.CheckboxControl,{label:(0,c.createInterpolateElement)((0,i.__)("I accept the terms and conditions of <linkMerchant>Merchant Center</linkMerchant> and <linkAds>Google Ads</linkAds>","google-listings-and-ads"),{linkMerchant:(0,a.createElement)(m.A,{context:"setup-mc-accounts",linkId:"google-mc-terms-of-service",href:"https://support.google.com/merchants/answer/160173"}),linkAds:(0,a.createElement)(m.A,{context:"setup-ads",linkId:"google-ads-terms-of-service",href:"https://support.google.com/adspolicy/answer/54818"})}),checked:p,onChange:h,disabled:e})),helper:(0,c.createInterpolateElement)((0,i.__)("You will be prompted to give WooCommerce access to your Google account. Please check all the checkboxes to give WooCommerce all required permissions. <link>Read more</link>","google-listings-and-ads"),{link:r.mU}),alignIndicator:"top",indicator:(0,a.createElement)(g.A,{isSecondary:!0,disabled:e||!p,loading:o||s,eventName:"gla_google_account_connect_button_click",eventProps:{context:t,action:"authorization"},text:(0,i.__)("Connect","google-listings-and-ads"),onClick:n})})};var h=n(3658),_=n(9457),E=n(7792);const f=({onContinue:e,onRequestClose:t})=>(0,a.createElement)(_.A,{className:"gla-ads-warning-modal",title:(0,i.__)("Create Google Ads Account","google-listings-and-ads"),buttons:[(0,a.createElement)(g.A,{key:"confirm",isSecondary:!0,onClick:e},(0,i.__)("Yes, I want a new account","google-listings-and-ads")),(0,a.createElement)(g.A,{key:"cancel",isPrimary:!0,onClick:t},(0,i.__)("Cancel","google-listings-and-ads"))],onRequestClose:t},(0,a.createElement)("p",{className:"gla-ads-warning-modal__warning-text"},(0,a.createElement)(E.A,null),(0,a.createElement)("span",null,(0,i.__)("Are you sure you want to create a new Google Ads account?","google-listings-and-ads"))),(0,a.createElement)("p",null,(0,i.__)("You already have another Ads account associated with this Google account.","google-listings-and-ads")),(0,a.createElement)("p",null,(0,i.__)("If you create a new Google Ads account, you will need to accept an invite to the account before it can be used.","google-listings-and-ads")));var A=n(458),y=n(5530),v=n(5992),b=n(1378);const C=({isConnected:e,onCreateNewClick:t,onDisconnected:n,disabled:o,...s})=>{const{existingAccounts:l}=(0,y.A)(),{googleAdsAccount:r}=(0,b.A)(),{hasAccess:c}=(0,v.A)(),d=Boolean(r?.id&&!1===c);if(e&&l.length>0)return(0,a.createElement)(A.iZ,{onDisconnected:n});const u=o||d&&!l.length;return(0,a.createElement)(g.A,{isTertiary:!0,onClick:t,disabled:u,...s},(0,i.__)("Or, create a new Google Ads account","google-listings-and-ads"))};var k=n(8441),w=n(6599),N=n(5640),S=n(1351),x=n(2661),R=n(4566);const T=({onCreateClick:e})=>{const[t,n]=(0,c.useState)(),[o,s]=(0,c.useState)(!1),{createNotice:r}=(0,N.A)(),{fetchGoogleAdsAccountStatus:d}=(0,h.j)(),u=(0,S.A)(),{googleAdsAccount:g,hasFinishedResolution:m,hasGoogleAdsConnection:p,refetchGoogleAdsAccount:_}=(0,b.A)(),[E]=(0,w.A)({path:"/wc/gla/ads/accounts",method:"POST",data:{id:t}});(0,c.useEffect)((()=>{p&&n(g.id)}),[g,p]);return(0,a.createElement)(l.A,{className:"gla-google-combo-account-card gla-google-combo-service-account-card--ads",title:(0,i.__)("Connect to existing Google Ads account","google-listings-and-ads"),helper:(0,i.__)("Required to set up conversion measurement for your store.","google-listings-and-ads"),alignIndicator:"toDetail",indicator:m?o?(0,a.createElement)(k.A,{text:(0,i.__)("Connecting…","google-listings-and-ads")}):u?(0,a.createElement)(R.A,null):(0,a.createElement)(A.AV,{disabled:p,accountID:t,onClick:async()=>{if(t){s(!0);try{await E(),await d(),await _()}catch(e){r("error",(0,i.__)("Unable to connect your Google Ads account. Please try again later.","google-listings-and-ads"))}finally{s(!1)}}}}):(0,a.createElement)(k.A,null),detail:(0,a.createElement)(x.A,{value:t,onChange:n,autoSelectFirstOption:!0,nonInteractive:p}),actions:(0,a.createElement)(C,{disabled:o,isConnected:p,onCreateNewClick:e,onDisconnected:()=>{n(void 0)}})})},I=({upsertingAction:e})=>{const t="update"===e;let n=(0,i.__)("Creating a new Google Ads account","google-listings-and-ads"),o=(0,i.__)("Creating…","google-listings-and-ads");return t&&(n=(0,i.__)("Connecting your Google Ads account","google-listings-and-ads"),o=(0,i.__)("Connecting…","google-listings-and-ads")),(0,a.createElement)(l.A,{className:"gla-google-combo-service-account-card--ads",title:n,helper:(0,i.__)("This may take a few moments, please wait…","google-listings-and-ads"),indicator:(0,a.createElement)(k.A,{text:o})})},G=({onRequestCreate:e,upsertingAction:t})=>{const[n,o]=(0,c.useState)(!1);if(t)return(0,a.createElement)(I,{upsertingAction:t});const s=()=>{o(!1)};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(T,{onCreateClick:()=>{o(!0)}}),n&&(0,a.createElement)(f,{onContinue:()=>{e(),s()},onRequestClose:s}))};var F=n(7916);const P=()=>{const{google:e}=(0,o.A)(),{googleAdsAccount:t}=(0,b.A)(),{googleMCAccount:n,isReady:s}=(0,F.A)();return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,e.email),(0,a.createElement)("p",null,s&&(0,i.sprintf)(
// Translators: %s is the Merchant Center ID
// Translators: %s is the Merchant Center ID
(0,i.__)("Merchant Center ID: %s","google-listings-and-ads"),n.id)),(0,a.createElement)("p",null,t?.id>0&&(0,i.sprintf)(
// Translators: %s is the Google Ads ID
// Translators: %s is the Google Ads ID
(0,i.__)("Google Ads ID: %s","google-listings-and-ads"),t.id)))};var M=n(7108),O=n(5559);const D=()=>{const{fetchGoogleAdsAccountStatus:e}=(0,h.j)();return(0,O.A)(e,30),(0,a.createElement)("div",{className:"gla-claim-ads-account-box"},(0,a.createElement)("h4",null,(0,i.__)("Claim your Google Ads account","google-listings-and-ads")),(0,a.createElement)("p",null,(0,i.__)("You need to accept the invitation to the Google Ads account we created for you. This gives you access to Google Ads and sets up conversion measurement. You must claim your account in the next 20 days.","google-listings-and-ads")),(0,a.createElement)("p",{className:"gla-ads-post-claim-instructions"},(0,i.__)("After accepting the invitation, youll be prompted to set up billing. We highly recommend doing this to avoid having to do it later on.","google-listings-and-ads")),(0,a.createElement)(A.My,{isPrimary:!0},(0,i.__)("Claim account in Google Ads","google-listings-and-ads"),(0,a.createElement)(d.Icon,{icon:M.A,size:20})))},U=({claimGoogleAdsAccount:e,showConversionMeasurementNotice:t})=>e||t?(0,a.createElement)("div",{className:"gla-connected-ads-account-detail"},e&&(0,a.createElement)(D,null),t&&(0,a.createElement)(d.Notice,{status:"success",isDismissible:!1},(0,i.__)("Google Ads conversion measurement has been set up for your store.","google-listings-and-ads"))):null,L=({showSpinner:e})=>{const t=(0,S.A)(),{isReady:n}=(0,F.A)();return e?(0,a.createElement)(k.A,{text:(0,i.__)("Creating…","google-listings-and-ads")}):t&&n?(0,a.createElement)(R.A,null):null},q="both",B="ads",$="mc";var V=n(6028),j=n(3354),W=n(2722),z=n(70);var Y=n(1666),H=n(4391);const Q=()=>{const[e,t]=(0,c.useState)(!1),[n,o]=(()=>{const{createNotice:e}=(0,N.A)(),{invalidateResolution:t}=(0,h.j)(),[n,a]=(0,w.A)({path:"/wc/gla/mc/accounts",method:"POST"});return[async()=>{try{await n({data:a.error?.id&&{id:a.error.id},parse:!1}),t("getGoogleMCAccount",[])}catch(t){if(![403,503].includes(t.status)){const n=(await t.json()).message||(0,i.__)("Unable to create Merchant Center account. Please try again later.","google-listings-and-ads");e("error",n)}}},a]})(),{data:s}=(0,W.A)(),{hasDetermined:d,creatingWhich:u}=(e=>{const t=(0,c.useRef)(!1),[n,a]=(0,c.useState)(null),[o,s]=(0,c.useState)(!1),l=(()=>{const{hasFinishedResolution:e,hasGoogleAdsConnection:t}=(0,b.A)(),{hasFinishedResolution:n,existingAccounts:a}=(0,y.A)();return e&&n?!t&&0===a?.length:null})(),r=(()=>{const{hasFinishedResolution:e,hasGoogleMCConnection:t}=(0,F.A)(),{hasFinishedResolution:n,data:a}=(0,W.A)();return e&&n?!t&&0===a?.length:null})(),[i]=(0,z.A)();return(0,c.useEffect)((()=>{if(null===r||null===l||t.current)return;let n=null;t.current=!0,r&&l?n=q:r?n=$:l&&(n=B),a(n),s(!0),n&&(async()=>{n===q?(await e(),await i()):n===$?await e():n===B&&await i(),a(null)})()}),[e,l,r,i]),{hasDetermined:o,creatingWhich:n}})(n),{text:m,subText:p}=(e=>{let t=null,n=null;switch(e){case q:t=(0,i.__)("You dont have Merchant Center nor Google Ads accounts, so were creating them for you.","google-listings-and-ads"),n=(0,i.__)("Merchant Center is required to sync products so they show on Google. Google Ads is required to set up conversion measurement for your store.","google-listings-and-ads");break;case B:t=(0,i.__)("You dont have Google Ads account, so were creating one for you.","google-listings-and-ads"),n=(0,i.__)("Required to set up conversion measurement for your store.","google-listings-and-ads");break;case $:t=(0,i.__)("You dont have Merchant Center account, so were creating one for you.","google-listings-and-ads"),n=(0,i.__)("Required to sync products so they show on Google.","google-listings-and-ads")}return{text:t,subText:n}})(u),{existingAccounts:_}=(0,y.A)(),{isReady:E,hasGoogleMCConnection:f,hasFinishedResolution:A}=(0,F.A)(),{invalidateResolution:C}=(0,h.j)(),{googleAdsAccount:k,hasGoogleAdsConnection:S}=(0,b.A)(),{hasAccess:x,step:R}=(0,v.A)(),[T,{action:I,loading:M}]=(0,z.A)(),O=s?.length>0,D=_?.length>0,Q=Boolean(!M&&k?.id&&!1===x),K=!0===x&&"conversion_action"===R;(0,c.useEffect)((()=>{(async()=>{K&&(await T(),C("getExistingGoogleAdsAccounts",[]))})()}),[K,T,C]);const J=[409,403].includes(o.response?.status)||O||f,Z=J&&(e||!E),X=S||D,ee=X&&(e||!S);if((0,c.useEffect)((()=>{!e||f||S||t(!1)}),[e,S,f]),!d)return(0,a.createElement)(V.A,null);const te=(0,a.createElement)(r.w5,{isTertiary:!0,text:(0,i.__)("Or, connect to a different Google account","google-listings-and-ads")}),ne=Boolean(u)&&!Q||!ee&&K,ae=(0,H.A)(k),oe=A&&E;return(0,a.createElement)("div",{className:"gla-google-combo-account-card-wrapper"},(0,a.createElement)(l.A,{appearance:l.x.GOOGLE,alignIcon:"top",className:"gla-google-combo-account-card gla-google-combo-account-card--connected gla-google-combo-service-account-card--google",description:m||(0,a.createElement)(P,null),actions:e?(0,a.createElement)("div",{className:"gla-google-combo-account-card__description-actions"},te,(0,a.createElement)(g.A,{isTertiary:!0,onClick:()=>{t(!1)}},(0,i.__)("Cancel","google-listings-and-ads"))):(0,a.createElement)("div",{className:"gla-google-combo-account-card__description-actions"},!ee&&X||!Z&&J?(0,a.createElement)(g.A,{isTertiary:!0,text:(0,i.__)("Edit","google-listings-and-ads"),onClick:()=>{t(!0)}}):te),helper:p,indicator:(0,a.createElement)(L,{showSpinner:ne}),detail:(0,a.createElement)(U,{showConversionMeasurementNotice:ae,claimGoogleAdsAccount:Q}),expandedDetail:!0}),ee&&(0,a.createElement)(G,{onRequestCreate:T,upsertingAction:I}),Z&&(0,a.createElement)(Y.b,{createAccount:n,resultCreateAccount:o,className:"gla-google-combo-account-card gla-google-combo-service-account-card--mc"}),oe&&(0,a.createElement)(j.S,null))};function K({disabled:e=!1}){const{google:t,scope:n,hasFinishedResolution:i}=(0,o.A)();if(!i)return(0,a.createElement)(l.A,{description:(0,a.createElement)(s.A,null)});const c="yes"===t?.active;return c&&n.gmcRequired&&n.adsRequired?(0,a.createElement)(Q,null):!c||n.gmcRequired&&n.adsRequired?(0,a.createElement)(p,{disabled:e}):(0,a.createElement)(r.dR,{additionalScopeEmail:t.email})}},1666:(e,t,n)=>{n.d(t,{b:()=>V,D:()=>Q});var a=n(1609),o=n(6942),s=n.n(o),l=n(6087),r=n(7723),i=n(5703),c=n(2722),d=n(7568);const u=e=>{const{data:t}=(0,c.A)(),n=t?.map((e=>({value:e.id,label:(0,r.sprintf)(
// translators: 1: account name, 2: account domain, 3: account ID.
// translators: 1: account name, 2: account domain, 3: account ID.
(0,r.__)("%1$s ・ %2$s (%3$s)","google-listings-and-ads"),e.name,e.domain,e.id)})));return n?.sort(((e,t)=>e.label.localeCompare(t.label))),(0,a.createElement)(d.A,{options:n,autoSelectFirstOption:!0,...e})};var g=n(7916);const m=({isConnected:e,...t})=>{const{data:n}=(0,c.A)(),{googleMCAccount:o}=(0,g.A)(),s=n?.some((e=>e.id===o.id));if(!s&&e){const e=new URL((0,i.getSetting)("homeUrl")).host;return(0,a.createElement)(d.A,{autoSelectFirstOption:!0,nonInteractive:!0,value:o.id,options:[{value:o.id,label:(0,r.sprintf)(
// translators: 1: account domain, 2: account ID.
// translators: 1: account domain, 2: account ID.
(0,r.__)("%1$s (%2$s)","google-listings-and-ads"),e,o.id)}]})}return(0,a.createElement)(u,{nonInteractive:e,...t})};var p=n(7892),h=n(6599),_=n(5640),E=n(3658);var f=n(6427),A=n(8242),y=n(8771),v=n(8463),b=n(8468),C=n(1177),k=n(559),w=n(7677),N=n(9703),S=n(5092);const x=e=>{const{className:t,...n}=e;return(0,a.createElement)(S.A,{className:s()("app-input-link-control",t),prefix:(0,a.createElement)(w.A,{icon:N.A,size:24}),...n})},R=({id:e,websiteUrl:t,onSwitchAccount:n=b.noop})=>{const{invalidateResolution:o}=(0,E.j)(),[s,{loading:d,error:u,reset:g}]=(0,h.A)({path:"/wc/gla/mc/accounts/claim-overwrite",method:"POST",data:{id:e}}),m=(0,i.getSetting)("homeUrl"),{data:_}=(0,c.A)(),w=_?.length>0;return(0,a.createElement)(k.A,{className:"gla-reclaim-url-card",appearance:k.x.GOOGLE_MERCHANT_CENTER,description:(0,r.sprintf)(
// translators: 1: website URL, 2: account ID.
// translators: 1: website URL, 2: account ID.
(0,r.__)("%1$s (%2$s)","google-listings-and-ads"),t,e),indicator:w?(0,a.createElement)(p.A,{isSecondary:!0,disabled:d,eventName:"gla_mc_account_switch_account_button_click",eventProps:{context:"reclaim-url"},onClick:n},(0,r.__)("Switch account","google-listings-and-ads")):null},(0,a.createElement)(f.CardDivider,null),(0,a.createElement)(A.A.Card.Body,null,(0,a.createElement)(y.A.Title,null,(0,r.__)("Reclaim your URL","google-listings-and-ads")),(0,a.createElement)(y.A.Body,null,(0,r.__)("Your URL is currently claimed by another Merchant Center account.","google-listings-and-ads")),(0,a.createElement)(v.A,null,(0,a.createElement)(x,{disabled:!0,value:m}),(0,a.createElement)(p.A,{isSecondary:!0,loading:d,eventName:"gla_mc_account_reclaim_url_button_click",onClick:async()=>{g(),await s({parse:!1}),o("getGoogleMCAccount",[])}},(0,r.__)("Reclaim my URL","google-listings-and-ads"))),(0,a.createElement)(y.A.HelperText,null,(0,l.createInterpolateElement)((0,r.__)("If you reclaim this URL, it will cause any existing product listings or ads to stop running, and the other verified account will be notified that they have lost their claim. <link>Learn more</link>.","google-listings-and-ads"),{link:(0,a.createElement)(C.A,{context:"setup-mc",linkId:"claim-url",href:"https://support.google.com/merchants/answer/176793"})})),u&&(0,a.createElement)(f.Notice,{status:"error",isDismissible:!1},(0,l.createInterpolateElement)((0,r.__)("<strong>We were unable to reclaim this URL.</strong> You may not have permission to reclaim this URL, or an error might have occurred. Try again later or contact your Google account administrator.","google-listings-and-ads"),{strong:(0,a.createElement)("strong",null)}))))},T=({id:e,claimedUrl:t,newUrl:n,onSelectAnotherAccount:o=()=>{}})=>{const{createNotice:s}=(0,_.A)(),{invalidateResolution:l}=(0,E.j)(),[c,{loading:d,error:u,response:g}]=(0,h.A)({path:"/wc/gla/mc/accounts/switch-url",method:"POST",data:{id:e}}),m=(0,i.getSetting)("homeUrl"),b=()=>{o()};return g&&403===g.status?(0,a.createElement)(R,{id:u.id,websiteUrl:u.website_url,onSwitchAccount:b}):(0,a.createElement)(k.A,{className:"gla-switch-url-card",appearance:k.x.GOOGLE_MERCHANT_CENTER,description:(0,r.sprintf)(
// translators: 1: the new URL, 2: account ID.
// translators: 1: the new URL, 2: account ID.
(0,r.__)("%1$s (%2$s)","google-listings-and-ads"),n,e),indicator:(0,a.createElement)(p.A,{isSecondary:!0,disabled:d,eventName:"gla_mc_account_switch_account_button_click",eventProps:{context:"switch-url"},onClick:b},(0,r.__)("Switch account","google-listings-and-ads"))},(0,a.createElement)(f.CardDivider,null),(0,a.createElement)(A.A.Card.Body,null,(0,a.createElement)(y.A.Title,null,(0,r.__)("Switch to this new URL","google-listings-and-ads")),(0,a.createElement)(y.A.Body,null,(0,r.sprintf)(
// translators: %s: claimed URL.
// translators: %s: claimed URL.
(0,r.__)("This Merchant Center account already has a verified and claimed URL, %s.","google-listings-and-ads"),t)),(0,a.createElement)(v.A,null,(0,a.createElement)(x,{disabled:!0,value:m}),(0,a.createElement)(p.A,{isSecondary:!0,loading:d,eventName:"gla_mc_account_switch_url_button_click",onClick:async()=>{try{await c({parse:!1}),l("getGoogleMCAccount",[])}catch(e){if(403!==e.status){const t=(await e.json()).message||(0,r.__)("Unable to switch to your new URL. Please try again later.","google-listings-and-ads");s("error",t)}}}},(0,r.__)("Switch to this new URL","google-listings-and-ads"))),(0,a.createElement)(y.A.HelperText,null,(0,r.sprintf)(/* translators: 1: new URL. 2: claimed URL. */ /* translators: 1: new URL. 2: claimed URL. */
(0,r.__)("If you switch your claimed URL to %1$s, you will lose your claim to %2$s. This will cause any existing product listings tied to %2$s to stop running.","google-listings-and-ads"),n,t))))};var I=n(8441),G=n(4566),F=n(9457),P=n(7792);const M=({existingAccount:e,onContinue:t=()=>{},onRequestClose:n=()=>{}})=>(0,a.createElement)(F.A,{className:"gla-mc-warning-modal",title:(0,r.__)("Create Google Merchant Center Account","google-listings-and-ads"),buttons:[(0,a.createElement)(p.A,{key:"confirm",isSecondary:!0,eventName:"gla_mc_account_warning_modal_confirm_button_click",onClick:()=>{t()}},(0,r.__)("Yes, I want a new account","google-listings-and-ads")),(0,a.createElement)(p.A,{key:"cancel",isPrimary:!0,onClick:n},(0,r.__)("Cancel","google-listings-and-ads"))],onRequestClose:n},(0,a.createElement)("p",{className:"gla-mc-warning-modal__warning-text"},(0,a.createElement)(P.A,null),(0,a.createElement)("span",null,(0,r.__)("Are you sure you want to create a new Google Merchant Center account?","google-listings-and-ads"))),(0,a.createElement)("p",null,(0,l.createInterpolateElement)((0,r.__)("You already have another verified account, <storename />, which is connected to this stores URL, <storeurl />.","google-listings-and-ads"),{storename:(0,a.createElement)("strong",null,e.name),storeurl:(0,a.createElement)("strong",null,e.domain)})),(0,a.createElement)("p",null,(0,r.__)("If you create a new Google Merchant Center account, you will have to reclaim this stores URL with the new account. This will cause any existing product listings or ads to stop running, and the other verified account will lose its claim.","google-listings-and-ads"))),O=({onCreateAccount:e=()=>{},onRequestClose:t=()=>{}})=>{const[n,o]=(0,l.useState)(!1);return(0,a.createElement)(F.A,{className:"gla-mc-terms-modal",title:(0,r.__)("Create Google Merchant Center Account","google-listings-and-ads"),buttons:[(0,a.createElement)(p.A,{key:"1",isPrimary:!0,disabled:!n,eventName:"gla_mc_account_create_button_click",onClick:()=>{e(),t()}},(0,r.__)("Create account","google-listings-and-ads"))],onRequestClose:t},(0,a.createElement)("p",{className:"main"},(0,r.__)("By creating a Google Merchant Center account, you agree to the following terms and conditions:","google-listings-and-ads")),(0,a.createElement)("p",null,(0,l.createInterpolateElement)((0,r.__)("You agree to comply with Googles terms and policies, including <link>Google Merchant Center Terms of Service</link>.","google-listings-and-ads"),{link:(0,a.createElement)(C.A,{context:"setup-mc",linkId:"google-mc-terms-of-service",href:"https://support.google.com/merchants/answer/160173"})})),(0,a.createElement)(f.CheckboxControl,{label:(0,r.__)("I have read and accept these terms","google-listings-and-ads"),checked:n,onChange:o}))},D=Object.freeze({NONE:"NONE",WARNING:"WARNING",TERMS:"TERMS"}),U=e=>{const{onCreateAccount:t=b.noop,onClick:n=b.noop,...o}=e,[s,r]=(0,l.useState)(D.NONE),{data:d}=(0,c.A)(),u=((e=[])=>{const t=new URL((0,i.getSetting)("homeUrl")).toString();return e.find((e=>{try{return new URL(e.domain).toString()===t}catch(e){return!1}}))})(d),g=()=>{r(D.NONE)};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(p.A,{onClick:()=>{r(u?D.WARNING:D.TERMS),n()},...o}),s===D.WARNING&&(0,a.createElement)(M,{existingAccount:u,onContinue:()=>{r(D.TERMS)},onRequestClose:g}),s===D.TERMS&&(0,a.createElement)(O,{onCreateAccount:t,onRequestClose:g}))};var L=n(6520);const q=({onDisconnected:e=b.noop,...t})=>{const{createNotice:n,removeNotice:o}=(0,_.A)(),{invalidateResolution:s}=(0,E.j)(),[l,{loading:i}]=(0,h.A)({path:`${L.RV}/mc/connection`,method:"DELETE"});return(0,a.createElement)(p.A,{disabled:i,text:(0,r.__)("Or, connect to a different Google Merchant Center account","google-listings-and-ads"),eventName:"gla_mc_account_connect_different_account_button_click",onClick:async()=>{const{notice:t}=await n("info",(0,r.__)("Disconnecting your Google Merchant Center account, please wait…","google-listings-and-ads"));try{await l(),s("getExistingGoogleMCAccounts",[]),s("getGoogleMCAccount",[]),e()}catch(e){n("error",(0,r.__)("Unable to disconnect your Google Merchant Center account. Please try again later.","google-listings-and-ads"))}o(t.id)},...t})},B=({isConnected:e,resultConnectMC:t,resultCreateAccount:n,onCreateAccount:o})=>{const{data:s}=(0,c.A)();if(e&&s.length>0){const e=()=>{t.reset(),n.reset()};return(0,a.createElement)(q,{onDisconnected:e,isTertiary:!0})}return(0,a.createElement)(U,{isTertiary:!0,disabled:t.loading,onCreateAccount:o},(0,r.__)("Or, create a new Merchant Center account","google-listings-and-ads"))},$=e=>{const{retryAfter:t,onRetry:n=()=>{}}=e;return(0,l.useEffect)((()=>{if(!t)return;const e=setInterval((()=>{n()}),1e3*t);return()=>clearInterval(e)}),[t,n]),(0,a.createElement)(k.A,{appearance:k.x.GOOGLE_MERCHANT_CENTER,description:(0,r.__)("This may take a few moments, please wait…","google-listings-and-ads"),indicator:(0,a.createElement)(p.A,{loading:!0},(0,r.__)("Creating…","google-listings-and-ads"))})},V=({createAccount:e,resultCreateAccount:t,className:n})=>{const[o,i]=(0,l.useState)(),[c,d]=(e=>{const{createNotice:t}=(0,_.A)(),[n,a]=(0,h.A)({path:"/wc/gla/mc/accounts",method:"POST",data:{id:e}}),{invalidateResolution:o}=(0,E.j)();return[async()=>{if(e)try{await n({parse:!1}),o("getGoogleMCAccount",[])}catch(e){if(![409,403].includes(e.status)){const n=(await e.json()).message||(0,r.__)("Unable to connect Merchant Center account. Please try again later.","google-listings-and-ads");t("error",n)}}},a]})(o),{googleMCAccount:u,hasFinishedResolution:f,isReady:A,hasGoogleMCConnection:y}=(0,g.A)();if((0,l.useEffect)((()=>{y&&i(u.id)}),[u,y]),!A){if(409===d.response?.status)return(0,a.createElement)(T,{id:d.error.id,message:d.error.message,claimedUrl:d.error.claimed_url,newUrl:d.error.new_url,onSelectAnotherAccount:d.reset});if(403===d.response?.status||403===t.response?.status)return(0,a.createElement)(R,{id:d.error?.id||t.error?.id,websiteUrl:d.error?.website_url||t.error?.website_url,onSwitchAccount:()=>{d.reset(),t.reset()}});if(t.loading||503===t.response?.status)return(0,a.createElement)($,{retryAfter:t.error?.retry_after,onRetry:e})}return(0,a.createElement)(k.A,{className:s()("gla-connect-mc-card",n),title:(0,r.__)("Connect to existing Merchant Center account","google-listings-and-ads"),helper:(0,r.__)("Required to sync products so they show on Google.","google-listings-and-ads"),alignIndicator:"toDetail",indicator:f?A?(0,a.createElement)(G.A,null):d.loading?(0,a.createElement)(I.A,{text:(0,r.__)("Connecting…","google-listings-and-ads")}):(0,a.createElement)(p.A,{isSecondary:!0,eventName:"gla_mc_account_connect_button_click",eventProps:{id:Number(o)},onClick:c},(0,r.__)("Connect","google-listings-and-ads")):(0,a.createElement)(I.A,null),detail:(0,a.createElement)(m,{isConnected:y,value:o,onChange:i}),actions:(0,a.createElement)(B,{isConnected:y,resultConnectMC:d,resultCreateAccount:t,onCreateAccount:e})})};var j=n(3905),W=n(6588);const z=e=>{const{className:t,...n}=e,o=["app-notice",t];return(0,a.createElement)(f.Notice,{className:s()(...o),...n})};var Y=n(4876),H=n(3666);const Q=({googleMCAccount:e,hideNotificationService:t=!1})=>{const{createNotice:n,removeNotice:o}=(0,_.A)(),{invalidateResolution:s}=(0,E.j)(),[c,{loading:d}]=(0,h.A)({path:`${L.RV}/rest-api/authorize`,method:"DELETE"}),[u,g]=(0,l.useState)(null),m=new URL((0,i.getSetting)("homeUrl")).host,f=!t&&e.wpcom_rest_api_status===j.ac.APPROVED,y=!t&&e.wpcom_rest_api_status&&e.notification_service_enabled&&e.wpcom_rest_api_status!==j.ac.APPROVED;return(0,a.createElement)(k.A,{appearance:k.x.GOOGLE_MERCHANT_CENTER,description:(0,r.sprintf)(
// translators: 1: account domain, 2: account ID.
// translators: 1: account domain, 2: account ID.
(0,r.__)("%1$s (%2$s)","google-listings-and-ads"),m,e.id),indicator:y?(0,a.createElement)(W.A,{text:(0,r.__)("Grant access","google-listings-and-ads"),eventName:"gla_enable_product_sync_click",eventProps:{context:"mc_card"}}):(0,a.createElement)(G.A,null)},f&&(0,a.createElement)(z,{status:"success",isDismissible:!1},(0,r.__)("Google has been granted access to fetch your product data.","google-listings-and-ads")),y&&(0,a.createElement)(z,{status:"warning",isDismissible:!1},(0,r.__)("There was an issue granting access to Google for fetching your products.","google-listings-and-ads")),u&&(0,a.createElement)(Y.Ay,{onRequestClose:()=>g(null),onDisconnected:()=>{window.location.href=(0,H.FN)()},disconnectTarget:u,disconnectAction:async()=>{const{notice:e}=await n("info",(0,r.__)("Disabling the new Product Sync feature, please wait…","google-listings-and-ads"));try{await c(),s("getGoogleMCAccount",[])}catch(e){n("error",(0,r.__)("Unable to disable new product sync. Please try again later.","google-listings-and-ads"))}o(e.id)}}),f&&(0,a.createElement)(A.A.Card.Footer,null,(0,a.createElement)(p.A,{isDestructive:!0,isLink:!0,disabled:d,text:(0,r.__)("Disable product data fetch","google-listings-and-ads"),eventName:"gla_disable_product_sync_click",onClick:()=>g(Y.Me)})))}},4270:(e,t,n)=>{n.d(t,{A:()=>r,i:()=>i});var a=n(1609),o=n(6942),s=n.n(o),l=n(2848);function r({title:e,children:t}){return(0,a.createElement)("div",{className:"gla-guide__page-content"},(0,a.createElement)("h2",{className:"gla-guide__page-content__header"},e),(0,a.createElement)("div",{className:"gla-guide__page-content__body"},t))}function i(e){const{context:t,href:n,className:o,...r}=e;return(0,a.createElement)(l.A,{className:s()("gla-guide__page-content__link",o),eventName:"gla_modal_content_link_click",eventProps:{context:t,href:n},type:"external",target:"_blank",href:n,...r})}},2455:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(1609),o=n(7723),s=n(4236),l=n(7892);const r=({eventContext:e})=>(0,a.createElement)(l.A,{className:"AnC9WXFuKgCBURYIRcRY",href:"https://woocommerce.com/document/google-for-woocommerce/",target:"_blank",eventName:"gla_help_click",eventProps:{context:e}},(0,a.createElement)(s.A,null),(0,o.__)("Help","google-listings-and-ads"))},6257:(e,t,n)=>{n.d(t,{A:()=>u});var a=n(1609),o=n(6942),s=n.n(o),l=n(7723),r=n(6427),i=n(6087),c=n(4236),d=n(6473);const u=({className:e,id:t,disabled:n=!1,iconSize:o=16,children:u,...g})=>{const[m,p]=(0,i.useState)(!1);return(0,a.createElement)("span",{className:s()("help-popover",e)},(0,a.createElement)("button",{"aria-label":(0,l.__)("Open popover","google-listings-and-ads"),disabled:n,onClick:()=>{p(!0),t&&(0,d.ce)("gla_tooltip_viewed",{id:t})}},(0,a.createElement)(c.A,{size:o})),m&&!n&&(0,a.createElement)(r.Popover,{focusOnMount:"container",inline:!0,onClose:()=>{p(!1)},...g},u))}},8441:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1609),o=n(8846);function s({text:e}){return(0,a.createElement)("div",{className:"gla-loading-label"},(0,a.createElement)(o.Spinner,null),e)}},9927:(e,t,n)=>{n.d(t,{A:()=>w});var a=n(1609),o=n(7723),s=n(6476),l=n(3905),r=n(347),i=n(14),c=n(6427),d=n(6087),u=n(2848),g=n(7892),m=n(9457),p=n(6473),h=n(5640),_=n(9415),E=n(6599);const f="gtin_migration_banner",A="ready",y="started",v=e=>(0,a.createElement)(u.A,{eventName:"gla_gtin_migration_banner_status_link_click",eventProps:{context:f},href:"admin.php?page=wc-status&tab=action-scheduler&s=migrate_gtin&orderby=schedule&order=desc",type:"external",target:"_blank",...e}),b=()=>{const{createNotice:e}=(0,h.A)(),[t,n]=(0,d.useState)(!1),[s,l,r]=(()=>{const{data:e,isResolving:t,invalidateResolution:n}=(0,_.A)("getGtinMigrationStatus"),[a,{loading:o}]=(0,E.A)({path:"/wc/gla/gtin-migration",method:"POST"});return[e,o||t,(0,d.useCallback)((async()=>{await a(),n()}),[a,n])]})();if(s!==A&&s!==y)return null;const i=()=>{(0,p.ce)("gla_modal_closed",{context:f}),n(!1)};return(0,a.createElement)(a.Fragment,null,t&&(0,a.createElement)(m.A,{className:"gla-gtin-migration-banner-modal",title:(0,o.__)("Before you start the migration…","google-listings-and-ads"),buttons:[(0,a.createElement)(g.A,{key:"1",isSecondary:!0,onClick:i},(0,o.__)("Never mind","google-listings-and-ads")),(0,a.createElement)(g.A,{key:"2",disabled:l,isPrimary:!0,onClick:async()=>{(0,p.ce)("gla_gtin_migration_banner_migration_start",{context:f});try{await r(),(0,p.ce)("gla_gtin_migration_banner_migration_scheduled",{context:f}),n(!1),e("info",(0,o.__)("GTIN Migration was successfully scheduled.","google-listings-and-ads"))}catch(t){(0,p.ce)("gla_gtin_migration_banner_migration_failed",{context:f,error:t.message}),e("error",(0,o.__)("Unable to start GTIN Migration.","google-listings-and-ads"))}}},(0,o.__)("Start migration","google-listings-and-ads"))],onRequestClose:i},(0,a.createElement)("p",null,(0,d.createInterpolateElement)((0,o.__)("This migration will copy all GTIN numbers set in the Google for WooCommerce Product tab into the new GTIN field under the Product Inventory tab. If you have already set GTIN numbers in some of your products' Inventory tab, they will not be overridden. The GTIN numbers in the Google for WooCommerce tab will not be removed. The migration will run in the background and is not reversible. You can check the migration process on the <link>WooCommerce Scheduled Actions page</link>.","google-listings-and-ads"),{link:(0,a.createElement)(v,null)}))),s===A&&(0,a.createElement)(c.Notice,{isDismissible:!1},(0,d.createInterpolateElement)((0,o.__)("The GTIN field managed by WooCommerce in the Product's inventory section, will now be used by Google for WooCommerce. It will continue to support the previous field and any mapping rules you have setup for the GTIN field. If you would like to migrate the data <link>click here</link>.","google-listings-and-ads"),{link:(0,a.createElement)(u.A,{className:"gla-gtin-migration__link",eventName:"gla_gtin_migration_banner_click",eventProps:{context:f},onClick:()=>{(0,p.ce)("gla_modal_open",{context:f}),n(!0)}})})),s===y&&(0,a.createElement)(c.Notice,{isDismissible:!1},(0,d.createInterpolateElement)((0,o.__)("Your GTIN Migration is now running in the background. You can check the migration process on the <link>WooCommerce Scheduled Actions page</link>","google-listings-and-ads"),{link:(0,a.createElement)(v,null)})))};var C=n(3666);let k=[{key:"dashboard",title:(0,o.__)("Dashboard","google-listings-and-ads"),href:(0,s.getNewPath)({},"/google/dashboard",{})},{key:"reports",title:(0,o.__)("Reports","google-listings-and-ads"),href:(0,s.getNewPath)({},"/google/reports",{})},{key:"product-feed",title:(0,o.__)("Product Feed","google-listings-and-ads"),href:(0,s.getNewPath)({},"/google/product-feed",{})},{key:"attribute-mapping",title:(0,o.__)("Attributes","google-listings-and-ads"),href:(0,s.getNewPath)({},"/google/attribute-mapping",{})},{key:"settings",title:(0,o.__)("Settings","google-listings-and-ads"),href:(0,s.getNewPath)({},"/google/settings",{})},{key:"shipping",title:(0,o.__)("Shipping","google-listings-and-ads"),href:(0,C.Qk)()}];l.Th.enableReports||(k=k.filter((({key:e})=>"reports"!==e)));const w=()=>{(0,i.A)();const e=(()=>{const e=(0,s.getPath)();return k.find((t=>e.includes(t.key)))?.key})();return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(b,null),(0,a.createElement)(r.A,{tabs:k,selectedKey:e}))}},2391:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(1609),o=n(7723),s=n(6476),l=n(7892),r=n(3905),i=n(3666),c=n(6473);const d=e=>{const{eventName:t="gla_add_paid_campaign_clicked",eventProps:n,children:d,onClick:u=()=>{},...g}=e,{adsSetupComplete:m}=r.Th,p=m?(0,i.uB)():(0,s.getNewPath)({},"/google/setup-ads",{}),h={context:"",href:p};return(0,a.createElement)(l.A,{isSmall:!0,isSecondary:!0,onClick:(...e)=>{(0,c.ce)(t,{...h,...n}),(0,s.getHistory)().push(p),u(...e)},...g},d||(0,o.__)("Add campaign","google-listings-and-ads"))}},1203:(e,t,n)=>{n.d(t,{A:()=>Z});var a=n(1609),o=n(7723),s=n(6087),l=n(9370),r=n(3164),i=n(9826),c=n(3704),d=n(1177),u=n(6960),g=n(5955),m=n(6427),p=n(6893),h=n(6028),_=n(7108),E=n(3741),f=n(1378),A=n(8242),y=n(7892),v=n(7541),b=n(1455),C=n.n(b),k=n(8468),w=n(3658),N=n(5559),S=n(5640),x=n(3905);var R=n(4297),T=n(6473);const I=({billingUrl:e,onSetupComplete:t})=>{const{googleAdsAccount:n}=(0,f.A)(),l=(0,v.A)(T.T1);if(((e=k.noop)=>{const{createNotice:t}=(0,S.A)(),{receiveGoogleAdsAccountBillingStatus:n}=(0,w.j)(),a=(0,s.useRef)(),l=(0,s.useRef)();l.current=e;const r=(0,s.useCallback)((async()=>{const e=a.current,s=await C()({path:"/wc/gla/ads/billing-status"});if(a.current=s.status,e!==s.status&&s.status===x.CX.APPROVED)try{await C()({path:"/wc/gla/ads/accounts",method:"POST"}),await l.current(),n(s)}catch(e){t("error",(0,o.__)("Unable to complete your Google Ads account setup. Please try again later.","google-listings-and-ads"))}}),[t,n]);(0,N.A)(r,30)})(t),!n)return(0,a.createElement)(E.A,null);const r=t=>{const n=l({link_id:"set-up-billing",href:e});if((0,T.ce)("gla_ads_set_up_billing_click",n),"BUTTON"===t.currentTarget.nodeName){const{defaultView:n}=t.target.ownerDocument,a=(0,R.A)(n,600,800);n.open(e,"_blank",a)}};return(0,a.createElement)(A.A.Card,{className:"gla-google-ads-billing-setup-card"},(0,a.createElement)(A.A.Card.Body,null,(0,a.createElement)("div",{className:"gla-google-ads-billing-setup-card__description"},(0,o.__)("You do not have billing information set up in your Google Ads account. Once you have set up billing, you can start running ads.","google-listings-and-ads"),(0,a.createElement)("div",{className:"gla-google-ads-billing-setup-card__description__helper"},(0,s.createInterpolateElement)((0,o.__)("You will be directed to Google Ads for this step. In case your browser is unable to open the pop-up, <link>click here instead <icon /></link>.","google-listings-and-ads"),{link:(0,a.createElement)("a",{target:"_blank",rel:"external noreferrer noopener",href:e,onClick:r}),icon:(0,a.createElement)(m.Icon,{icon:_.A,size:12})}))),(0,a.createElement)(y.A,{isSecondary:!0,onClick:r},(0,o.__)("Set up billing","google-listings-and-ads"))))},G="https://support.google.com/google-ads/answer/2375375",{APPROVED:F}=x.CX;function P(){const{billingStatus:e,hasFinishedResolution:t}=(0,p.A)();return t?e.status===F?(0,a.createElement)(m.Flex,{className:"gla-google-ads-billing-card__success-status"},(0,a.createElement)(g.A,{size:18}),(0,a.createElement)(m.FlexBlock,null,(0,o.__)("Billing method for Google Ads added successfully","google-listings-and-ads"))):(0,a.createElement)(I,{billingUrl:e.billing_url||G}):(0,a.createElement)(h.A,null)}var M=n(9031),O=n(6734),D=n(4679);const U=e=>{const{countryCodes:t,dailyAverageCost:n=1/0}=e,{data:l,highestDailyBudgetCountryCode:r,highestDailyBudget:i}=(0,D.A)(t),c=(0,O.A)();if(!l)return null;const{currency:d,recommendations:u}=l,g=c[r],p=function(e,...t){const n={strong:(0,a.createElement)("strong",null),em:(0,a.createElement)("em",null),br:(0,a.createElement)("br",null)},l=e?
// translators: it's a range of recommended budget amount. 1: the value of the budget, 2: the currency of amount.
// translators: it's a range of recommended budget amount. 1: the value of the budget, 2: the currency of amount.
(0,o.__)("We recommend running campaigns for at least 1 month so it can learn to optimize for your business.<br /><em>Tip: Most merchants targeting similar countries <strong>set a daily budget of %1$f %2$s</strong></em>","google-listings-and-ads"):
// translators: it's a range of recommended budget amount. 1: the value of the budget, 2: the currency of amount 3: a country name selected by the merchant.
// translators: it's a range of recommended budget amount. 1: the value of the budget, 2: the currency of amount 3: a country name selected by the merchant.
(0,o.__)("We recommend running campaigns for at least 1 month so it can learn to optimize for your business.<br /><em>Tip: Most merchants targeting <strong>%3$s set a daily budget of %1$f %2$s</strong></em>","google-listings-and-ads");return(0,s.createInterpolateElement)((0,o.sprintf)(l,...t),n)}(u.length>1,i,d,g),h=n<i;return(0,a.createElement)("div",{className:"gla-budget-recommendation"},h&&(0,a.createElement)("div",{className:"gla-budget-recommendation__low-budget"},(0,a.createElement)(M.A,null),(0,a.createElement)("div",null,(0,o.__)("With a budget lower than your competitor range, your campaign may not get noticeable results.","google-listings-and-ads"))),(0,a.createElement)(m.Tip,null,p))};var L=n(5588);const q={noPointerEvents:!0,readOnly:!0,tabIndex:-1},B=({formProps:e,countryCodes:t,disabled:n=!1,children:s})=>{const{getInputProps:l,values:r}=e,{amount:i}=r,{googleAdsAccount:c}=(0,f.A)(),d=30.4*i,u=c?.currency;return(0,a.createElement)("div",{className:"gla-budget-section"},(0,a.createElement)(A.A,{verticalGap:4,disabled:n,title:(0,o.__)("Set your budget","google-listings-and-ads"),description:(0,a.createElement)("p",null,(0,o.__)("With Performance Max campaigns, you can set your own budget and Googles Smart Bidding technology will serve the most appropriate ad, with the optimal bid, to maximize campaign performance. You only pay when people click on your ads, and you can start or stop your campaign whenever you want.","google-listings-and-ads"))},(0,a.createElement)(A.A.Card,null,(0,a.createElement)(A.A.Card.Body,{className:"gla-budget-section__card-body"},(0,a.createElement)("div",{className:"gla-budget-section__card-body__cost"},(0,a.createElement)(L.A,{label:(0,o.__)("Daily average cost","google-listings-and-ads"),suffix:u,...l("amount"),...n&&q}),(0,a.createElement)(L.A,{disabled:!0,label:(0,o.__)("Monthly max, estimated","google-listings-and-ads"),suffix:u,value:d})),t?.length>0&&(0,a.createElement)(U,{countryCodes:t,dailyAverageCost:i}))),s))};var $=n(1212),V=n(9452);const j=[{trackId:"how-does-google-ads-work",question:(0,o.__)("How does Google Ads work?","google-listings-and-ads"),answer:(0,o.__)("Google Ads works by displaying your ad when people search online for the products and services you offer. By leveraging smart technology, Google Ads helps get your ads in front of potential customers at just the moment theyre ready to take action.","google-listings-and-ads")},{trackId:"what-is-a-product-feed",question:(0,o.__)("What is a product feed?","google-listings-and-ads"),answer:(0,o.__)("Your product feed is the central data source that contains a list of products you want to advertise through Merchant Center. By default, Google syncs all active products from your WooCommerce inventory. You can choose to exclude products later after this setup.","google-listings-and-ads")},{trackId:"how-much-does-google-ads-cost",question:(0,o.__)("How much does Google Ads cost?","google-listings-and-ads"),answer:(0,o.__)("With Google Ads, you decide how much to spend. Theres no minimum spend, and no time commitment. Your costs may vary from day to day, but you wont be charged more than your daily budget times the number of days in a month. You pay only for the actual clicks and calls that your ad receives.","google-listings-and-ads")},{trackId:"where-will-my-products-appear",question:(0,o.__)("Where will my products appear?","google-listings-and-ads"),answer:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",null,(0,o.__)("If youre selling in the US, then eligible free listings can appear in search results across Google Search, Google Images, and the Google Shopping tab. If youre selling outside the US, free listings will appear on the Shopping tab.","google-listings-and-ads")),(0,a.createElement)("div",null,(0,o.__)("If youre running a Performance Max Campaign, your approved products can appear on Google Search, Google Maps, the Shopping tab, Gmail, Youtube, the Google Display Network, and Discover feed.","google-listings-and-ads")))},{trackId:"how-long-until-i-see-results-with-google-ads",question:(0,o.__)("How long until I see results with Google Ads?","google-listings-and-ads"),answer:(0,o.__)("Googles Performance Max campaigns are powered by machine learning models. These models train and adapt based on the data you provide in your campaign. This means performance optimization can take time. Typically, this learning process takes 1—2 weeks.","google-listings-and-ads")}],W=()=>(0,a.createElement)(V.A,{trackName:"gla_setup_ads_faq",context:"setup-ads",faqItems:j});var z=n(8846),Y=n(6141),H=n(850);function Q(){const e=[{Icon:g.A,content:(0,o.__)("Set a daily budget, and only pay when people click on your ads.","google-listings-and-ads")}];return(0,a.createElement)("div",{className:"gla-paid-ads-features-section__feature-list"},e.map((({Icon:e,content:t},n)=>(0,a.createElement)(m.Flex,{key:n,align:"flex-start"},(0,a.createElement)(e,{size:"18"}),(0,a.createElement)(m.FlexBlock,null,t)))))}function K(){return(0,a.createElement)(A.A,{className:"gla-paid-ads-features-section",topContent:(0,a.createElement)(z.Pill,null,(0,o.__)("Recommended","google-listings-and-ads")),title:(0,o.__)("Performance Max campaign","google-listings-and-ads"),description:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,o.__)("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)(d.A,{context:"setup-paid-ads",linkId:"paid-ads-with-performance-max-campaigns-learn-more",href:"https://support.google.com/google-ads/answer/10724817"},(0,o.__)("Learn more about Performance Max","google-listings-and-ads"))))},(0,a.createElement)(A.A.Card,null,(0,a.createElement)(A.A.Card.Body,null,(0,a.createElement)(H.A,{size:"medium"},(0,a.createElement)(m.Flex,{className:"gla-paid-ads-features-section__content",align:"center",gap:9},(0,a.createElement)(m.FlexBlock,null,(0,a.createElement)(A.A.Card.Title,null,(0,o.__)("Drive more sales with Performance Max","google-listings-and-ads")),(0,a.createElement)("div",{className:"gla-paid-ads-features-section__subtitle"},(0,o.__)("Reach more customers by advertising your products across Google Ads channels like Search, YouTube and Discover. Set up your campaign now so your products are included as soon as theyre approved.","google-listings-and-ads")),(0,a.createElement)(Q,null)),(0,a.createElement)(m.FlexItem,null,(0,a.createElement)($.A,null))),(0,a.createElement)(Y.A,null)))))}var J=n(5847);function Z({campaign:e,headerTitle:t,context:n,skipButton:g,continueButton:m}){const p=(0,u.h5)(),{data:h}=(0,J.A)(),_="setup-mc"===n,E="setup-ads"===n||"create-ads"===n||"edit-ads"===n,f="setup-mc"===n||"setup-ads"===n;let A=(0,s.createInterpolateElement)((0,o.__)("Performance Max campaigns are automatically optimized for you by Google. <link>See what your ads will look like.</link>","google-listings-and-ads"),{link:(0,a.createElement)(d.A,{context:n,linkId:"see-what-ads-look-like",href:"https://support.google.com/google-ads/answer/6275294"})});return _&&(A=(0,o.__)("Youre ready to set up a Performance Max campaign to drive more sales with ads. Your products will be included in the campaign after theyre approved.","google-listings-and-ads")),(0,a.createElement)(l.A,null,(0,a.createElement)(r.A,{title:t,description:A}),_&&(0,a.createElement)(K,null),(0,a.createElement)(B,{formProps:p,countryCodes:"edit-ads"===n?e.displayCountries:h},f&&(0,a.createElement)(P,null),E&&(0,a.createElement)($.B,null)),(0,a.createElement)(i.A,null,(0,a.createElement)(c.A,null,"function"==typeof g?g(p):g,"function"==typeof m?m(p):m),(0,a.createElement)(W,null)))}},8234:(e,t,n)=>{n.d(t,{zK:()=>ee,Ay:()=>ne});var a=n(1609),o=n(7723),s=n(3905),l=n(6960),r=n(9370),i=n(3164),c=n(9826),d=n(3704),u=n(7892),g=n(6087),m=n(6427),p=n(8242),h=n(6942),_=n.n(h),E=n(559),f=n(1455),A=n.n(f),y=n(3832),v=n(8846),b=n(5640),C=n(4301),k=n(6520);function w(){return"."}function N({onAssetsLoaded:e}){const t=(0,g.useRef)({}),n=(0,g.useRef)(),[s,l]=(0,g.useState)([]),[r,i]=(0,g.useState)(!1),[c,d]=(0,g.useState)(!1),{createNotice:m}=(0,b.A)(),{finalUrl:p}=s[0]||{};return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(C.A,{className:"gla-assets-loader",label:(0,a.createElement)(a.Fragment,null,(0,o.__)("Select final URL","google-listings-and-ads"),r&&(0,a.createElement)(v.Spinner,null)),placeholder:(0,o.__)("Search page","google-listings-and-ads"),isSearchable:!0,hideBeforeSearch:!0,excludeSelectedOptions:!1,disabled:c,options:[],selected:s,onSearch:async(e,c)=>{var d;r||i(!0),c!==s[0]?.label&&l([{label:c}]);const u=new Promise((e=>setTimeout(e,300)));if(n.current=u,await u,n.current!==u)return e;const g=t.current,m=c.trim().toLowerCase();return null!==(d=g[m])&&void 0!==d||(g[m]=function(e){const t=`${k.RV}/assets/final-url/suggestions`,n={search:e};return A()({path:(0,y.addQueryArgs)(t,n)})}(m).then((e=>function(e,t){const n=e.map((e=>({finalUrl:e,key:`${e.type}-${e.id}`,keywords:[e.title],label:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"gla-assets-loader__option-title"},e.title),(0,a.createElement)("div",{className:"gla-assets-loader__option-url"},e.url))})));return""===t&&e.length&&n.unshift({key:"disabled-option-suggestion",label:(0,o.__)("SUGGESTIONS","google-listings-and-ads"),isDisabled:!0}),0===e.length&&n.unshift({key:"disabled-option-no-results",label:(0,o.__)("No matching results","google-listings-and-ads"),keywords:[t],isDisabled:!0}),n}(e,m)))),g[m].finally((()=>{i(!1)})),g[m]},onChange:([e])=>{if(e){const t={...e,label:e.finalUrl.title};l([t])}else l([])},getSearchExpression:w}),(0,a.createElement)(u.A,{isSecondary:!0,text:c?"":(0,o.__)("Select","google-listings-and-ads"),eventName:"gla_import_assets_by_final_url_button_click",eventProps:{type:p?.type},disabled:!p,loading:c,onClick:async()=>{const{finalUrl:t}=s[0];d(!0),function(e,t){const n=`${k.RV}/assets/suggestions`,a={id:e,type:t};return A()({path:(0,y.addQueryArgs)(n,a)})}(t.id,t.type).then(e).catch((()=>{d(!1),m("error",(0,o.__)("Unable to load assets data from the selected page.","google-listings-and-ads"))}))}}))}function S({onAssetsChange:e,initialFinalUrl:t,hideFooter:n=!1}){const[l,r]=(0,g.useState)(t||null),i=l?(0,a.createElement)(m.ExternalLink,{href:l},l):(0,o.__)("Choose a page that you want people to reach after clicking your ad. This might be your homepage, or a more specific page.","google-listings-and-ads"),c=_()({"gla-final-url-card":!0,"gla-final-url-card--has-selected-url":l});return(0,a.createElement)(E.A,{className:c,appearance:E.x.FINAL_URL,alignIcon:"top",description:i},(0,a.createElement)(p.A.Card.Footer,{align:"end",gap:4,hidden:n},l?(0,a.createElement)(u.A,{isTertiary:!0,text:(0,o.__)("Or, select a different Final URL","google-listings-and-ads"),eventName:"gla_reselect_another_final_url_button_click",onClick:()=>{r(null),e(null)}}):(0,a.createElement)(N,{onAssetsLoaded:t=>{r(t[s.ll.FINAL_URL]),e(t)}})))}var x=n(5092),R=n(6319),T=n(8468),I=n(9387);function G({minWidth:e,minHeight:t,suggestedWidth:n,suggestedHeight:a,onSelect:s,onDelete:l,ratioPercentError:r=1}){const i=(0,g.useRef)({});return i.current.onSelect=s,i.current.onDelete=l,{openSelector:(0,g.useCallback)((s=>{const{media:l}=wp,c=(0,o.sprintf)(
// translators: 1: Minimum width, 2: Minimum height.
// translators: 1: Minimum width, 2: Minimum height.
(0,o.__)("Image size needs to be at least %1$d x %2$d","google-listings-and-ads"),e,t),d=l({button:{text:(0,o.__)("Select","google-listings-and-ads"),close:!1},states:[new l.controller.Library({title:(0,o.__)("Select or upload image","google-listings-and-ads"),library:l.query({type:"image"}),date:!1,suggestedWidth:n,suggestedHeight:a}),new l.controller.CustomizeImageCropper({imgSelectOptions:(n,a)=>{const o=[n.get("width"),n.get("height"),e,t],s=function(e,t,n,a){const[o,s]=function(e,t,n,a){const o=n/a;return e/t>o?e=Math.round(t*o):t=Math.round(e/o),[e,t]}(...arguments),l=(e-o)/2,r=(t-s)/2;return{handles:!0,instance:!0,persistent:!0,imageWidth:e,imageHeight:t,minWidth:n,minHeight:a,x1:l,y1:r,x2:l+o,y2:r+s,aspectRatio:`${n}:${a}`}}(...o);if(function(e,t,n,a){const o=e/t,s=n/a;return 100*((o>s?o/s:s/o)-1)}(...o)<r){a.set("canSkipCrop",!0);const e=e=>{a.frame.toolbar.get().get("insert").model.set("disabled",e)};a.cropperView.once("image-loaded",(()=>{e(!0)})),s.onSelectEnd=(t,n)=>{e(n.width===s.imageWidth&&n.height===s.imageHeight)}}return s.onSelectChange=(e,t)=>{Number.isNaN(t.width)&&setTimeout((()=>function(e,t,n){const a=getComputedStyle(n),{style:o}=n,s=new Map;["width","height"].forEach((e=>{const t=parseFloat(a[e]);if(Number.isInteger(t)||!Number.isFinite(t))return;s.set(e,[o.getPropertyValue(e),o.getPropertyPriority(e)]);const n=`${Math.ceil(t)}px`;o.setProperty(e,n)}));const{x1:l,y1:r,x2:i,y2:c}=t;e.imgSelect.setSelection(l,r,i,c),e.imgSelect.update(),s.forEach((([e,t],n)=>{o.setProperty(n,e,t)}))}(a,s,e)))},s},control:{params:{}}})]});function u(){if(this===d)return void setTimeout(u);const n=d.state().get("selection"),a=d.toolbar.get();let o;if(n.length){const{width:a,height:s}=n.first().toJSON();o=a<e||s<t}const s=a.primary.el;o?(s.dataset.errorMessage=c,s.classList.add("gla-decorated-error-message"),a.get("select").model.set("disabled",!0)):delete s.dataset.errorMessage}d.on("select",(function(){d.setState("cropper")}),d).on("cropped skippedcrop",(function(e){e instanceof l.model.Attachment&&(e=e.toJSON()),i.current.onSelect(e)}),d).on("close",(function(){const e=d.state("library");e.get("library").off(null,null,d),e.get("selection").off(null,null,d),d.off(null,null,d),d.remove()}),d),d.state("library").get("selection").on("selection:single selection:unsingle",u,d),d.state("library").get("library").once("attachments:received",(function(e){if(!s)return;const t=e.get(s);t&&d.state().get("selection").reset([t])}),d).on("reset",u,d).on("destroy",(function(e){i.current.onDelete(e)}),d),d.open()}),[e,t,n,a,r])}}var F=n(9039),P=n(4978);function M(e){return(0,a.createElement)(u.A,{className:"gla-add-asset-item-button",isLink:!0,icon:(0,a.createElement)(P.A,null),iconSize:16,...e})}function O({imageConfig:e,initialImageUrls:t=[],maxNumberOfImages:n=-1,reachedMaxNumberTip:s,children:l,onChange:r=T.noop}){const i=(0,g.useRef)(),[c,d]=(0,g.useState)(null),[m,p]=(0,g.useState)((()=>t.map((e=>({url:e,id:e,alt:""}))))),h=e=>{p(e),r(e.map((e=>e.url)))};i.current=h;const _=e=>{e.id===c?.id&&d(null),h(m.filter((({id:t})=>t!==e.id)))};(0,g.useEffect)((()=>{n>-1&&m.length>n&&i.current(m.slice(0,n))}),[m,n]);const E=G({...e,onDelete:_,onSelect(e){const t=[...m];let n=t.findIndex((({id:t})=>t===e.id));c&&(-1!==n&&e.id!==c.id&&t.splice(n,1,{...c}),n=t.indexOf(c)),-1===n?t.push(e):t.splice(n,1,e),d(null),h(t)}}),f=(e,t=null)=>{d(t),E.openSelector(t?.id)};return(0,a.createElement)("div",{className:"gla-images-selector"},(0,a.createElement)("div",{className:"gla-images-selector__image-list"},m.map((e=>(0,a.createElement)("div",{key:e.url,className:"gla-images-selector__image-item"},(0,a.createElement)(u.A,{className:"gla-images-selector__replace-image-button","aria-label":(0,o.__)("Replace image","google-listings-and-ads"),onClick:()=>f(0,e)},(0,a.createElement)("img",{className:"gla-images-selector__image",alt:e.alt,src:e.url})),(0,a.createElement)(u.A,{className:"gla-images-selector__remove-image-button","aria-label":(0,o.__)("Remove image","google-listings-and-ads"),icon:(0,a.createElement)(I.A,null),iconSize:20,onClick:()=>_(e)}))))),l,(()=>{const e=-1!==n&&m.length>=n,t=(0,a.createElement)(M,{disabled:e,text:(0,o.__)("Add image","google-listings-and-ads"),onClick:f});return e&&s?(0,a.createElement)(F.A,{placement:"top",text:s},t):t})())}var D=n(4788);function U({initialTexts:e=[],minNumberOfTexts:t=0,maxNumberOfTexts:n=0,maxCharacterCounts:s,addButtonText:l,placeholder:r,children:i,onChange:c=T.noop}){const d=(0,g.useRef)(),[m,p]=(0,g.useState)(e),h=e=>{p(e),c(e)};d.current=h,(0,g.useEffect)((()=>{(n>0&&m.length>n||t>0&&m.length<t)&&d.current(function(e,t,n){const a=Math.max(t-e.length,0),o=Array.from({length:a},(()=>"")),s=[0];return n>0&&s.push(n),e.concat(o).slice(...s)}(m,t,n))}),[m,n,t]);const _=(e,{event:t})=>{const{index:n}=t.target.dataset,a=[...m];a[n]=e.trim(),h(a)},E=e=>{const{index:t}=e.currentTarget.dataset,n=[...m];n.splice(t,1),h(n)},f=[s].flat();return(0,a.createElement)("div",{className:"gla-texts-editor"},(0,a.createElement)("div",{className:"gla-texts-editor__text-list"},m.map(((e,n)=>{var s;const l=null!==(s=f[n])&&void 0!==s?s:f[0];return(0,a.createElement)("div",{key:n,className:"gla-texts-editor__text-item"},(0,a.createElement)(x.A,{className:"gla-texts-editor__text-input",value:e,kindCharacterCount:"google-ads",maxCharacterCount:l,placeholder:r,"data-index":n,onChange:_}),(0,a.createElement)("div",{className:"gla-texts-editor__remove-text-button-anchor"},n+1>t&&(0,a.createElement)(u.A,{className:"gla-texts-editor__remove-text-button","aria-label":(0,o.__)("Remove text","google-listings-and-ads"),icon:(0,a.createElement)(D.A,null),iconSize:20,"data-index":n,onClick:E})))}))),i,(0,a.createElement)(M,{hidden:t>0&&t===n,"aria-label":(0,o.__)("Add text","google-listings-and-ads"),disabled:n>0&&m.length>=n,text:l,onClick:()=>{h(m.concat(""))}}))}var L=n(9491),q=n(3756),B=n(2485),$=n(6257);const V=(0,g.forwardRef)((function({className:e,heading:t,subheading:n,help:s,numOfIssues:l=0,initialExpanded:r=!1,markOptional:i=!1,disabled:c=!1,children:d},m){const p=(0,g.useRef)(),[h,E]=(0,g.useState)(r),f=(0,L.useReducedMotion)();(0,g.useImperativeHandle)(m,(()=>({scrollIntoComponent(){p.current.scrollIntoView({behavior:f?"auto":"smooth",inline:"nearest",block:"nearest"})}})));const A=(0,o.sprintf)(
// translators: %d: number of issues in an asset field.
// translators: %d: number of issues in an asset field.
(0,o._n)("%d issue","%d issues",l,"google-listings-and-ads"),l),y=_()("gla-asset-field",e,!!c&&"gla-asset-field--is-disabled"),b=h&&!c;return(0,a.createElement)("div",{className:y,ref:p},(0,a.createElement)("header",{className:"gla-asset-field__header"},(0,a.createElement)("div",{className:"gla-asset-field__heading-part"},(0,a.createElement)("h2",{className:"gla-asset-field__heading"},t,i&&(0,a.createElement)("span",{className:"gla-asset-field__optional-label"},(0,o._x)("(Optional)","A label behind the heading to indicate a field is optional","google-listings-and-ads")),(0,a.createElement)($.A,{className:"gla-asset-field__help-popover",position:"top",iconSize:20,disabled:c},(0,a.createElement)("div",{className:"gla-asset-field__help-popover__content"},s))),n&&(0,a.createElement)("h3",{className:"gla-asset-field__subheading"},n)),l>0&&(0,a.createElement)(v.Pill,{className:"gla-asset-field__issue-pill"},A),(0,a.createElement)("div",{className:"gla-asset-field__toggle-button-anchor"},(0,a.createElement)(u.A,{className:"gla-asset-field__toggle-button",icon:b?q.A:B.A,"aria-expanded":b,"aria-label":(0,o.__)("Toggle asset","google-listings-and-ads"),disabled:c,onClick:()=>{E(!h)}}))),(0,a.createElement)("div",{className:"gla-asset-field__content",hidden:!b},d))}));var j=n(6023);const W=[{label:"Automated",value:""},{label:"Learn more",value:"learn_more"},{label:"Get quote",value:"get_quote"},{label:"Apply now",value:"apply_now"},{label:"Sign up",value:"sign_up"},{label:"Contact us",value:"contact_us"},{label:"Subscribe",value:"subscribe"},{label:"Download",value:"download"},{label:"Book now",value:"book_now"},{label:"Shop now",value:"shop_now"}];function z(){const e=(0,g.useRef)(),{values:t,setValue:n,getInputProps:r,adapter:{baseAssetGroup:i,validationRequestCount:c,assetGroupErrors:d}}=(0,l.h5)(),u=i[s.Ms.FINAL_URL],p=u?new URL(u).hostname:"",h=Boolean(u),_=r(s.Ms.CALL_TO_ACTION_SELECTION);function E(e){if(!h||0===c)return 0;const t=d[e];return Array.isArray(t)?t.length:t?1:0}function f(e){return 0===E(e)?null:(0,a.createElement)(R.A,{messages:d[e]})}function A(t){e.current||0===E(this)||(e.current=t)}e.current=null,(0,g.useEffect)((()=>{c>0&&e.current&&e.current.scrollIntoComponent()}),[c]);const y=(0,g.useRef)(h);h||(y.current=h);const v=y.current?t:i;return(0,a.createElement)("div",{key:u,className:"gla-asset-group-card"},j.om.map((e=>{const n=v[e.key],o=r(e.key);return(0,a.createElement)(V,{key:e.key,ref:A.bind(e.key),heading:e.heading,subheading:e.subheading,help:e.help,numOfIssues:E(e.key),markOptional:0===e.min,disabled:!h,initialExpanded:h},(0,a.createElement)(O,{initialImageUrls:n,maxNumberOfImages:e.getMax(t),reachedMaxNumberTip:e.getMaxNumberTip(t),imageConfig:e.imageConfig,onChange:o.onChange},f(e.key)))})),j.E1.map((e=>{const t=[v[e.key]].flat(),n=r(e.key);return(0,a.createElement)(V,{key:e.key,ref:A.bind(e.key),heading:e.heading,subheading:(0,a.createElement)(g.Fragment,null,e.subheading,h&&e.extraSubheading),help:e.help,numOfIssues:E(e.key),disabled:!h,initialExpanded:h},(0,a.createElement)(U,{initialTexts:t,minNumberOfTexts:e.min,maxNumberOfTexts:e.max,maxCharacterCounts:e.maxCharacterCounts,placeholder:e.capitalizedName,addButtonText:e.addButtonText,onChange:t=>{e.requiredSingleValue?n.onChange(t[0]):n.onChange(t)}},f(e.key)))})),(0,a.createElement)(V,{className:"gla-asset-field-call-to-action",heading:(0,o.__)("Call to action","google-listings-and-ads"),help:(0,o.__)("Select a call to action that aligns with your goals, or use automated call to action which allows Google to automatically choose the most relevant call to action for you.","google-listings-and-ads"),disabled:!h,initialExpanded:h},(0,a.createElement)(m.SelectControl,{options:W,value:_.value||W[0].value,onChange:_.onChange})),(0,a.createElement)(V,{ref:A.bind(s.Ms.DISPLAY_URL_PATH),className:"gla-asset-field-display-url-path",heading:(0,o.__)("Display URL Path","google-listings-and-ads"),subheading:p,help:(0,a.createElement)(g.Fragment,null,(0,a.createElement)("div",null,(0,o.__)("The display URL gives potential customers a clear idea of what webpage they'll reach once they click your ad, so your path text should describe your ad's landing page.","google-listings-and-ads")),(0,a.createElement)("div",null,(0,o.__)('To create your display URL, Google Ads will combine the domain (for example, "www.google.com" in www.google.com/nonprofits) from your final URL and the path text (for example, "nonprofits" in www.google.com/nonprofits).',"google-listings-and-ads"))),numOfIssues:E(s.Ms.DISPLAY_URL_PATH),markOptional:!0,disabled:!h,initialExpanded:h},j.tY.map(((e,o)=>{const l=t[s.Ms.DISPLAY_URL_PATH];return(0,a.createElement)(g.Fragment,{key:o},(0,a.createElement)("span",{className:"gla-asset-field-display-url-path__slash"},"/"),(0,a.createElement)(x.A,{className:"gla-asset-field-display-url-path__text-input",kindCharacterCount:"google-ads",maxCharacterCount:e.maxCharacterCount,value:l[o]||"",onChange:e=>{const t=l.slice();t[o]=e,n(s.Ms.DISPLAY_URL_PATH,t)}}))})),f(s.Ms.DISPLAY_URL_PATH)))}var Y=n(1177);function H(){const{adapter:e}=(0,l.h5)(),t=e.hasImportedAssets;return(0,a.createElement)(p.A,{className:"gla-asset-group-section",verticalGap:4,title:(0,g.createInterpolateElement)((0,o.__)("Add additional assets <optional>(Optional)</optional>","google-listings-and-ads"),{optional:(0,a.createElement)("span",{className:"gla-asset-group-section__optional-label"})}),description:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",{className:"gla-asset-group-section__primary-description"},(0,o.__)("Upload text and image assets to effectively reach and engage your target shoppers. Google will mix and match your assets, continually testing combinations to create personalized and optimal shopping experiences.","google-listings-and-ads")),(0,a.createElement)("p",null,(0,a.createElement)(Y.A,{context:"asset-group",linkId:"asset-group-learn-more",href:"https://support.google.com/google-ads/answer/10729160"},(0,o.__)("Learn more","google-listings-and-ads"))))},(0,a.createElement)(S,{initialFinalUrl:e.baseAssetGroup[s.Ms.FINAL_URL],onAssetsChange:e.resetAssetGroup,hideFooter:!e.isEmptyAssetEntityGroup}),t&&(0,a.createElement)(m.Tip,null,(0,o.__)("We auto-populated assets directly from your Final URL. We encourage you to edit or add more in order to best showcase your business.","google-listings-and-ads")),(0,a.createElement)(z,null))}var Q=n(9452);const K=[{trackId:"what-will-my-ads-look-like",question:(0,o.__)("What will my ads look like?","google-listings-and-ads"),answer:(0,a.createElement)("div",null,(0,g.createInterpolateElement)((0,o.__)("Google will generate text ads and responsive display ads in various combinations and formats from the headlines, images, and descriptions you add. Your ads will automatically adjust their size, appearance, and format to fit available ad spaces. <link>See common ad formats</link>","google-listings-and-ads"),{link:(0,a.createElement)(Y.A,{context:"assets-faq",linkId:"assets-faq-about-ad-formats-available-in-different-campaign-types",href:"https://support.google.com/google-ads/answer/1722124"})}))},{trackId:"what-makes-these-ads-different-from-product-ads",question:(0,o.__)("What makes these ads different from product ads?","google-listings-and-ads"),answer:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",null,(0,o.__)("Text and image assets can elevate your campaign by offering a variety of ad combinations that capture your audience's attention and generate maximum engagement. By leveraging Google's asset-mixing technology, your ads can be optimized to deliver the right message, to the right people, at the right time.","google-listings-and-ads")),(0,a.createElement)("div",null,(0,o.__)("Compared to product ads—which showcase individual products and are designed to drive direct sales and revenue— ads with creative assets are typically used to highlight your business, generate interest, and attract new customers. While both types of ads can drive conversions, using them together can generate even greater results.","google-listings-and-ads")))}],J=()=>(0,a.createElement)(Q.A,{context:"campaign-management",faqItems:K});var Z=n(6473),X=n(5847);const ee="submit-campaign-and-assets",te="submit-campaign-only";function ne({campaign:e}){const t=!e,{isValidForm:n,handleSubmit:g,adapter:m,values:p}=(0,l.h5)(),{data:h}=(0,X.A)(),{isValidAssetGroup:_,isSubmitting:E,isSubmitted:f,submitter:A}=m,y=A?.dataset.action;function v(n){const a=t?h:e.displayCountries,o=p[s.Ms.FINAL_URL],l={context:t?"campaign-creation":"campaign-editing",action:n.target.dataset.action,audiences:a.join(","),budget:p.amount.toString(),assets_validation:_?"valid":"invalid"};o||(l.assets_validation="unknown"),Object.values(s.Ms).forEach((e=>{const t=`number_of_${e}`,n=[p[e]].flat().filter(Boolean).length;l[t]=o?n.toString():"unknown"})),(0,Z.ce)("gla_submit_campaign_button_click",l)}return(0,a.createElement)(r.A,null,(0,a.createElement)(i.A,{title:(0,o.__)("Optimize your campaign","google-listings-and-ads"),description:(0,o.__)("Drive greater performance by adding text and image assets to create personalized and engaging ads","google-listings-and-ads")}),(0,a.createElement)(H,null),(0,a.createElement)(c.A,null,(0,a.createElement)(d.A,null,(t||m.isEmptyAssetEntityGroup)&&(0,a.createElement)(u.A,{isTertiary:!0,"data-action":te,disabled:!n||f||y===ee,loading:E&&y===te,onClick:e=>{g(e),v(e)}},(0,o.__)("Skip this step","google-listings-and-ads")),(0,a.createElement)(u.A,{isPrimary:!0,"data-action":ee,disabled:!m.baseAssetGroup[s.Ms.FINAL_URL]||f||y===te,loading:E&&y===ee,onClick:e=>{_?g(e):m.showValidation(),v(e)}},t?(0,o.__)("Create campaign","google-listings-and-ads"):(0,o.__)("Save changes","google-listings-and-ads"))),(0,a.createElement)(J,null)))}},8473:(e,t,n)=>{n.d(t,{A:()=>p});var a=n(1609),o=n(6087),s=n(8468),l=n(3905),r=n(6960),i=n(7723);const c=(e,t)=>{if(Number.isFinite(e.amount)&&Number.isFinite(t.dailyBudget)&&t.dailyBudget>0){const{amount:n}=e,{dailyBudget:a,formatAmount:o}=t,s=Math.ceil(.3*a);if(n<s)return{amount:(0,i.sprintf)(/* translators: %1$s: minimum daily budget */ /* translators: %1$s: minimum daily budget */
(0,i.__)("Please make sure daily average cost is at least %s","google-listings-and-ads"),o(s))}}return!Number.isFinite(e.amount)||e.amount<=0?{amount:(0,i.__)("Please make sure daily average cost is greater than 0.","google-listings-and-ads")}:{}};var d=n(399),u=n(6023),g=n(7419);const m={[l.Ms.FINAL_URL]:null,[l.Ms.BUSINESS_NAME]:"",[l.Ms.MARKETING_IMAGE]:[],[l.Ms.SQUARE_MARKETING_IMAGE]:[],[l.Ms.PORTRAIT_MARKETING_IMAGE]:[],[l.Ms.LOGO]:[],[l.Ms.HEADLINE]:[],[l.Ms.LONG_HEADLINE]:[],[l.Ms.DESCRIPTION]:[],[l.Ms.CALL_TO_ACTION_SELECTION]:null,[l.Ms.DISPLAY_URL_PATH]:[]};function p({initialCampaign:e,assetEntityGroup:t,recommendedDailyBudget:n,...p}){const h=(0,o.useMemo)((()=>function(e={}){const{assets:t={}}=e,n={...m};return Object.keys(m).forEach((a=>{if(e.hasOwnProperty(a))n[a]=e[a];else if(t.hasOwnProperty(a)){const e=t[a];Array.isArray(e)?n[a]=e.map((({content:e})=>e)):n[a]=e.content}})),n}(t)),[t]),[_,E]=(0,o.useState)(h),[f,A]=(0,o.useState)(!1),{formatAmount:y}=(0,g.A)();return(0,a.createElement)(r.Ay,{initialValues:{...e,...h},validate:e=>c(e,{dailyBudget:n,formatAmount:y}),extendAdapter:e=>{const n=function(e){const t={};u.om.forEach((n=>{e[n.key].length<n.min&&(t[n.key]=(0,i.sprintf)(
// translators: 1: The minimal number of this item. 2: Asset field name.
// translators: 1: The minimal number of this item. 2: Asset field name.
(0,i._n)("Add at least %1$d %2$s image","Add at least %1$d %2$s images",n.min,"google-listings-and-ads"),n.min,n.lowercaseName))}));const n=(0,d.A)("google-ads");u.E1.forEach((a=>{const o=[],s=[e[a.key]].flat(),l=s.filter(Boolean);if(a.min>=2&&Array.isArray(a.maxCharacterCounts)){const[e,t]=a.maxCharacterCounts;if(e<t&&""===s[0]){const e=(0,i.sprintf)(
// translators: Asset field name.
// translators: Asset field name.
(0,i.__)("The %s in the first field is required","google-listings-and-ads"),a.lowercaseSingularName);o.push(e)}}if(l.length<a.min){const e=1===a.min?a.lowercaseSingularName:a.lowercasePluralName,t=a.requiredSingleValue?
// translators: 1: Asset field name.
// translators: 1: Asset field name.
(0,i.__)("The %1$s is required","google-listings-and-ads"):
// translators: 1: Asset field name. 2: The minimal number of this item.
// translators: 1: Asset field name. 2: The minimal number of this item.
(0,i.__)("Add at least %2$d %1$s","google-listings-and-ads"),n=(0,i.sprintf)(t,e,a.min);o.push(n)}if(new Set(l).size!==l.length){const e=(0,i.sprintf)(
// translators: Asset field name.
// translators: Asset field name.
(0,i.__)("%s are identical","google-listings-and-ads"),a.heading);o.push(e)}const r=[a.maxCharacterCounts].flat();s.forEach(((e,t)=>{var s;const l=null!==(s=r[t])&&void 0!==s?s:r[0];if(n(e)>l){const e=a.requiredSingleValue?(0,i.__)("Character limit exceeded","google-listings-and-ads"):
// translators: 1: Asset field name. 2: The sequential number of the asset field.
// translators: 1: Asset field name. 2: The sequential number of the asset field.
(0,i.__)("%1$s %2$d: Character limit exceeded","google-listings-and-ads"),n=(0,i.sprintf)(e,a.capitalizedName,t+1);o.push(n)}})),o.length&&(t[a.key]=o)}));const a=e[l.Ms.DISPLAY_URL_PATH];if(a.length){const e=[],[o,s]=a;if(!o&&s){const t=(0,i.sprintf)(
// translators: Asset field name.
// translators: Asset field name.
(0,i.__)("%s is incomplete","google-listings-and-ads"),u.tY[0].capitalizedName);e.push(t)}u.tY.forEach(((t,o)=>{const s=a[o]||"";if(n(s)>t.maxCharacterCount){const n=(0,i.sprintf)(
// translators: Asset field name.
// translators: Asset field name.
(0,i.__)("%s: Character limit exceeded","google-listings-and-ads"),t.capitalizedName);e.push(n)}})),e.length&&(t[l.Ms.DISPLAY_URL_PATH]=e)}return t}(e.values),a=t?.[l.ll.FINAL_URL];return{isEmptyAssetEntityGroup:!a,baseAssetGroup:_,assetGroupErrors:n,hasImportedAssets:f,isValidAssetGroup:0===Object.keys(n).length,resetAssetGroup(t){const n=(0,s.isPlainObject)(t)?t:h;let a=!1;Object.keys(m).forEach((o=>{t&&t[o]?.length&&(a=!0),e.setValue(o,n[o])})),A(a),E(n),e.adapter.hideValidation()}}},...p})}},1212:(e,t,n)=>{n.d(t,{B:()=>z,A:()=>$});var a=n(1609),o=n(7723),s=n(6087),l=n(4038),r=n(6488),i=n(4111),c=n.n(i),d=n(5703),u=n(7133),g=n(9415),m=n(3741),p=n(6942),h=n.n(p);const _={default:!1,thinnest:"gla-ads-mockup__placeholder--thinnest",thinner:"gla-ads-mockup__placeholder--thinner",thicker:"gla-ads-mockup__placeholder--thicker",blue:"gla-ads-mockup__placeholder--blue","gray-100":"gla-ads-mockup__placeholder--gray-100","gray-200":"gla-ads-mockup__placeholder--gray-200","gray-300":"gla-ads-mockup__placeholder--gray-300","gray-400":"gla-ads-mockup__placeholder--gray-400","gray-500":"gla-ads-mockup__placeholder--gray-500"};function E({width:e,color:t="gray-100",stroke:n="default"}){const o=h()("gla-ads-mockup__placeholder",_[t],_[n]);let s;return void 0!==e&&(s={width:/^\d+$/.test(e)?`${e}px`:e}),(0,a.createElement)("div",{className:o,style:s})}const f={default:!1,adBadge:"gla-ads-mockup__scaled-text--ad-badge",smaller:"gla-ads-mockup__scaled-text--smaller",larger:"gla-ads-mockup__scaled-text--larger",blue:"gla-ads-mockup__scaled-text--blue","gray-700":"gla-ads-mockup__scaled-text--gray-700","gray-800":"gla-ads-mockup__scaled-text--gray-800"};function A({adBadge:e=!1,size:t="default",color:n="gray-700",children:o}){const s=h()("gla-ads-mockup__scaled-text",f[n],f[t],e&&f.adBadge);return(0,a.createElement)("div",{className:s,children:o})}function y({product:e}){const t={backgroundImage:`url(${e.coverUrl})`};return(0,a.createElement)("div",{className:"gla-ads-mockup__product-cover",style:t})}const v=n.p+"images/js/src/images/campaign-preview/53f7ebba3e0e05545002.google-shopping-logo.svg";var b=n(6227);const C=n.p+"images/js/src/images/campaign-preview/6ad8e32cee58c14f05a5.youtube-logo.svg";var k=n(6427),w=n(6740);function N({hideMenu:e=!1}){return(0,a.createElement)("div",{className:"gla-ads-mockup__search-bar"},(0,a.createElement)(w.A,{size:13}),(0,a.createElement)("div",{className:"gla-ads-mockup__search-bar-menu",hidden:e},(0,a.createElement)(E,{stroke:"thinnest",color:"gray-400"}),(0,a.createElement)(E,{stroke:"thinnest",color:"gray-400"}),(0,a.createElement)(E,{stroke:"thinnest",color:"gray-400"})))}function S({product:e}){const t={backgroundImage:`url(${e.shopLogoUrl})`};return(0,a.createElement)("div",{className:"gla-ads-mockup__shop-logo",style:t})}var x=n(9692);function R({product:e}){return(0,a.createElement)("div",{className:"gla-ads-mockup__product-banner"},(0,a.createElement)("div",{className:"gla-ads-mockup__product-banner-info"},(0,a.createElement)(A,{size:"smaller",adBadge:!0},e.shopName),(0,a.createElement)(E,{stroke:"thinner",width:"85",color:"gray-300"}),(0,a.createElement)(E,{stroke:"thinner",width:"65",color:"gray-300"}),(0,a.createElement)(E,{stroke:"thinner",width:"27",color:"blue"})),(0,a.createElement)(S,{product:e}))}const T=n.p+"images/js/src/images/campaign-preview/ccb636afd5f179a2a92c.gmail-logo.svg";function I(){return(0,a.createElement)("div",{className:"gla-ads-mockup__mail-item"},(0,a.createElement)(E,{stroke:"thinner",color:"gray-200",width:"65"}),(0,a.createElement)(E,{stroke:"thinner",color:"gray-200"}),(0,a.createElement)(E,{stroke:"thinner",width:"122"}))}var G=n(3230);const F=n.p+"images/js/src/images/campaign-preview/e398c276792a4a469b92.ad-corner-buttons-image.svg";var P=n(3423);const M=n.p+"images/js/src/images/campaign-preview/093d4a30c2447b174c17.map-background.png",O=n.p+"images/js/src/images/campaign-preview/8955ab13b4b35353af90.product-sample-image.jpg",D=n.p+"images/js/src/images/campaign-preview/26a3f83547ba2af2f541.shop-sample-logo.png";var U=n(3905);const L={title:(0,o._x)("White tee","A sample product title for demonstrating the paid ads shown on Google services.","google-listings-and-ads"),price:(0,o._x)("$10.00","A sample product price for demonstrating the paid ads shown on Google services.","google-listings-and-ads"),shopName:(0,o._x)("Colleen's Tee Store","A sample name of an online shop for demonstrating the paid ads shown on Google services.","google-listings-and-ads"),coverUrl:O,shopLogoUrl:D,shopUrl:"colleensteestore.com"},q={page:1,per_page:1,orderby:"total_sales",order:"desc"},B=[function({product:e}){return(0,a.createElement)("div",{className:"gla-ads-mockup"},(0,a.createElement)("div",{className:"gla-ads-mockup__tab-list"},(0,a.createElement)(E,{stroke:"thicker"}),(0,a.createElement)(E,{stroke:"thicker"}),(0,a.createElement)("div",{className:"gla-ads-mockup__tab-item-with-logo"},(0,a.createElement)("img",{height:"30",src:v,alt:(0,o.__)("Google Shopping Logo","google-listings-and-ads")}),(0,a.createElement)(E,{stroke:"thinner",color:"gray-500"})),(0,a.createElement)(E,{stroke:"thicker"})),(0,a.createElement)("div",{className:"gla-ads-mockup__shopping-product"},(0,a.createElement)(y,{product:e}),(0,a.createElement)("div",{className:"gla-ads-mockup__shopping-product-info"},(0,a.createElement)(A,{size:"larger",color:"gray-800"},e.title),(0,a.createElement)(A,{color:"gray-800"},e.price),(0,a.createElement)(A,{size:"smaller"},e.shopName))))},function({product:e}){return(0,a.createElement)("div",{className:"gla-ads-mockup"},(0,a.createElement)("div",{className:"gla-ads-mockup__youtube-header"},(0,a.createElement)("img",{height:"16",src:C,alt:(0,o.__)("YouTube Logo","google-listings-and-ads")})),(0,a.createElement)("div",{className:"gla-ads-mockup__youtube-product"},(0,a.createElement)(y,{product:e}),(0,a.createElement)("div",{className:"gla-ads-mockup__youtube-learn-more-row"},(0,a.createElement)("div",null,(0,a.createElement)(A,{size:"smaller",color:"blue"},(0,o.__)("LEARN MORE","google-listings-and-ads"))),(0,a.createElement)(b.A,{size:10})),(0,a.createElement)("div",{className:"gla-ads-mockup__youtube-product-info"},(0,a.createElement)(A,{size:"larger",color:"gray-800"},e.title),(0,a.createElement)(E,null),(0,a.createElement)(E,{width:"135"}),(0,a.createElement)(A,{size:"smaller",adBadge:!0},e.shopName))))},function({product:e}){return(0,a.createElement)("div",{className:"gla-ads-mockup gla-ads-mockup-search"},(0,a.createElement)("div",{className:"gla-ads-mockup__search-header"},(0,a.createElement)("img",{height:"22",src:x,alt:(0,o.__)("Google Logo","google-listings-and-ads")})),(0,a.createElement)(N,{hideMenu:!0}),(0,a.createElement)("div",{className:"gla-ads-mockup__search-keywords"},(0,a.createElement)(E,{width:"30",stroke:"thicker",color:"gray-500"}),(0,a.createElement)(E,{width:"42",stroke:"thicker"}),(0,a.createElement)(E,{width:"32",stroke:"thicker"}),(0,a.createElement)(E,{width:"45",stroke:"thicker"}),(0,a.createElement)(E,{width:"30",stroke:"thinner",color:"gray-500"})),(0,a.createElement)("div",{className:"gla-ads-mockup__search-card"},(0,a.createElement)("div",{className:"gla-ads-mockup__search-card-header"},(0,a.createElement)(A,{size:"smaller",adBadge:!0},e.shopUrl),(0,a.createElement)(E,{stroke:"thinner",width:"79",color:"blue"})),(0,a.createElement)(k.Flex,{align:"stretch"},(0,a.createElement)("div",{className:"gla-ads-mockup__search-card-placeholders"},(0,a.createElement)(E,{width:"100"}),(0,a.createElement)(E,{width:"97"}),(0,a.createElement)(E,{width:"95"}),(0,a.createElement)(E,{width:"99"}),(0,a.createElement)(E,{width:"90"}),(0,a.createElement)(E,{width:"78"})),(0,a.createElement)(S,{product:e}))),(0,a.createElement)("div",{className:"gla-ads-mockup__search-card"},(0,a.createElement)("div",{className:"gla-ads-mockup__search-card-placeholders"},(0,a.createElement)(E,{stroke:"thinner",width:"79",color:"gray-400"}),(0,a.createElement)(E,{stroke:"thinner",color:"gray-300"}),(0,a.createElement)(E,{width:"122"}),(0,a.createElement)(E,{width:"108"}),(0,a.createElement)(E,{width:"100"}),(0,a.createElement)(E,{width:"55"}))),(0,a.createElement)("div",{className:"gla-ads-mockup__search-card"},(0,a.createElement)("div",{className:"gla-ads-mockup__search-card-placeholders"},(0,a.createElement)(E,{stroke:"thinner",width:"79",color:"gray-400"}))))},function({product:e}){return(0,a.createElement)("div",{className:"gla-ads-mockup gla-ads-mockup-map",style:{backgroundImage:`url(${M})`}},(0,a.createElement)(N,null),(0,a.createElement)(P.A,{size:45}),(0,a.createElement)(R,{product:e}))},function({product:e}){return(0,a.createElement)("div",{className:"gla-ads-mockup gla-ads-mockup-display"},(0,a.createElement)("div",{className:"gla-ads-mockup__display-placeholders"},(0,a.createElement)(E,{stroke:"thinner",color:"gray-300"}),(0,a.createElement)(E,{stroke:"thinner",color:"gray-300",width:"146"}),(0,a.createElement)(E,{stroke:"thinner",color:"gray-300",width:"149"}),(0,a.createElement)(E,{stroke:"thinner",color:"gray-300",width:"135"})),(0,a.createElement)("div",{className:"gla-ads-mockup__display-product"},(0,a.createElement)("div",{className:"gla-ads-mockup__display-product-locator"},(0,a.createElement)(y,{product:e}),(0,a.createElement)("img",{className:"gla-ads-mockup__display-corner-buttons",src:F,alt:(0,o.__)("Simulated the info and close buttons at the corner of a Google ad","google-listings-and-ads")}),(0,a.createElement)("div",{className:"gla-ads-mockup__display-chevron-button"},(0,a.createElement)(G.A,{size:16}))),(0,a.createElement)(E,{stroke:"thinner",color:"gray-500"})),(0,a.createElement)("div",{className:"gla-ads-mockup__display-placeholders"},(0,a.createElement)(E,null),(0,a.createElement)(E,{width:"151"}),(0,a.createElement)(E,{width:"135"}),(0,a.createElement)(E,null),(0,a.createElement)(E,null),(0,a.createElement)(E,{width:"151"})))},function({product:e}){return(0,a.createElement)("div",{className:"gla-ads-mockup gla-ads-mockup-gmail"},(0,a.createElement)("div",{className:"gla-ads-mockup__gmail-header"},(0,a.createElement)("img",{height:"15",src:T,alt:(0,o.__)("Gmail Logo","google-listings-and-ads")}),(0,a.createElement)(N,{hideMenu:!0})),(0,a.createElement)(R,{product:e}),(0,a.createElement)(I,null),(0,a.createElement)(I,null),(0,a.createElement)(I,null),(0,a.createElement)(I,null),(0,a.createElement)(I,null))}],$=(0,s.forwardRef)((function({autoplay:e=!0},t){const[n,o]=(0,s.useState)(0),{second:i,callCount:p,startCountdown:h}=(0,u.A)(),{hasFinishedResolution:_,data:E}=(0,g.A)("getMCProductFeed",q),f=e&&_,A=(0,s.useCallback)((e=>{o((t=>(t+e+B.length)%B.length))}),[]);if((0,s.useEffect)((()=>{f&&0===i&&(p>0&&A(1),h(5))}),[f,i,p,h,A]),(0,s.useImperativeHandle)(t,(()=>({moveBy:A}))),!_)return(0,a.createElement)("div",{className:"gla-ads-mockup"},(0,a.createElement)(m.A,null));const y=B[n],v=function(e=[]){const t=c()((0,d.getSetting)("currency")),[n={}]=e,{title:a,price:o,image_url:s}=n,l={title:a,coverUrl:s,price:t.formatAmount(o),shopName:(0,d.getSetting)("siteTitle"),shopUrl:new URL((0,d.getSetting)("homeUrl")).host,shopLogoUrl:U.Th.siteLogoUrl};return Object.entries(l).forEach((([e,t])=>{t||(l[e]=L[e])})),l}(E?.products);return(0,a.createElement)(l.A,{className:"gla-campaign-preview"},(0,a.createElement)(r.A,{key:n,classNames:"gla-campaign-preview__transition-blur",timeout:500},(0,a.createElement)(y,{product:v})))}));var V=n(8687),j=n(8242),W=n(7892);function z(){const e=(0,s.useRef)(),t=t=>{const n=Number(t.currentTarget.dataset.step);e.current.moveBy(n)};return(0,a.createElement)(j.A.Card,{className:"gla-campaign-preview-card"},(0,a.createElement)(j.A.Card.Body,null,(0,a.createElement)(k.Flex,{align:"start",gap:9,direction:["column","row"]},(0,a.createElement)(k.FlexBlock,null,(0,a.createElement)(j.A.Card.Title,null,(0,o.__)("Preview product ad","google-listings-and-ads")),(0,a.createElement)("div",null,(0,o.__)("Each of your product variants will have its own ad. Previews shown here are examples and don't include all possible formats.","google-listings-and-ads"))),(0,a.createElement)(k.FlexItem,null,(0,a.createElement)(k.Flex,{align:"center",gap:5},(0,a.createElement)(W.A,{className:"gla-campaign-preview-card__moving-button",icon:(0,a.createElement)(V.A,null),iconSize:16,onClick:t,"data-step":"-1"}),(0,a.createElement)($,{ref:e,autoplay:!1}),(0,a.createElement)(W.A,{className:"gla-campaign-preview-card__moving-button",icon:(0,a.createElement)(G.A,null),iconSize:16,onClick:t,"data-step":"1"}))))))}},4831:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),o=n(7723),s=n(7892);const l=({formProps:e,onClick:t})=>(0,a.createElement)(s.A,{isPrimary:!0,text:(0,o.__)("Continue","google-listings-and-ads"),disabled:!e.isValidForm,onClick:t})},4307:(e,t,n)=>{n.d(t,{A:()=>s,m:()=>o});var a=n(3905);function o(e,t){const n=[],o=e.assets;function s(e,...t){const a=t.map((t=>({...t,content:null,field_type:e})));n.push(...a)}return Object.values(a.ZD).forEach((e=>{const a=[t[e]].flat().filter(Boolean),l=[o[e]].flat().filter(Boolean);let r=0;a.forEach((t=>{do{const n=l[r];if(t===n?.content)break;n&&s(e,n),r+=1}while(r<l.length);r>=l.length&&n.push({id:null,content:t,field_type:e}),r+=1})),s(e,...l.slice(r))})),n}function s(e,t){const[n,s]=t[a.Ms.DISPLAY_URL_PATH],l=o(e,t);return{final_url:t[a.Ms.FINAL_URL],path1:n,path2:s,assets:l}}},8864:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(1609);const o=e=>{const{className:t="",...n}=e;return(0,a.createElement)("span",{className:`gla-radio-helper-text ${t}`,...n})}},4301:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(1609),o=n(8846),s=n(6942),l=n.n(s);const r=e=>{const{label:t,helperText:n,className:s,...r}=e;return(0,a.createElement)("div",{className:l()("gla-searchable-select-control",s)},t&&(0,a.createElement)("div",{className:"gla-searchable-select-control__label"},t),(0,a.createElement)("div",{className:"gla-searchable-select-control__input"},(0,a.createElement)(o.SelectControl,{...r,help:""})),n&&(0,a.createElement)("div",{className:"gla-searchable-select-control__helper-text"},n))}},8242:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(1609),o=n(6942),s=n.n(o),l=n(6427);var r=n(8771);const i=({size:e="",...t})=>(0,a.createElement)(l.Card,{...t,size:e});i.Body=e=>{const{className:t,...n}=e;return(0,a.createElement)(l.CardBody,{className:s()("gla-section-card-body",t),...n})},i.Footer=e=>{const{children:t,...n}=e;return(0,a.createElement)(l.CardFooter,{className:"gla-section-card-footer",...n},t)},i.Title=e=>{const{className:t,...n}=e;return(0,a.createElement)(r.A.Title,{className:s()("gla-section-card-title",t),...n})};const c=({className:e,title:t,description:n,topContent:o,children:r,disabled:i,disabledLeft:c,verticalGap:d=6})=>{const u=s()("gla-section",!!i&&"gla-section--is-disabled",!!c&&"gla-section--is-disabled-left",e);return(0,a.createElement)("section",{className:u},(0,a.createElement)("header",{className:"gla-section__header"},o&&(0,a.createElement)("p",null,o),t&&(0,a.createElement)("h1",null,t),n),(0,a.createElement)(l.Flex,{className:"gla-section__body",direction:"column",gap:d},r))};c.Card=i;const d=c},6028:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),o=n(3741),s=n(8242);const l=()=>(0,a.createElement)(s.A.Card,null,(0,a.createElement)(s.A.Card.Body,null,(0,a.createElement)(o.A,null)))},3704:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(1609);const o=e=>{const{className:t="",...n}=e;return(0,a.createElement)("div",{className:`gla-step-content-actions ${t}`,...n})}},9826:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1609),o=n(8242);const s=({children:e})=>(0,a.createElement)(o.A,{className:"gla-step-content-footer",verticalGap:10},e)},3164:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(1609);const o=e=>{const{className:t="",title:n,description:o}=e;return(0,a.createElement)("header",{className:`gla-step-content-header ${t}`},(0,a.createElement)("h1",null,n),(0,a.createElement)("div",{className:"gla-step-content-header__description"},o))}},9370:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(1609);const o=e=>{const{className:t="",children:n,...o}=e;return(0,a.createElement)("div",{className:`gla-step-content ${t}`,...o},(0,a.createElement)("div",{className:"gla-step-content__container"},n))}},7539:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),o=n(8846),s=n(8687);const l=({title:e,backHref:t,helpButton:n,onBackButtonClick:l})=>(0,a.createElement)("div",{className:"gla-stepper-top-bar"},(0,a.createElement)(o.Link,{className:"components-button gla-stepper-top-bar__back-button",href:t,type:"wc-admin",onClick:l},(0,a.createElement)(s.A,null)),(0,a.createElement)("span",{className:"gla-stepper-top-bar__title"},e),n)},8771:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(1609),o=n(6942),s=n.n(o);const l=e=>{const{className:t="",...n}=e;return(0,a.createElement)("div",{className:`gla-subsection ${t}`,...n})};l.Title=e=>{const{className:t,...n}=e;return(0,a.createElement)("div",{className:s()("gla-subsection-title",t),...n})},l.Subtitle=e=>{const{className:t,...n}=e;return(0,a.createElement)("div",{className:s()("gla-subsection-subtitle",t),...n})},l.Body=e=>{const{children:t}=e;return(0,a.createElement)("div",{className:"gla-subsection-body"},t)},l.HelperText=e=>{const{className:t,children:n}=e;return(0,a.createElement)("div",{className:s()("gla-subsection-helper-text",t)},n)};const r=l},6397:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1609),o=n(4848);const s=({size:e=18})=>(0,a.createElement)(o.A,{className:"gla-success-icon",size:e})},4473:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(1609),o=n(4015),s=n(6942),l=n.n(s);const r=({size:e=18,className:t})=>(0,a.createElement)(o.A,{className:l()("gla-sync-icon",t),size:e})},9788:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(7723),s=n(8846),l=n(6277),r=n(8146);const i="dashboard-feature--campaign-assets";function c({referenceElementCssSelector:e}){const{tourChecked:t,setTourChecked:n}=(0,r.A)(i);if(t)return null;const c={steps:[{referenceElements:{desktop:e},meta:{heading:(0,a.createElement)("div",{className:"gla-campaign-assets-tour__heading"},(0,a.createElement)(l.A,null),(0,o.__)("Optimize your campaign","google-listings-and-ads"),(0,a.createElement)(s.Pill,null,(0,o._x)("New","A highlighting label behind the heading of the new feature","google-listings-and-ads"))),descriptions:{desktop:(0,a.createElement)(a.Fragment,null,(0,o.__)("Add images, headlines, and descriptions to drive better engagement and more sales.","google-listings-and-ads"),(0,a.createElement)("br",null),(0,a.createElement)("br",null),(0,o.__)("Edit your campaign to explore this new feature.","google-listings-and-ads"))}}}],options:{classNames:"gla-admin-page,gla-campaign-assets-tour",effects:{overlay:!1}},placement:"top",closeHandler:()=>n(!0)};return(0,a.createElement)(s.TourKit,{config:c})}},5246:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(1609),o=n(7723),s=n(6087),l=n(8846),r=n(8146);const i="rebranding-tour";function c(){const{tourChecked:e,setTourChecked:t}=(0,r.A)(i);if(e)return null;const n={steps:[{referenceElements:{desktop:'.toplevel_page_woocommerce-marketing a[href*="google"]',mobile:"#wp-admin-bar-menu-toggle"},meta:{heading:(0,a.createElement)("div",{className:"gla-rebranding-tour__heading"},(0,o.__)("New name, same great solution","google-listings-and-ads")),descriptions:{desktop:(0,a.createElement)(a.Fragment,null,(0,s.createInterpolateElement)((0,o.__)("Google Listings & Ads is now <strong>Google for WooCommerce</strong>.","google-listings-and-ads"),{strong:(0,a.createElement)("strong",null)}))}}}],options:{classNames:"gla-admin-page,gla-rebranding-tour",effects:{overlay:!1}},closeHandler:()=>t(!0)};return(0,a.createElement)(l.TourKit,{config:n})}},2848:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(1609),o=n(8846),s=n(6473);const l=e=>{const{eventName:t,eventProps:n,onClick:l=()=>{},...r}=e;return(0,a.createElement)(o.Link,{...r,onClick:e=>{t&&(0,s.ce)(t,n),l(e)}})}},6319:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(1609);function o({messages:e}){let t=e;return e?.length?(Array.isArray(e)||(t=[e]),(0,a.createElement)("ul",{className:"gla-validation-errors"},t.map((e=>(0,a.createElement)("li",{key:e},e))))):null}},850:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(1609),o=n(6942),s=n.n(o);const l={normal:!1,medium:"gla-vertical-gap-layout__medium",large:"gla-vertical-gap-layout__large",overlap:"gla-vertical-gap-layout__overlap"},r=e=>{const{className:t,size:n="normal",...o}=e;return(0,a.createElement)("div",{className:s()("gla-vertical-gap-layout",l[n],t),...o})}},7792:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1609),o=n(9031);const s=({size:e=18})=>(0,a.createElement)(o.A,{className:"gla-warning-icon",size:e})},4790:(e,t,n)=>{n.d(t,{s9:()=>h,LJ:()=>i,Ay:()=>_});var a=n(1609),o=n(7723);function s(e){return"yes"!==e.active?"":"yes"===e.owner?e.email:(0,o.__)("Successfully connected through Jetpack","google-listings-and-ads")}var l=n(559),r=n(4566);const i=({jetpack:e})=>(0,a.createElement)(l.A,{appearance:l.x.WPCOM,description:s(e),indicator:(0,a.createElement)(r.A,null)});var c=n(3832),d=n(3905),u=n(6520),g=n(7892),m=n(5640),p=n(6599);const h=()=>{const{createNotice:e}=(0,m.A)(),t=d.Th.mcSetupComplete?"reconnect":"setup-mc",n={next_page_name:t},s=(0,c.addQueryArgs)(`${u.RV}/jetpack/connect`,n),[r,{loading:i,data:h}]=(0,p.A)({path:s});return(0,a.createElement)(l.A,{appearance:l.x.WPCOM,description:(0,o.__)("Required to connect with Google","google-listings-and-ads"),indicator:(0,a.createElement)(g.A,{isSecondary:!0,loading:i||h,eventName:"gla_wordpress_account_connect_button_click",eventProps:{context:t},onClick:async()=>{try{const e=await r();window.location.href=e.url}catch(t){e("error",(0,o.__)("Unable to connect your WordPress.com account. Please try again later.","google-listings-and-ads"))}}},(0,o.__)("Connect","google-listings-and-ads"))})},_=({jetpack:e})=>"yes"===e.active?(0,a.createElement)(i,{jetpack:e}):(0,a.createElement)(h,null)},6727:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(6476),o=n(3905),s=n(7951);const l=()=>{const e=(0,s.A)()[o.Tj]?o.Tj:o.ds;return(0,a.getQuery)()?.issueType||e}},1968:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(5703);const o=()=>(0,a.getSetting)("adminUrl")},1209:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(7143),o=n(3658),s=n(3905),l=n(2224);const r="getAdsCampaigns",i=(...e)=>{const t=(0,l.A)(e);return(0,a.useSelect)((e=>{const{adsSetupComplete:n}=s.Th;if(!n)return{loading:!1,loaded:!0,data:[]};const a=e(o.U),l=a[r](...t);return{loading:a.isResolving(r,t),loaded:a.hasFinishedResolution(r,t),data:l}}),[t])}},7419:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(6087),o=n(4111),s=n.n(o),l=n(3772),r=n(1378);function i(){const e=(0,l.A)(),{googleAdsAccount:t}=(0,r.A)(),n=t?.currency||"",o=t?.symbol||"",i=(0,a.useMemo)((()=>({...e,code:n,symbol:o})),[e,n,o]),c=(0,a.useMemo)((()=>s()(i).formatAmount),[i]);return{adsCurrencyConfig:i,formatAmount:c}}},8519:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(7723),o=n(6087),s=n(1455),l=n.n(s),r=n(3658),i=n(5640);function c(){const{createAdsCampaign:e}=(0,r.j)(),{createNotice:t}=(0,i.A)(),[n,s]=(0,o.useState)(!1),c=(0,o.useCallback)((()=>l()({path:"/wc/gla/ads/setup/complete",method:"POST"}).catch((()=>(t("error",(0,a.__)("Unable to complete your ads setup. Please try again later.","google-listings-and-ads")),Promise.reject())))),[t]);return[(0,o.useCallback)(((t,n,a)=>(s(!0),e(t,n).then(c).then(a).catch((()=>s(!1))))),[e,c]),n]}},6599:(e,t,n)=>{n.d(t,{A:()=>p});var a=n(6087),o=n(1455),s=n.n(o),l=n(2224);const r="START",i="FINISH",c="ERROR",d="RESET",u={loading:!1,error:void 0,data:void 0,response:void 0,options:void 0},g=(e,t)=>{switch(t.type){case r:return{...e,loading:!0,options:t.options};case i:return{...e,loading:!1,data:t.data,response:t.response,options:t.options};case c:return{...e,loading:!1,error:t.error,response:t.response,options:t.options};case d:return t.state}},m=e=>{const{parse:t=!0}=e;return t},p=(e,t=u)=>{const n=(0,l.A)(e),o={...u,...t},[p,h]=(0,a.useReducer)(g,o);return[(0,a.useCallback)((async e=>{const t={...n,...e};h({type:r,options:t});try{const e=await s()({...t,parse:!1}),n=e.clone(),a=n.json&&await n.json();return h({type:i,data:a,response:e,options:t}),m(t)?a:e}catch(e){if("fetch_error"===e.code)throw h({type:c,error:e,response:void 0,options:t}),e;const n=e;let a;try{const e=n.clone();a=e.json?await e.json():new Error("No content body in fetch response.")}catch(e){a=new Error("Error parsing response.")}throw h({type:c,error:a,response:n,options:t}),m(t)?a:n}}),[n]),{...p,reset:e=>{h({type:d,state:{...o,...e}})}}]}},6453:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(6087),o=n(6599),s=n(2224);const l=e=>{const t=(0,s.A)(e),[n,l]=(0,o.A)(t,{loading:!0});return(0,a.useEffect)((()=>{t&&n()}),[n,t]),l}},9415:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(7143),o=n(6087),s=n(6520),l=n(3658),r=n(2224);const i=(e,...t)=>{const{invalidateResolution:n}=(0,l.j)(),i=(0,r.A)(t),c=(0,o.useCallback)((()=>{n(e,i)}),[n,e,i]);return(0,a.useSelect)((t=>{const{isResolving:n,hasFinishedResolution:a}=t(s.Ui),o=t(s.Ui)[e](...i);return{isResolving:n(e,i),hasFinishedResolution:a(e,i),data:o,invalidateResolution:c}}),[c,e,i])}},4679:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(7143),o=n(6520);const s=e=>(0,a.useSelect)((t=>{const{getAdsBudgetRecommendations:n,hasFinishedResolution:a}=t(o.Ui),s=n(e);let l,r=0;if(s){const{recommendations:e}=s;({daily_budget:r,country:l}=function(e){return e?e.reduce(((e,t)=>t.daily_budget>e.daily_budget?t:e)):null}(e))}return{data:s,highestDailyBudget:r,highestDailyBudgetCountryCode:l,hasFinishedResolution:a("getAdsBudgetRecommendations",[e])}}),[e])},1340:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(7723),o=n(9415),s=n(3905);const l=(0,a._x)(", ","the separator for concatenating the categories where the Attribute mapping rule is applied.","google-listings-and-ads"),r=e=>({key:e.id,label:e.name,value:e.id}),i=(e=[])=>e.map(r),c=e=>e.slice(0,s.vL).map((e=>e.label)).join(l),d=(e=[])=>{const{data:t,hasFinishedResolution:n}=(0,o.A)("getStoreCategories");if(!n)return{hasFinishedResolution:n,categories:[],selected:[],names:""};const s=e.filter((e=>!t.find((t=>t.id.toString()===e)))).map((e=>{return{id:e,name:(t=e,(0,a.sprintf)(
// translators: %d: number of categories.
// translators: %d: number of categories.
(0,a.__)("Category ID %s (deleted)","google-listings-and-ads"),[t])),parent:0};var t})),l=[...t,...s],d=((e,t)=>e.map((e=>{const n=t.find((t=>t.id.toString()===e));return r(n)})))(e,l);return{hasFinishedResolution:n,selected:d,categories:i(l),names:c(d)}}},7133:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(6087);function o(e="single"){const t=(0,a.useRef)({}),[n,o]=(0,a.useState)(0);t.current.usingHandle=e,t.current[e]=t.current[e]||{callCount:0};const s=(0,a.useCallback)((n=>{o(n);const a=t.current[e],s=(new Date).getTime()+1e3*n;a.id&&clearInterval(a.id),a.updateSecond=()=>{let n=(s-(new Date).getTime())/1e3;n=Math.max(Math.round(n),0),t.current.usingHandle===e&&o(n),0===n&&clearInterval(a.id)},a.id=setInterval(a.updateSecond,1e3),a.callCount+=1}),[e]);(0,a.useEffect)((()=>{const{updateSecond:n}=t.current[e];n&&n()}),[e]),(0,a.useEffect)((()=>{const e=t.current;return()=>{Object.values(e).forEach((e=>clearInterval(e.id)))}}),[]);const{callCount:l}=t.current[e];return{second:n,callCount:l,startCountdown:s}}},6734:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(8537),o=n(5703);const s=()=>{const e={...(0,o.getSetting)("countries")};return Object.keys(e).forEach((t=>{e[t]=(0,a.decodeEntities)(e[t])})),e}},5128:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(6087),o=n(3577),s=n(3772);const l=e=>{const t=(0,s.A)();return(0,a.useMemo)((()=>{const n={...t,...e};return e=>(0,o.numberFormat)(n,e)}),[t,e])}},5640:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(7143);const o=()=>(0,a.useDispatch)("core/notices")},7541:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(6087),o=n(8468),s=n(2224),l=n(6473);function r(e,t){const n=(0,s.A)((0,o.pick)(t,l.E$.get(e))),[,r]=(0,a.useReducer)((e=>e+1),0);return(0,a.useEffect)((()=>{const t=`${l.CU}/${(0,o.uniqueId)()}`;return Object.keys(n).length&&l.JL.addFilter(e,t,(e=>({...e,...n}))),r(),()=>{l.JL.removeFilter(e,t)}}),[e,n]),(0,a.useCallback)((t=>l.JL.applyFilters(e,t)),[e])}},5530:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(7143),o=n(6520);const s=()=>(0,a.useSelect)((e=>{const t=e(o.Ui).getExistingGoogleAdsAccounts(),n=e(o.Ui).isResolving("getExistingGoogleAdsAccounts");return{existingAccounts:t,hasFinishedResolution:e(o.Ui).hasFinishedResolution("getExistingGoogleAdsAccounts"),isResolving:n}}),[])},2722:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(9415);const o=()=>(0,a.A)("getExistingGoogleMCAccounts")},8e3:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(7143),o=n(3905),s=n(6520),l=n(7400),r=n(7401);const i=()=>{const{jetpack:e,isResolving:t,hasFinishedResolution:n}=(0,r.A)();return(0,a.useSelect)((a=>{if(!e||"no"===e.active)return{google:void 0,scope:(0,l.A)(o.Th.adsSetupComplete),isResolving:t,hasFinishedResolution:n};const{getGoogleAccount:r,isResolving:i,hasFinishedResolution:c}=a(s.Ui),d=r();return{google:d,scope:(0,l.A)(o.Th.adsSetupComplete,d?.scope),isResolving:i("getGoogleAccount"),hasFinishedResolution:c("getGoogleAccount")}}),[e,t,n])}},1378:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(7143),o=n(6087),s=n(6520),l=n(3658),r=n(3905),i=n(8e3);const c="getGoogleAdsAccount",d=()=>{const{google:e,isResolving:t,hasFinishedResolution:n}=(0,i.A)(),d=(0,l.j)(),u=(0,o.useCallback)((()=>{d.invalidateResolution(c,[])}),[d]);return(0,a.useSelect)((a=>{if(!e||"no"===e.active)return{googleAdsAccount:void 0,isResolving:t,hasFinishedResolution:n};const o=a(s.Ui),l=o[c](),i=o.isResolving(c),d=[r.Wn.CONNECTED,r.Wn.INCOMPLETE].includes(l?.status);return{googleAdsAccount:l,isResolving:i,refetchGoogleAdsAccount:u,hasFinishedResolution:o.hasFinishedResolution(c),hasGoogleAdsConnection:d}}),[e,t,n,u])}},6893:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(7143),o=n(6520);const s="getGoogleAdsAccountBillingStatus",l=()=>(0,a.useSelect)((e=>{const t=e(o.Ui);return{billingStatus:t[s](),hasFinishedResolution:t.hasFinishedResolution(s,[])}}),[])},1351:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(1378),o=n(5992);const s=()=>{const{hasGoogleAdsConnection:e,hasFinishedResolution:t}=(0,a.A)(),{hasAccess:n,step:s,hasFinishedResolution:l}=(0,o.A)();return t&&l?e&&n&&["","billing","link_merchant"].includes(s):null}},5992:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(7143),o=n(6520);const s="getGoogleAdsAccountStatus",l=()=>(0,a.useSelect)((e=>{const t=e(o.Ui),{hasAccess:n,inviteLink:a,step:l}=t[s]();return{hasAccess:n,inviteLink:a,step:l,hasFinishedResolution:t.hasFinishedResolution(s)}}),[])},1830:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(6087),o=n(3832),s=n(6520),l=n(6599);function r(e,t){const n=(0,a.useMemo)((()=>{const n={next_page_name:e,login_hint:t};return{path:(0,o.addQueryArgs)(`${s.RV}/google/connect`,n)}}),[e,t]);return(0,l.A)(n)}},7916:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(7143),o=n(6520),s=n(8e3),l=n(3905);const r="getGoogleMCAccount",i=()=>{const{google:e,scope:t,isResolving:n,hasFinishedResolution:i}=(0,s.A)();return(0,a.useSelect)((a=>{if(!e||"no"===e.active||!t.gmcRequired)return{googleMCAccount:void 0,isResolving:n,hasFinishedResolution:i,isPreconditionReady:!1,hasGoogleMCConnection:!1,isReady:!1};const s=a(o.Ui),c=s[r](),d=s.isResolving(r),u=Boolean(c?.id)&&[l.WR.CONNECTED,l.WR.INCOMPLETE].includes(c?.status),g=c?.status===l.WR.CONNECTED||c?.status===l.WR.INCOMPLETE&&"link_ads"===c?.step;return{googleMCAccount:c,isResolving:d,hasFinishedResolution:s.hasFinishedResolution(r),isPreconditionReady:!0,hasGoogleMCConnection:u,isReady:g}}),[e,t.gmcRequired,n,i])}},2224:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(8468),o=n(6087);const s=e=>{const t=(0,o.useRef)(e);return(0,a.isEqual)(t.current,e)||(t.current=e),t.current}},7401:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(7143),o=n(6520);const s=()=>(0,a.useSelect)((e=>({jetpack:e(o.Ui).getJetpackAccount(),isResolving:e(o.Ui).isResolving("getJetpackAccount"),hasFinishedResolution:e(o.Ui).hasFinishedResolution("getJetpackAccount")})),[])},6474:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(6087);const o={"full-page":["woocommerce-admin-full-screen","is-wp-toolbar-disabled","gla-full-page"],"full-content":["gla-full-content"]};function s(e){(0,a.useEffect)((()=>{if(!o.hasOwnProperty(e))return;const t=document.body.classList,n=o[e].filter((e=>!t.contains(e)));return t.add(...n),()=>{t.remove(...n)}}),[e])}},7240:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(9415);const o=()=>{const e=(0,a.A)("getMCCountriesAndContinents");return{...e,data:e.data.countries}}},7951:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(3905),o=n(6425);const s=e=>{const t=Object.values(e).reduce(((e,t)=>e+t),0);return Number.isInteger(t)?t:void 0},l=()=>{const e={[a.Tj]:(0,o.A)(a.Tj)?.data?.total,[a.ds]:(0,o.A)(a.ds)?.data?.total};return{...e,total:s(e)}}},6425:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(3905),o=n(9415);const s=a.X4,l=(e=a.Tj,t=1,n=s)=>(0,o.A)("getMCIssues",{page:t,issue_type:e,per_page:n})},614:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(6087),o=n(9415),s=n(7133),l=n(6599),r=n(3658);const i=()=>{const{second:e,callCount:t,startCountdown:n}=(0,s.A)(),{invalidateResolutionForStoreSelector:i}=(0,r.j)(),{data:c,hasFinishedResolution:d,invalidateResolution:u,...g}=(0,o.A)("getMCProductStatistics"),m=!(!d||!c?.loading),p=!(!d||!c?.statistics),[h]=(0,l.A)({path:"/wc/gla/mc/product-statistics/refresh",method:"GET"}),_=(0,a.useCallback)((async()=>{await h(),u()}),[h,u]);return(0,a.useEffect)((()=>{m&&0===e&&(n(15),t>0&&u()),p&&t>0&&(n(0),i("getMCProductFeed"))}),[e,t,m,p,u,i,n]),{data:c,invalidateResolution:u,hasFinishedResolution:d,refreshStats:_,...g}}},3027:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(9415);const o=()=>(0,a.A)("getMCSetup")},7437:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(9415);const o=()=>(0,a.A)("getMappingAttributes")},771:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(9415);const o=e=>(0,a.A)("getMappingSources",e)},993:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(9415);const o=({page:e=1,perPage:t=10})=>(0,a.A)("getMappingRules",{page:e,perPage:t})},14:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(6087);const o={match:{url:"/google/dashboard"},wpOpenMenu:"toplevel_page_woocommerce-marketing"};function s(){return(0,a.useEffect)((()=>{window.wpNavMenuClassChange(o,o.match.url)}))}},1650:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(6087),o=n(6476),s=n(8468);const l=()=>!0;function r(e,t,n=l){const{key:r}=(0,o.getHistory)().location;(0,a.useEffect)((()=>{let a=s.noop;return t&&(a=(0,o.getHistory)().block((t=>{const{location:o,retry:s}=t;let l=!0;n(function(e){return{...e,pathname:e.pathname.replace(/^(\/wp-admin)?\//,"")}}(o))&&(l=window.confirm(e)),l&&(a(),s())}))),()=>{a()}}),[r,e,t,n])}},1396:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(6087);const o=(e,t=1)=>{var n;const[o,s]=(0,a.useState)({}),l=(0,a.useCallback)((t=>{s((n=>({...n,[e]:t})))}),[e]);return{page:null!==(n=o[e])&&void 0!==n?n:t,setPage:l}}},33:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(6087),o=n(6599),s=n(7133);function l(e,t=10,n=!1){const{second:l,callCount:r,startCountdown:i}=(0,s.A)(),[c,{data:d}]=(0,o.A)(e),u=!d||!n,g=(0,a.useCallback)((()=>{const e=c();return e.finally((()=>i(t))),e}),[c,i,t]);return(0,a.useEffect)((()=>{0===l&&r>0&&u&&g()}),[l,r,g,u]),{start:g,data:d}}},5455:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(6087),o=n(3658),s=n(4716),l=n(8468);const r=(e,t)=>void 0!==e.id&&e.id===t.id||e.country===t.country;var i=n(6523);const c=()=>{const{data:e}=(0,i.A)(),{deleteShippingRates:t,upsertShippingRates:n}=(0,o.j)();return{saveShippingRates:(0,a.useCallback)((async a=>{const o=((e,t)=>((e,t)=>(0,l.differenceWith)(t,e,r))(e,t).map((e=>e.id)))(a,e);o.length&&await t(o);const i=(0,s.A)(a,e);i.length&&await n(i)}),[t,e,n])}}},5807:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(6087),o=n(3658),s=n(5622),l=n(8468);var r=n(172);const i=()=>{const{data:e}=(0,s.A)(),{deleteShippingTimes:t,upsertShippingTimes:n}=(0,o.j)();return{saveShippingTimes:(0,a.useCallback)((async a=>{const o=((e,t)=>((e,t)=>(0,l.differenceBy)(t,e,"countryCode"))(e,t).map((e=>e.countryCode)))(a,e);o.length&&await t(o);const s=(i=a,c=e,(0,l.differenceWith)(i,c,l.isEqual));var i,c;if(s.length){const e=(0,r.A)(s).map((e=>n(e)));await Promise.all(e)}}),[t,e,n])}}},873:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(7143),o=n(3658);const s=()=>{const{saveSettings:e,syncSettings:t}=(0,o.j)();return{settings:(0,a.useSelect)((e=>e(o.U).getSettings()),[]),saveSettings:e,syncSettings:t}}},6523:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(9415);const o=()=>(0,a.A)("getShippingRates")},5622:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(9415);const o=()=>(0,a.A)("getShippingTimes")},5595:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(9415),o=n(6734);const s={address:"",address2:"",city:"",state:"",country:"",postcode:"",isMCAddressDifferent:null,isAddressFilled:null,missingRequiredFields:[]};function l(e="wc"){const{data:t,hasFinishedResolution:n,invalidateResolution:l}=(0,a.A)("getGoogleMCContactInformation"),r=(0,o.A)();let i=s;if(n&&t){const{is_mc_address_different:n,wc_address_errors:a}=t,o="wc"===e?t.wc_address:t.mc_address,s=o?.street_address||"",l=o?.locality||"",c=o?.region||"",d=o?.postal_code||"",[u,g=""]=s.split("\n"),m=r[o?.country]||"";i={countryCode:o?.country||"",address:u,address2:g,city:l,state:c,country:m,postcode:d,isAddressFilled:!a.length,isMCAddressDifferent:n,missingRequiredFields:a}}return{refetch:l,loaded:n,data:i}}},1456:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(7143),o=n(7916),s=n(6520);function l(){const{hasGoogleMCConnection:e}=(0,o.A)();return(0,a.useSelect)((t=>{if(!e)return!1;const n=t(s.Ui).getGoogleMCContactInformation();return!!n&&!n.wc_address_errors.length}),[e])}},7337:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(7143),o=n(314),s=n(5703);function l(){return(0,a.useSelect)((e=>{const t=e(o.OPTIONS_STORE_NAME),n="getOption",a=["woocommerce_default_country"],l=t[n](...a);let r=null,i=null;if(t.hasFinishedResolution(n,a)){const e=(0,s.getSetting)("countries");[r]=l.split(":"),i=e[r]}return{code:r,name:i}}),[])}},3772:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(6087),o=n(3577),s=n(5703);const l=()=>{const e=(0,s.getSetting)("currency");return(0,a.useMemo)((()=>({...e,formatNumber:(t,n=e.precision)=>{const a={...e,precision:n};return(0,o.numberFormat)(a,t)}})),[e])}},8859:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(9415);const o=()=>(0,a.A)("getTargetAudience")},5847:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(7143),o=n(3658),s=n(7240);const l=()=>{const{data:e,isResolving:t}=(0,s.A)();return(0,a.useSelect)((function(n){const{getTargetAudience:a,isResolving:s}=n(o.U),l=a(),r=s("getTargetAudience")||t,i=e&&Object.keys(e);function c(e){return"all"===e?.location?i:e?.countries}return{loading:r,data:c(l),targetAudience:l,getFinalCountries:c}}),[e,t])}},8146:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(6087),o=n(3658),s=n(9415);const l=e=>{const t=(0,s.A)("getTour",e),{upsertTour:n}=(0,o.j)(),l=t.data?.checked;return{tourChecked:!t.hasFinishedResolution||Boolean(l),setTourChecked:(0,a.useCallback)((t=>{t!==l&&n({id:e,checked:t},!0)}),[e,l,n])}}},1016:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(6087),o=n(6476),s=n(3905),l=n(3658),r=n(6520),i=n(6599);const c=()=>{const{google_wpcom_app_status:e,nonce:t}=(0,o.getQuery)(),{invalidateResolution:n}=(0,l.j)(),c=`${r.RV}/rest-api/authorize`,[d]=(0,i.A)({path:c,method:"PUT"}),u=(0,a.useCallback)((async()=>{try{await d({data:{status:e,nonce:t}}),n("getGoogleMCAccount",[])}catch(e){console.error(e.message)}}),[d,e,n,t]);(0,a.useEffect)((()=>{Object.values(s.ac).includes(e)&&async function(){await u(e)}()}),[e,u])}},70:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(7723),o=n(6087),s=n(3658),l=n(6520),r=n(1378),i=n(6599),c=n(5640);const d=()=>{const{googleAdsAccount:e}=(0,r.A)(),{createNotice:t}=(0,c.A)(),{fetchGoogleAdsAccount:n,fetchGoogleAdsAccountStatus:d}=(0,s.j)(),[u,g]=(0,o.useState)(null),m=!e?.id,[p]=(0,i.A)({path:`${l.RV}/ads/accounts`,method:"POST",data:{id:e?.id||void 0}});return[(0,o.useCallback)((async()=>{g(m?"create":"update");try{await p({parse:!1})}catch(e){if(428!==e.status){const n=406===e.status?(0,a.__)("Error creating account: Account creation limit reached. Contact support for help.","google-listings-and-ads"):(0,a.__)("Unable to create Google Ads account. Please try again later.","google-listings-and-ads");t("error",n)}}await Promise.all([n(),d()]),g(null)}),[m,t,p,n,d]),{loading:null!==u,action:u}]}},2775:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(6476),o=n(2224);function s(){const e=(0,a.getQuery)();return(0,o.A)(e)}},5559:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(6087);const o=(e,t)=>{const n=(()=>{const[e,t]=(0,a.useState)(document.hasFocus());return(0,a.useEffect)((()=>{const e=()=>{t(!0)},n=()=>{t(!1)};return window.addEventListener("focus",e),window.addEventListener("blur",n),()=>{window.removeEventListener("focus",e),window.removeEventListener("blur",n)}}),[]),e})();(0,a.useEffect)((()=>{if(!n)return;e();const a=setInterval(e,1e3*t);return()=>clearInterval(a)}),[e,t,n])}},8606:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(7723);async function o(e,t){const n=(await Promise.allSettled(e)).reduce(((e,n,a)=>("rejected"===n.status&&t[a]&&e.push(t[a]),e)),[]);return function(e,t=!0){if(e.length){const n=(0,a._x)(", ","the separator for concatenating the messages of failed actions","google-listings-and-ads"),o=(0,a.sprintf)(
// translators: 1: optional string when there are multiple failed actions, and it's a concatenated text of failed actions except for the last one. 2: the last one or the only failed action.
// translators: 1: optional string when there are multiple failed actions, and it's a concatenated text of failed actions except for the last one. 2: the last one or the only failed action.
(0,a._n)("There is an error in the following action: %1$s%2$s.","There are errors in the following actions: %1$s and %2$s.",e.length,"google-listings-and-ads"),e.slice(0,-1).join(n),e.at(-1)),s=t?
// translators: text for the failed action(s).
// translators: text for the failed action(s).
(0,a.__)("%s Other changes have been saved. Please try again later.","google-listings-and-ads"):
// translators: text for the failed action(s).
// translators: text for the failed action(s).
(0,a.__)("%s Please try again later.","google-listings-and-ads");return(0,a.sprintf)(s,o)}return null}(n,n.length<e.length)}},3376:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(3905);const o=a.Th.dateFormat+(a.Th.dateFormat.trim()&&a.Th.timeFormat.trim()?", ":"")+a.Th.timeFormat},4716:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(8468);const o=(e,t)=>{const n=["country","currency","rate","options.free_shipping_threshold"];return(0,a.isEqual)((0,a.at)(e,n),(0,a.at)(t,n))},s=(e,t)=>(0,a.differenceWith)(e,t,o)},9369:(e,t,n)=>{function a(e){return Object.entries(e).reduce(((e,[t,n])=>"not_synced"===t?e:e+n),0)}n.d(t,{A:()=>a})},9269:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(6476);const o=()=>{const e=(0,a.getQuery)();return"products"===e?.reportKey?"products":"programs"}},172:(e,t,n)=>{n.d(t,{A:()=>a});const a=e=>{const t=new Map;return e.forEach((e=>{const{countryCode:n,time:a,maxTime:o}=e,s=`${a}-${o}`,l=t.get(s)||{countries:[],time:a,maxTime:o};l.countries.push(n),t.set(s,l)})),Array.from(t.values())}},4297:(e,t,n)=>{n.d(t,{A:()=>a});const a=(e,t,n)=>{const{innerWidth:a,innerHeight:o,screenX:s,screenY:l,screen:r}=e,i=Math.min(t,r.availWidth),c=Math.min(n,r.availHeight);return`popup=1,left=${(a-i)/2+s},top=${(o-c)/2+l},width=${i},height=${c}`}},3921:(e,t,n)=>{n.d(t,{A:()=>a});const a=()=>!!window.wcTracks?.isEnabled},5744:(e,t,n)=>{n.d(t,{A:()=>o});const a="undefined"!=typeof window&&"localStorage"in window,o={get:e=>a?window.localStorage.getItem(e):null,set:(e,t)=>a?window.localStorage.setItem(e,t):null,remove:e=>a?window.localStorage.removeItem(e):null}},4391:(e,t,n)=>{n.d(t,{A:()=>o});var a=n(3905);function o(e){return e?.status===a.Wn.CONNECTED||["link_merchant","billing"].includes(e?.step)}},7400:(e,t,n)=>{n.d(t,{A:()=>o});const a={CONTENT:"https://www.googleapis.com/auth/content",SITE_VERIFICATION_VERIFY_ONLY:"https://www.googleapis.com/auth/siteverification.verify_only",AD_WORDS:"https://www.googleapis.com/auth/adwords"};function o(e,t=[]){const n={adsRequired:t.includes(a.AD_WORDS)};return n.gmcRequired=t.includes(a.CONTENT)&&t.includes(a.SITE_VERIFICATION_VERIFY_ONLY),n.glaRequired=e?n.gmcRequired&&n.adsRequired:n.gmcRequired,n}},9959:(e,t,n)=>{e.exports=n.p+"images/js/src/images/get-started/ff593be89bcb7ad1ab7e.benefits.png"},9899:(e,t,n)=>{e.exports=n.p+"images/js/src/images/get-started/75da8376b1a005182ed2.hero.png"},4902:(e,t,n)=>{e.exports=n.p+"images/js/src/images/get-started/3905a197de7922d5b82a.img-dashboard.svg"},1034:(e,t,n)=>{e.exports=n.p+"images/js/src/images/get-started/563fd40c029bebb36783.img-free-listings.svg"},9351:(e,t,n)=>{e.exports=n.p+"images/js/src/images/get-started/c94ebde75361208ddf3a.img-product-promotion.svg"},1394:(e,t,n)=>{e.exports=n.p+"images/js/src/images/get-started/1ad852c48821e91bfd6e.img-quote.svg"},1948:(e,t,n)=>{e.exports=n.p+"images/js/src/images/get-started/d7e2d04ea7d6535fecf8.motivation.svg"},8806:(e,t,n)=>{e.exports=n.p+"images/js/src/images/fb15f79da797ad9cca81.google-free-listings.png"},9692:(e,t,n)=>{e.exports=n.p+"images/js/src/images/logo/64742f6405be8486218c.google-logo.svg"},8317:(e,t,n)=>{e.exports=n.p+"images/js/src/images/logo/9a968634c60ce598aae3.woocommerce-logo.svg"},7043:(e,t,n)=>{e.exports=n.p+"images/js/src/images/c4325f35cdc65f85a7c1.success-guide-header.svg"}}]);