OwlCyberSecurity - MANAGER
Edit File: settings.js
"use strict";(globalThis.webpackChunkgoogle_listings_and_ads=globalThis.webpackChunkgoogle_listings_and_ads||[]).push([[472],{6651:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Ee});var o=n(1609),a=n(6087),l=n(6476),s=n(3905),c=n(14),i=n(8e3),r=n(1016),d=n(3666),g=n(6473),u=n(3354),m=n(7723),_=n(6427),E=n(8242),A=n(3741),h=n(7892),p=n(6960),y=n(8864),f=n(8683),C=n(1177),b=n(850);const x=({children:e})=>{const{getInputProps:t,adapter:{isSubmitting:n}}=(0,p.h5)();return(0,o.createElement)(E.A,{title:(0,m.__)("Tax rate (required for U.S. only)","google-listings-and-ads"),description:(0,o.createElement)("div",null,(0,o.createElement)("p",null,(0,m.__)("This tax rate will be shown to potential customers, together with the cost of your product.","google-listings-and-ads")),(0,o.createElement)("p",null,(0,o.createElement)(C.A,{context:"setup-mc-tax-rate",linkId:"tax-rate-read-more",href:"https://support.google.com/merchants/answer/160162"},(0,m.__)("Read more","google-listings-and-ads"))))},(0,o.createElement)(E.A.Card,null,(0,o.createElement)(E.A.Card.Body,null,(0,o.createElement)(b.A,{size:"large"},(0,o.createElement)(f.A,{...t("tax_rate"),label:(0,m.__)("My store uses destination-based tax rates.","google-listings-and-ads"),value:"destination",collapsible:!0,disabled:n},(0,o.createElement)(y.A,null,(0,m.__)("Google’s estimated tax rates will automatically be applied to my product listings.","google-listings-and-ads"))),(0,o.createElement)(f.A,{...t("tax_rate"),label:(0,m.__)("My store does not use destination-based tax rates.","google-listings-and-ads"),value:"manual",collapsible:!0,disabled:n},(0,o.createElement)(y.A,null,(0,a.createInterpolateElement)((0,m.__)("I’ll set my tax rates up manually in <link>Google Merchant Center</link>. I understand that if I don’t set this up, my products will be disapproved.","google-listings-and-ads"),{link:(0,o.createElement)(C.A,{context:"setup-mc-tax-rate",linkId:"tax-rate-manual",href:"https://www.google.com/retail/solutions/merchant-center/"})})))))),e)};var v=n(873),G=n(7337);var w=n(5847),k=n(5640),S=n(8998);const D=new Set(["destination","manual"]);function T(){const{settings:e,saveSettings:t,syncSettings:n}=(0,v.A)(),{data:a}=(0,w.A)(),l=((e=null)=>{const{code:t}=(0,G.A)();return"US"===t||!(!e||!e.includes("US"))||(!t||null===e)&&null})(a),{createNotice:s}=(0,k.A)();return l&&e?.hasOwnProperty("tax_rate")?(0,o.createElement)(p.Ay,{initialValues:{tax_rate:e.tax_rate},validate:e=>{const t={};return D.has(e.tax_rate)||(t.tax_rate=(0,m.__)("Please specify tax rate option.","google-listings-and-ads")),t},onSubmit:async o=>{const a={...e,tax_rate:o.tax_rate};return t(a).then(n,(e=>{(0,S.h)(e,(0,m.__)("There was an error saving tax rate.","google-listings-and-ads"))})).catch((e=>{(0,S.h)(e,(0,m.__)("There was an error synchronizing tax rate to Google Merchant Center.","google-listings-and-ads"))})).then((()=>{s("success",(0,m.__)("Your change to tax rate has been saved and will be synced to your Google Merchant Center.","google-listings-and-ads"))}))}},(t=>{const{values:n,isValidForm:a}=t,l=n.tax_rate,s=!a||l===e.tax_rate;return(0,o.createElement)(x,null,(0,o.createElement)(_.Flex,{justify:"flex-end"},(0,o.createElement)(h.A,{isPrimary:!0,disabled:s,loading:t.adapter.isSubmitting,onClick:t.handleSubmit},(0,m.__)("Save tax rate","google-listings-and-ads"))))})):!1===l?null:(0,o.createElement)(E.A,null,(0,o.createElement)(A.A,null))}var I=n(1968),N=n(7401),P=n(7916),M=n(1378),F=n(6028),W=n(4790),j=n(5240),q=n(458),O=n(7807);function B(e){return(0,o.createElement)(E.A,{title:(0,m.__)("Linked accounts","google-listings-and-ads"),description:(0,m.__)("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"),...e})}var z=n(9457),L=n(7792),H=n(3658);const R="all-accounts",K="ads-account",Y={[R]:{title:(0,m.__)("Disconnect all accounts","google-listings-and-ads"),confirmButton:(0,m.__)("Disconnect all accounts","google-listings-and-ads"),confirmation:(0,m.__)("Yes, I want to disconnect all my accounts.","google-listings-and-ads"),contents:[(0,m.__)("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,m.__)("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,m.__)("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,m.__)("Disconnect Google Ads account","google-listings-and-ads"),confirmButton:(0,m.__)("Disconnect Google Ads Account","google-listings-and-ads"),confirmation:(0,m.__)("Yes, I want to disconnect my Google Ads account.","google-listings-and-ads"),contents:[(0,m.__)("I understand that I am disconnecting my Google Ads account from this WooCommerce extension.","google-listings-and-ads"),(0,m.__)("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,m.__)("Some configurations for Google Ads created through WooCommerce may be lost. This cannot be undone.","google-listings-and-ads")]}};function $({disconnectTarget:e,onRequestClose:t,onDisconnected:n}){const[l,s]=(0,a.useState)(!1),[c,i]=(0,a.useState)(!1),r=(0,H.j)(),{title:d,confirmButton:g,confirmation:u,contents:E}=Y[e],A=()=>{c||t()};return(0,o.createElement)(z.A,{className:"gla-disconnect-accounts-modal",title:(0,o.createElement)(o.Fragment,null,(0,o.createElement)(L.A,{size:20}),d),isDismissible:!c,buttons:[(0,o.createElement)(h.A,{key:"1",isSecondary:!0,disabled:c,onClick:A},(0,m.__)("Never mind","google-listings-and-ads")),(0,o.createElement)(h.A,{key:"2",isPrimary:!0,isDestructive:!0,loading:c,disabled:!l,onClick:()=>{const o=e===R?r.disconnectAllAccounts:r.disconnectGoogleAdsAccount;i(!0),o().then((()=>{n(),t()})).catch((()=>{i(!1)}))}},g)],onRequestClose:A},E.map(((e,t)=>(0,o.createElement)("p",{key:t},e))),(0,o.createElement)(_.CheckboxControl,{label:u,checked:l,disabled:c,onChange:s}))}function U(e){return(0,o.createElement)($,{...e})}const{CONNECTED:V,INCOMPLETE:J}=s.Wn;function Q(){const e=(0,I.A)(),{jetpack:t}=(0,N.A)(),{google:n}=(0,i.A)(),{googleMCAccount:l,isWPComAppGranted:s}=(0,P.A)(),{googleAdsAccount:c}=(0,M.A)(),r=!(t&&n&&l&&c),u=[V,J].includes(c?.status),[A,p]=(0,a.useState)(null);return(0,o.createElement)(B,null,A&&(0,o.createElement)(U,{onRequestClose:()=>p(null),onDisconnected:()=>{(0,g.Ff)("gla_disconnected_accounts",{context:A});const t=A===R?e+(0,d.XG)():window.location.href;window.location.href=t},disconnectTarget:A}),r?(0,o.createElement)(F.A,null):(0,o.createElement)(o.Fragment,null,(0,o.createElement)(W.LJ,{jetpack:t}),l.wpcom_rest_api_status&&l.notification_service_enabled&&!s?(0,o.createElement)(j.FM,{hideAccountSwitch:!0,eventPropsOfEnableButton:{page:"settings",context:"mc_card"}}):(0,o.createElement)(j.Az,{googleAccount:n,hideAccountSwitch:!0},s&&(0,o.createElement)(_.Notice,{status:"success",isDismissible:!1},(0,m.__)("Google has been granted access to fetch your product data.","google-listings-and-ads"))),(0,o.createElement)(O.D,{googleMCAccount:l}),u&&(0,o.createElement)(q.Ez,{googleAdsAccount:c,hideAccountSwitch:!0},(0,o.createElement)(E.A.Card.Footer,null,(0,o.createElement)(h.A,{isDestructive:!0,isLink:!0,onClick:()=>p(K)},(0,m.__)("Disconnect Google Ads account only","google-listings-and-ads")))),(0,o.createElement)(_.Flex,{justify:"flex-end"},(0,o.createElement)(h.A,{isPrimary:!0,isDestructive:!0,onClick:()=>p(R)},(0,m.__)("Disconnect from all accounts","google-listings-and-ads")))))}var X=n(7677),Z=n(1903),ee=n(559);function te(){const{jetpack:e}=(0,N.A)(),t="yes"===e?.active;return(0,a.useEffect)((()=>{t&&(0,l.getHistory)().replace((0,d.FN)())}),[t]),e?(0,o.createElement)(B,null,(0,o.createElement)(ee.A,{className:"gla-wpcom-connection-lost-card",isBorderless:!0,size:"small",icon:(0,o.createElement)(X.A,{icon:Z.A,size:24}),title:(0,m.__)("Your WordPress.com account has been disconnected.","google-listings-and-ads"),helper:(0,m.__)("Connect your WordPress.com account to ensure your products stay listed on Google. If you do not re-connect, your products can’t be automatically synced to Google, and any existing listings may be removed from Google.","google-listings-and-ads")}),(0,o.createElement)(W.s9,null)):(0,o.createElement)(A.A,null)}var ne=n(7400),oe=n(9415);function ae({email:e}){const t=(0,I.A)(),[n,s]=(0,a.useState)(null),{disconnectGoogleAccount:c}=(0,H.j)(),[i,r]=(0,a.useState)(!1);return(0,o.createElement)(ee.A,{appearance:ee.x.GOOGLE,description:e},(0,o.createElement)(_.CardDivider,null),(0,o.createElement)(E.A.Card.Body,null,(0,o.createElement)(_.Notice,{status:"error",isDismissible:!1},(0,o.createElement)("p",null,(0,a.createInterpolateElement)((0,m.__)("This Google account, <accountEmail />, was not the Google account previously connected to this integration.","google-listings-and-ads"),{accountEmail:(0,o.createElement)("strong",null,e)})),(0,o.createElement)("p",null,(0,m.__)("Thus, it doesn‘t have access to the Google Merchant Center and/or Google Ads account currently connected to this WooCommerce store.","google-listings-and-ads")),(0,o.createElement)("p",null,(0,m.__)("Try connecting with a different Google account, or completely disconnect all your connected accounts.","google-listings-and-ads")))),(0,o.createElement)(E.A.Card.Footer,{justify:"flex-end"},n&&(0,o.createElement)(U,{onRequestClose:()=>s(null),onDisconnected:()=>{const e=(0,l.getNewPath)(null,"/google/start",null);window.location.href=t+e},disconnectTarget:n}),(0,o.createElement)(h.A,{isSecondary:!0,isDestructive:!0,disabled:i,onClick:()=>s(R)},(0,m.__)("Disconnect all accounts","google-listings-and-ads")),(0,o.createElement)(h.A,{isPrimary:!0,loading:i,onClick:()=>{r(!0),c().catch((()=>{r(!1)}))}},(0,m.__)("Try another Google account","google-listings-and-ads"))))}function le(){const{data:e}=(0,oe.A)("getGoogleAccountAccess"),t=(0,ne.A)(s.Th.adsSetupComplete,e?.scope),n="yes"===e?.active,c=n?"no"===e?.merchant_access||"no"===e?.ads_access:void 0,i=n&&!c&&t.reconnectionRequired;if((0,a.useEffect)((()=>{i&&(0,l.getHistory)().replace((0,d.uZ)())}),[i]),!e)return(0,o.createElement)(A.A,null);if(!i){const t=c?(0,o.createElement)(ae,{email:e.email}):(0,o.createElement)(j.Ay,null);return(0,o.createElement)(E.A,{title:(0,m.__)("Connect account","google-listings-and-ads")},t)}return null}var se=n(6474),ce=n(5595),ie=n(7539),re=n(2455);const de=()=>{(0,se.A)("full-content");const{updateGoogleMCContactInformation:e}=(0,H.j)(),{data:t}=(0,ce.A)(),[n,s]=(0,a.useState)(!1),c=t.isAddressFilled&&t.isMCAddressDifferent;return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(ie.A,{title:(0,m.__)("Edit store address","google-listings-and-ads"),helpButton:(0,o.createElement)(re.A,{eventContext:"edit-store-address"}),backHref:(0,d.FN)()}),(0,o.createElement)("div",{className:"gla-settings"},(0,o.createElement)(E.A,{title:(0,m.__)("Store address","google-listings-and-ads"),description:(0,o.createElement)("div",null,(0,o.createElement)("p",null,(0,m.__)("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,o.createElement)("p",null,(0,o.createElement)(C.A,{context:"settings-store-address",linkId:"contact-information-read-more",href:"https://woocommerce.com/document/google-for-woocommerce/get-started/requirements/#contact-information"},(0,m.__)("Learn more","google-listings-and-ads"))))},(0,o.createElement)(u.S,null)),(0,o.createElement)(E.A,null,(0,o.createElement)(_.Flex,{justify:"flex-end"},(0,o.createElement)(h.A,{isPrimary:!0,loading:n,disabled:!c,eventName:"gla_contact_information_save_button_click",onClick:()=>{s(!0),e().then((()=>(0,l.getHistory)().push((0,d.FN)()))).catch((()=>s(!1)))}},(0,m.__)("Save details","google-listings-and-ads"))))))};var ge=n(332),ue=n(9927),me=n(5246);const _e="gla-settings",Ee=()=>{const{subpath:e}=(0,l.getQuery)();(0,c.A)(),(0,r.A)(g.uS);const{google:t}=(0,i.A)(),n=e===d.$K.reconnectGoogleAccount;switch((0,a.useEffect)((()=>{n||"no"!==t?.active||(0,l.getHistory)().replace((0,d.Ke)(s.iH.GOOGLE_DISCONNECTED))}),[n,t]),e){case d.$K.reconnectWPComAccount:return(0,o.createElement)("div",{className:_e},(0,o.createElement)(te,null));case d.$K.reconnectGoogleAccount:return(0,o.createElement)(le,null);case d.$K.editStoreAddress:return(0,o.createElement)(de,null)}return(0,o.createElement)("div",{className:_e},(0,o.createElement)(ge.A,null),(0,o.createElement)(ue.A,null),(0,o.createElement)(me.A,null),(0,o.createElement)(u.h,null),(0,o.createElement)(T,null),(0,o.createElement)(Q,null))}}}]);