Files
2026-04-28 15:13:50 +02:00

1 line
15 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use strict";(globalThis.webpackChunkgoogle_listings_and_ads=globalThis.webpackChunkgoogle_listings_and_ads||[]).push([[472],{521:(e,n,o)=>{o.d(n,{A:()=>d});var s=o(7143),t=o(6520),a=o(7692),i=o(2775);const c="products",l={products:[],intervals:[],totals:{}};function d(e){const n=(0,i.A)();return(0,s.useSelect)(o=>{const{getReport:s}=o(t.Ui),i=s(c,e,n,"primary"),d=s(c,e,n,"secondary"),r=i.loaded&&d.loaded;let g=l;return r&&i.data&&d.data&&(g={products:i.data.products||l.products,intervals:i.data.intervals||l.intervals,totals:(0,a.bM)(i.data.totals,d.data.totals,i.reportQuery.fields)}),{data:g,loaded:r}},[e,n])}},2379:(e,n,o)=>{o.r(n),o.d(n,{default:()=>Ce});var s=o(6087),t=o(6476),a=o(3905),i=o(14),c=o(8e3),l=o(1016),d=o(3666),r=o(3354),g=o(7723),u=o(8242),h=o(3741),m=o(6960),x=o(8864),_=o(8683),A=o(1177),j=o(850),p=o(4848);const y=({handleSubmit:e})=>{const{getInputProps:n,adapter:{isSubmitting:o}}=(0,m.h5)(),{onChange:t,...a}=n("tax_rate"),i=n=>{t(n),e()};return(0,p.jsx)(u.A,{title:(0,g.__)("Tax rate (required for U.S. only)","google-listings-and-ads"),description:(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{children:(0,g.__)("This tax rate will be shown to potential customers, together with the cost of your product.","google-listings-and-ads")}),(0,p.jsx)("p",{children:(0,p.jsx)(A.A,{context:"setup-mc-tax-rate",linkId:"tax-rate-read-more",href:"https://support.google.com/merchants/answer/160162",children:(0,g.__)("Read more","google-listings-and-ads")})})]}),children:(0,p.jsx)(u.A.Card,{children:(0,p.jsx)(u.A.Card.Body,{children:(0,p.jsxs)(j.A,{size:"large",children:[(0,p.jsx)(_.A,{...a,label:(0,g.__)("My store uses destination-based tax rates.","google-listings-and-ads"),value:"destination",collapsible:!0,disabled:o,onChange:i,children:(0,p.jsx)(x.A,{children:(0,g.__)("Googles estimated tax rates will automatically be applied to my product listings.","google-listings-and-ads")})}),(0,p.jsx)(_.A,{...a,label:(0,g.__)("My store does not use destination-based tax rates.","google-listings-and-ads"),value:"manual",collapsible:!0,disabled:o,onChange:i,children:(0,p.jsx)(x.A,{children:(0,s.createInterpolateElement)((0,g.__)("Ill set my tax rates up manually in <link>Google Merchant Center</link>. I understand that if I dont set this up, my products will be disapproved.","google-listings-and-ads"),{link:(0,p.jsx)(A.A,{context:"setup-mc-tax-rate",linkId:"tax-rate-manual",href:"https://www.google.com/retail/solutions/merchant-center/"})})})})]})})})})};var C=o(873),f=o(7337);var b=o(5847),v=o(5640),G=o(6876);const w=new Set(["destination","manual"]);function S(){const{settings:e,saveSettings:n,syncSettings:o}=(0,C.A)(),{data:s}=(0,b.A)(),t=((e=null)=>{const{code:n}=(0,f.A)();return"US"===n||!(!e||!e.includes("US"))||(!n||null===e)&&null})(s),{createNotice:a}=(0,v.A)();return t&&e?.hasOwnProperty("tax_rate")?(0,p.jsx)(m.Ay,{initialValues:{tax_rate:e.tax_rate},validate:e=>{const n={};return w.has(e.tax_rate)||(n.tax_rate=(0,g.__)("Please specify tax rate option.","google-listings-and-ads")),n},onSubmit:async s=>{const t={...e,tax_rate:s.tax_rate};return n(t).then(o,e=>{(0,G.h)(e,(0,g.__)("There was an error saving tax rate.","google-listings-and-ads"))}).catch(e=>{(0,G.h)(e,(0,g.__)("There was an error synchronizing tax rate to Google Merchant Center.","google-listings-and-ads"))}).then(()=>{a("success",(0,g.__)("Your change to tax rate has been saved and will be synced to your Google Merchant Center.","google-listings-and-ads"))})},children:e=>(0,p.jsx)(y,{handleSubmit:e.handleSubmit})}):!1===t?null:(0,p.jsx)(u.A,{children:(0,p.jsx)(h.A,{})})}var k=o(6427),E=o(1968),I=o(7401),D=o(7916),F=o(1378),T=o(6060),M=o(7892),N=o(6028),R=o(4790),P=o(8678),W=o(458),q=o(7807);function B(e){const{hasGoogleMCConnection:n}=(0,D.A)(),o=n?(0,g.__)("A WordPress.com account, Google account, Google Merchant Center account, and Google Ads account are required to use this extension in WooCommerce.","google-listings-and-ads"):(0,g.__)("A WordPress.com account, Google account and Google Ads account are required to use this extension in WooCommerce.","google-listings-and-ads");return(0,p.jsx)(u.A,{title:(0,g.__)("Linked accounts","google-listings-and-ads"),description:o,...e})}var O=o(9457),z=o(7792),L=o(2434);const H="all-accounts",Y="ads-account",K="ads-only",U={[H]:{title:(0,g.__)("Disconnect all accounts","google-listings-and-ads"),confirmButton:(0,g.__)("Disconnect all accounts","google-listings-and-ads"),confirmation:(0,g.__)("Yes, I want to disconnect all my accounts.","google-listings-and-ads"),contents:[(0,g.__)("I understand that I am disconnecting any WordPress.com account, Google account, Google Merchant Center account and Google Ads account connected to this extension.","google-listings-and-ads"),(0,g.__)("Any active product listings will continue to show on Google. They can be managed, edited, or deleted manually from Google Merchant Center (merchants.google.com).","google-listings-and-ads"),(0,g.__)("Any ongoing campaigns will continue to run. They can be managed, edited, or deleted manually from Google Ads (ads.google.com).","google-listings-and-ads")]},[K]:{title:(0,g.__)("Disconnect all accounts","google-listings-and-ads"),confirmButton:(0,g.__)("Disconnect all accounts","google-listings-and-ads"),confirmation:(0,g.__)("Yes, I want to disconnect all my accounts.","google-listings-and-ads"),contents:[(0,g.__)("I understand that I am disconnecting any WordPress.com account, Google account and Google Ads account connected to this extension.","google-listings-and-ads"),(0,g.__)("Any ongoing campaigns will continue to run. They can be managed, edited, or deleted manually from Google Ads (ads.google.com).","google-listings-and-ads")]},[Y]:{title:(0,g.__)("Disconnect Google Ads account","google-listings-and-ads"),confirmButton:(0,g.__)("Disconnect Google Ads Account","google-listings-and-ads"),confirmation:(0,g.__)("Yes, I want to disconnect my Google Ads account.","google-listings-and-ads"),contents:[(0,g.__)("I understand that I am disconnecting my Google Ads account from this WooCommerce extension.","google-listings-and-ads"),(0,g.__)("Any ongoing campaigns will continue to run. They can be managed, edited, or deleted manually from Google Ads (ads.google.com).","google-listings-and-ads"),(0,g.__)("Some configurations for Google Ads created through WooCommerce may be lost. This cannot be undone.","google-listings-and-ads")]}};function $({disconnectTarget:e,onRequestClose:n,onDisconnected:o,disconnectAction:t}){const[a,i]=(0,s.useState)(!1),[c,l]=(0,s.useState)(!1),d=(0,L.j)(),{hasGoogleMCConnection:r}=(0,D.A)(),u=e!==H||r?H:K,{title:h,confirmButton:m,confirmation:x,contents:_}=U[u],A=()=>{c||n()};return(0,p.jsxs)(O.A,{className:"gla-disconnect-accounts-modal",title:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(z.A,{size:20}),h]}),isDismissible:!c,buttons:[(0,p.jsx)(M.A,{isSecondary:!0,disabled:c,onClick:A,children:(0,g.__)("Never mind","google-listings-and-ads")},"1"),(0,p.jsx)(M.A,{isPrimary:!0,isDestructive:!0,loading:c,disabled:!a,onClick:()=>{let s=e===H?d.disconnectAllAccounts:d.disconnectGoogleAdsAccount;t&&(s=t),l(!0),s().then(()=>{o(),n()}).catch(()=>{l(!1)})},children:m},"2")],onRequestClose:A,children:[_.map((e,n)=>(0,p.jsx)("p",{children:e},n)),(0,p.jsx)(k.CheckboxControl,{label:x,checked:a,disabled:c,onChange:i})]})}function Q(e){return(0,p.jsx)($,{...e})}var J=o(6473),V=o(2893);const{CONNECTED:X,INCOMPLETE:Z}=a.Wn;function ee(){const e=(0,E.A)(),{jetpack:n,hasFinishedResolution:o}=(0,I.A)(),{google:t,hasFinishedResolution:a}=(0,c.A)(),{googleMCAccount:i,hasFinishedResolution:l,hasGoogleMCConnection:r}=(0,D.A)(),{googleAdsAccount:h,hasFinishedResolution:m}=(0,F.A)(),{hasFinishedResolution:x}=(0,T.A)(),_=!(o&&a&&l&&m&&x),A=[X,Z].includes(h?.status),[j,y]=(0,s.useState)(null);return(0,p.jsxs)(B,{children:[j&&(0,p.jsx)(Q,{onRequestClose:()=>y(null),onDisconnected:()=>{(0,J.Ff)("gla_disconnected_accounts",{context:j});const n=j===H?e+(0,d.XG)():window.location.href;window.location.href=n},disconnectTarget:j}),_?(0,p.jsx)(N.A,{}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(R.LJ,{jetpack:n}),(0,p.jsx)(P.Az,{googleAccount:t,hideAccountSwitch:!0}),r&&(0,p.jsx)(q.D,{googleMCAccount:i}),A&&(0,p.jsx)(W.Ez,{googleAdsAccount:h,hideAccountSwitch:!0,children:r&&(0,p.jsx)(u.A.Card.Footer,{children:(0,p.jsx)(M.A,{isDestructive:!0,isLink:!0,onClick:()=>y(Y),children:(0,g.__)("Disconnect Google Ads account only","google-listings-and-ads")})})}),(0,p.jsx)(V.Ay,{}),(0,p.jsx)(k.Flex,{justify:"flex-end",children:(0,p.jsx)(M.A,{isPrimary:!0,isDestructive:!0,onClick:()=>y(H),children:(0,g.__)("Disconnect from all accounts","google-listings-and-ads")})})]})]})}var ne=o(7677),oe=o(1903),se=o(1517);function te(){const{jetpack:e}=(0,I.A)(),n="yes"===e?.active;return(0,s.useEffect)(()=>{n&&(0,t.getHistory)().replace((0,d.FN)())},[n]),e?(0,p.jsxs)(B,{children:[(0,p.jsx)(se.A,{className:"gla-wpcom-connection-lost-card",isBorderless:!0,size:"small",icon:(0,p.jsx)(ne.A,{icon:oe.A,size:24}),title:(0,g.__)("Your WordPress.com account has been disconnected.","google-listings-and-ads"),helper:(0,g.__)("Connect your WordPress.com account to ensure your products stay listed on Google. If you do not re-connect, your products cant be automatically synced to Google, and any existing listings may be removed from Google.","google-listings-and-ads")}),(0,p.jsx)(R.s9,{})]}):(0,p.jsx)(h.A,{})}var ae=o(7400),ie=o(9415);function ce({email:e}){const n=(0,E.A)(),[o,a]=(0,s.useState)(null),{disconnectGoogleAccount:i}=(0,L.j)(),[c,l]=(0,s.useState)(!1);return(0,p.jsxs)(se.A,{appearance:se.x.GOOGLE,description:e,children:[(0,p.jsx)(k.CardDivider,{}),(0,p.jsx)(u.A.Card.Body,{children:(0,p.jsxs)(k.Notice,{status:"error",isDismissible:!1,children:[(0,p.jsx)("p",{children:(0,s.createInterpolateElement)((0,g.__)("This Google account, <accountEmail />, was not the Google account previously connected to this integration.","google-listings-and-ads"),{accountEmail:(0,p.jsx)("strong",{children:e})})}),(0,p.jsx)("p",{children:(0,g.__)("Thus, it doesnt have access to the Google Merchant Center and/or Google Ads account currently connected to this WooCommerce store.","google-listings-and-ads")}),(0,p.jsx)("p",{children:(0,g.__)("Try connecting with a different Google account, or completely disconnect all your connected accounts.","google-listings-and-ads")})]})}),(0,p.jsxs)(u.A.Card.Footer,{justify:"flex-end",children:[o&&(0,p.jsx)(Q,{onRequestClose:()=>a(null),onDisconnected:()=>{const e=(0,t.getNewPath)(null,"/google/start",null);window.location.href=n+e},disconnectTarget:o}),(0,p.jsx)(M.A,{isSecondary:!0,isDestructive:!0,disabled:c,onClick:()=>a(H),children:(0,g.__)("Disconnect all accounts","google-listings-and-ads")}),(0,p.jsx)(M.A,{isPrimary:!0,loading:c,onClick:()=>{l(!0),i().catch(()=>{l(!1)})},children:(0,g.__)("Try another Google account","google-listings-and-ads")})]})]})}function le(){const{data:e}=(0,ie.A)("getGoogleAccountAccess"),n=(0,ae.A)(a.Th.adsSetupComplete,e?.scope),o="yes"===e?.active,i=o?"no"===e?.merchant_access||"no"===e?.ads_access:void 0,c=o&&!i&&n.reconnectionRequired;if((0,s.useEffect)(()=>{c&&(0,t.getHistory)().replace((0,d.uZ)())},[c]),!e)return(0,p.jsx)(h.A,{});if(!c){const n=i?(0,p.jsx)(ce,{email:e.email}):(0,p.jsx)(P.Ay,{});return(0,p.jsx)(u.A,{title:(0,g.__)("Connect account","google-listings-and-ads"),children:n})}return null}var de=o(6474),re=o(5595),ge=o(7539),ue=o(2455);const he=()=>{(0,de.A)("full-content");const{updateGoogleMCContactInformation:e}=(0,L.j)(),{data:n}=(0,re.A)(),[o,a]=(0,s.useState)(!1),i=n.isAddressFilled&&n.isMCAddressDifferent;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge.A,{title:(0,g.__)("Edit store address","google-listings-and-ads"),helpButton:(0,p.jsx)(ue.A,{eventContext:"edit-store-address"}),backHref:(0,d.FN)()}),(0,p.jsxs)("div",{className:"gla-settings",children:[(0,p.jsx)(u.A,{title:(0,g.__)("Store address","google-listings-and-ads"),description:(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{children:(0,g.__)("Your store address is required by Google for verification purposes. It will be shared with the Google Merchant Center and will not be displayed to customers.","google-listings-and-ads")}),(0,p.jsx)("p",{children:(0,p.jsx)(A.A,{context:"settings-store-address",linkId:"contact-information-read-more",href:"https://woocommerce.com/document/google-for-woocommerce/get-started/requirements/#contact-information",children:(0,g.__)("Learn more","google-listings-and-ads")})})]}),children:(0,p.jsx)(r.S,{})}),(0,p.jsx)(u.A,{children:(0,p.jsx)(k.Flex,{justify:"flex-end",children:(0,p.jsx)(M.A,{isPrimary:!0,loading:o,disabled:!i,eventName:"gla_contact_information_save_button_click",onClick:()=>{a(!0),e().then(()=>(0,t.getHistory)().push((0,d.FN)())).catch(()=>a(!1))},children:(0,g.__)("Save details","google-listings-and-ads")})})})]})]})};var me=o(9927),xe=o(5246),_e=o(7143);const Ae="getEnableEnhancedConversions",je=()=>{const{hasGoogleAdsConnection:e,hasFinishedResolution:n}=(0,F.A)(),{isEnabled:o,hasFinishedResolution:t}=(()=>{const{hasGoogleAdsConnection:e,hasFinishedResolution:n}=(0,F.A)();return(0,_e.useSelect)(o=>{if(!n||!e)return{isEnabled:!1,hasFinishedResolution:n};const s=o(L.U);return{isEnabled:s[Ae](),hasFinishedResolution:s.hasFinishedResolution(Ae,[])}},[e,n])})(),[a,i]=(0,s.useState)(!1),{createNotice:c}=(0,v.A)(),{updateEnhancedConversionsStatus:l}=(0,L.j)(),d=(0,s.useCallback)(async()=>{await l(!o)},[l,o]);let r=(0,g.__)("Please make sure to follow the documentation to enable Enhanced Conversions. The feature needs to be enabled both here on WooCommerce and on your Google Ads account.","google-listings-and-ads");e||(r=(0,g.__)("Please connect your Google Ads account in order to use Enhanced Conversions data.","google-listings-and-ads"));const h=n&&t,m=!e||a;return(0,p.jsxs)(u.A,{title:(0,g.__)("Improve conversion accuracy","google-listings-and-ads"),description:(0,p.jsxs)("div",{children:[(0,p.jsx)("p",{children:(0,g.__)("Enhanced Conversions is a feature designed to improve your measurement accuracy by collecting privacy-conscious data without the need for third-party cookies.","google-listings-and-ads")}),(0,p.jsx)("p",{children:(0,p.jsx)(A.A,{href:"https://support.google.com/google-ads/answer/9888656",context:"setup-enhanced-conversions",linkId:"enhanced-conversions-read-more",children:(0,g.__)("Read more","google-listings-and-ads")})})]}),children:[!h&&(0,p.jsx)(N.A,{}),h&&(0,p.jsx)(u.A.Card,{children:(0,p.jsx)(u.A.Card.Body,{children:(0,p.jsx)(k.CheckboxControl,{label:(0,g.__)("Send Enhanced Conversions data to Google Ads","google-listings-and-ads"),checked:o,disabled:m,onChange:async()=>{try{i(!0),await d(),c("success",(0,g.__)("Enhanced Conversions status updated successfully.","google-listings-and-ads"))}catch(e){}finally{i(!1)}},help:r})})})]})};var pe=o(2635);const ye="gla-settings",Ce=()=>{const{subpath:e}=(0,t.getQuery)();(0,i.A)(),(0,l.A)();const{google:n}=(0,c.A)(),o=e===d.$K.reconnectGoogleAccount,{hasGoogleMCConnection:g}=(0,D.A)();switch((0,s.useEffect)(()=>{o||"no"!==n?.active||(0,t.getHistory)().replace((0,d.Ke)(a.iH.GOOGLE_DISCONNECTED))},[o,n]),e){case d.$K.reconnectWPComAccount:return(0,p.jsx)("div",{className:ye,children:(0,p.jsx)(te,{})});case d.$K.reconnectGoogleAccount:return(0,p.jsx)(le,{});case d.$K.editStoreAddress:return(0,p.jsx)(he,{})}return(0,p.jsxs)("div",{className:ye,children:[(0,p.jsx)(pe.A,{}),(0,p.jsx)(me.A,{}),(0,p.jsx)(xe.A,{}),(0,p.jsx)(je,{}),g&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r.h,{}),(0,p.jsx)(S,{})]}),(0,p.jsx)(ee,{})]})}}}]);