"use strict";(globalThis.webpackChunkgoogle_listings_and_ads=globalThis.webpackChunkgoogle_listings_and_ads||[]).push([[440],{413:(s,e,l)=>{l.r(e),l.d(e,{default:()=>G});var i=l(6427),n=l(7143),o=l(6087),t=l(7723),a=l(1233),c=l(3905),r=l(7916),d=l(6361),g=l(6460),h=l(100);const x="channel-visibility-meta-box",_="gla_google_ads_promo_dismissed";var j=l(7892),u=l(3666),m=l(4848);const p=()=>{const s=(0,u.xP)();return(0,m.jsx)(j.A,{href:s,eventName:"gla_google_ads_promo_get_started_click",eventProps:{href:s,context:x},isSecondary:!0,children:(0,t.__)("Get started","google-listings-and-ads")})},y=({onDismiss:s})=>(0,m.jsxs)(i.Flex,{gap:3,align:"flex-start",children:[(0,m.jsx)(i.FlexBlock,{children:(0,m.jsx)(p,{})}),(0,m.jsx)(i.FlexBlock,{children:(0,m.jsx)(j.A,{eventName:"gla_google_ads_promo_dismiss_click",eventProps:{context:x},onClick:s,isTertiary:!0,children:(0,t.__)("Dismiss","google-listings-and-ads")})})]}),{channelVisibility:{field_id:b,channel_visibility:F,product_is_visible:v,sync_status:k=null,issues:f=[],options:N={}}={}}=c.Th||{},B=()=>{const[s,e]=(0,o.useState)(v?F:"dont-sync-and-show");let l=null;"has-errors"===k?l=(0,t.__)("Issues detected","google-listings-and-ads"):k&&(l=k.charAt(0).toUpperCase()+k.slice(1).replace("-"," "));const n=v&&k&&"sync-and-show"===s&&"synced"!==k,a=f.length>0,c=Object.entries(N).map(([s,e])=>({label:e,value:s}));return(0,m.jsxs)(i.Flex,{direction:"column",gap:4,className:"gla-channel-visibility",children:[(0,m.jsx)(i.FlexBlock,{children:(0,m.jsxs)(i.Flex,{gap:2,align:"center",justify:"flex-start",children:[(0,m.jsx)(i.FlexItem,{children:(0,m.jsxs)(i.Flex,{gap:2,align:"center",children:[(0,m.jsx)(i.FlexItem,{children:(0,m.jsx)("img",{className:"gla-channel-visibility__logo",src:g,alt:(0,t.__)("Google Logo","google-listings-and-ads"),width:16,height:16})}),(0,m.jsx)(i.FlexItem,{children:(0,t.__)("Google","google-listings-and-ads")})]})}),c.length>0&&(0,m.jsx)(i.FlexBlock,{children:(0,m.jsx)(i.SelectControl,{name:b,options:c,value:s,onChange:s=>e(s),disabled:!v,__nextHasNoMarginBottom:!0})})]})}),!v&&(0,m.jsx)(i.FlexBlock,{children:(0,m.jsx)(i.Notice,{status:"info",isDismissible:!1,children:(0,m.jsx)("p",{children:(0,t.__)("This product cannot be shown on any channel because it is hidden from your store catalog.","google-listings-and-ads")})})}),n&&l&&(0,m.jsx)(i.FlexBlock,{children:(0,m.jsxs)(i.Notice,{className:"gla-channel-visibility__sync-notice",isDismissible:!1,status:a?"warning":"info",children:[(0,m.jsx)("p",{children:(0,m.jsx)("strong",{children:(0,t.__)("Google sync status","google-listings-and-ads")})}),(0,m.jsx)("p",{className:"gla-channel-visibility__sync-status",children:l}),a&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{children:(0,m.jsx)("strong",{children:(0,t.__)("Issues","google-listings-and-ads")})}),(0,m.jsx)("ul",{children:f.map(s=>(0,m.jsx)("li",{children:s},s))})]})]})})]})};var w=l(3741);const G=()=>{const{hasGoogleMCConnection:s,hasFinishedResolution:e}=(0,r.A)(),{set:l}=(0,n.useDispatch)(a.store),j=(0,d.A)(_),u=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{!u.current&&e&&((0,h.ce)("gla_google_ads_promo_shown",{context:x}),u.current=!0)},[e]),e?s?(0,m.jsx)(B,{}):(0,m.jsxs)(i.Flex,{className:"gla-channel-visibility",direction:"column",gap:4,children:[(0,m.jsx)(i.FlexBlock,{children:(0,m.jsxs)(i.Flex,{gap:2,align:"center",justify:"flex-start",children:[(0,m.jsx)(i.FlexItem,{children:(0,m.jsx)("img",{className:"gla-channel-visibility__logo",src:g,alt:(0,t.__)("Google Logo","google-listings-and-ads"),width:16,height:16})}),(0,m.jsx)(i.FlexItem,{children:(0,t.__)("Google","google-listings-and-ads")}),j&&(0,m.jsx)(i.FlexItem,{className:"gla-channel-visibility__get-started--is-dismissed",children:(0,m.jsx)(p,{})})]})}),!j&&(0,m.jsxs)(i.Flex,{className:"gla-channel-visibility__content",direction:"column",gap:3,children:[(0,m.jsx)(i.FlexBlock,{children:(0,m.jsx)("h3",{className:"gla-channel-visibility__title",children:(0,t.__)("Get your products on Google","google-listings-and-ads")})}),(0,m.jsx)(i.FlexBlock,{children:(0,m.jsx)("p",{children:(0,t.__)("Sync your products to reach customers when they’re searching for products like yours across Google","google-listings-and-ads")})}),(0,m.jsx)(i.FlexBlock,{children:(0,m.jsx)(y,{onDismiss:()=>{l(c.Z7,_,!0)}})})]})]}):(0,m.jsx)(w.A,{})}}}]);