1 line
No EOL
3.5 KiB
JavaScript
1 line
No EOL
3.5 KiB
JavaScript
"use strict";(globalThis.webpackChunkgoogle_listings_and_ads=globalThis.webpackChunkgoogle_listings_and_ads||[]).push([[553],{6343:(e,n,t)=>{t.r(n),t.d(n,{default:()=>T});var s=t(1609),a=t(6087),i=t(6427),l=t(7723),o=t(8468),g=t(3658),u=t(9927),r=t(7343),c=t(7892),d=t(9457);const h={confirmationModal:"_GQ4sGfGTeKA7JPcBsrS"};function _({onContinue:e,onRequestClose:n}){return(0,s.createElement)(d.A,{className:h.confirmationModal,title:(0,l.__)("Before you save…","google-listings-and-ads"),buttons:[(0,s.createElement)(c.A,{key:"cancel",isSecondary:!0,onClick:n},(0,l.__)("Don't save","google-listings-and-ads")),(0,s.createElement)(c.A,{key:"continue",isPrimary:!0,onClick:e},(0,l.__)("Continue to save","google-listings-and-ads"))],onRequestClose:n},(0,s.createElement)("p",null,(0,l.__)("Results typically improve with time.","google-listings-and-ads")),(0,s.createElement)("p",null,(0,l.__)("Changes will result in the loss of any optimisations learned over time.","google-listings-and-ads")),(0,s.createElement)("p",null,(0,l.__)("We recommend allowing your listings to run for at least 14 days after set up without changing them for optimal performance.","google-listings-and-ads")))}var m=t(5847),p=t(873),S=t(1650),f=t(6523),A=t(5622),v=t(5640),y=t(4716),C=t(5455),E=t(5807),w=t(8606),b=t(8998),R=t(6473);function T(){const{targetAudience:e,getFinalCountries:n}=(0,m.A)(),{settings:t,saveSettings:c,syncSettings:d}=(0,p.A)(),{saveTargetAudience:h}=(0,g.j)(),{saveShippingRates:T}=(0,C.A)(),{saveShippingTimes:k}=(0,E.A)(),[q,F]=(0,a.useState)(e),[G,M]=(0,a.useState)(t),{hasFinishedResolution:P,data:B}=(0,f.A)(),[j,x]=(0,a.useState)(B),{hasFinishedResolution:N,data:Y}=(0,A.A)(),[D,J]=(0,a.useState)(Y),[K,L]=(0,a.useState)(null);(0,a.useEffect)((()=>M(t)),[t]),(0,a.useEffect)((()=>F(e)),[e]),(0,a.useEffect)((()=>x(B)),[B]),(0,a.useEffect)((()=>J(Y)),[Y]);const{createNotice:Q}=(0,v.A)(),U=!(0,o.isEqual)(...[q,e].map((e=>({...e,countries:new Set(e?.countries)})))),W=!(0,o.isEqual)(G,t),z=(I=B,(H=j).length!==I.length||(0,y.A)(H,I).length>0);var H,I;const O=!(0,o.isEqual)(new Set(D),new Set(Y)),V=U||W||z||O;(0,S.A)((0,l.__)("You have unsaved changes. Are you sure you want to leave?","google-listings-and-ads"),V);const X=q?.countries?q:null,Z=G?.shipping_rate?G:null,$=P?B:null,ee=N?Y:null;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.A,null),(0,s.createElement)(r.A,{targetAudience:X,resolveFinalCountries:n,onTargetAudienceChange:F,settings:Z,onSettingsChange:M,shippingRates:$,onShippingRatesChange:x,shippingTimes:ee,onShippingTimesChange:J,onRequestSubmit:()=>new Promise((e=>{L((()=>n=>{e(n),L(null)}))})),onContinue:async()=>{try{const e=[h(q),c(G),T(j),k(D)],n=await(0,w.A)(e,[(0,l.__)("Target audience","google-listings-and-ads"),(0,l.__)("Merchant Center Settings","google-listings-and-ads"),(0,l.__)("Shipping rates","google-listings-and-ads"),(0,l.__)("Shipping times","google-listings-and-ads")]);await d(),n?Q("error",n):Q("success",(0,l.__)("Your changes have been saved and will be synced to your Google Merchant Center account.","google-listings-and-ads")),(0,R.ce)("gla_free_campaign_edited")}catch(e){(0,b.h)(e,(0,l.__)("Unable to save your changes.","google-listings-and-ads"),(0,l.__)("Something went wrong while saving your changes. Please try again later.","google-listings-and-ads"))}},submitLabel:(0,l.__)("Save changes","google-listings-and-ads")}),(0,s.createElement)(i.Flex,{justify:"flex-end"},(0,s.createElement)(r.A.SubmitButton,null)),K&&(0,s.createElement)(_,{onContinue:()=>K(!0),onRequestClose:()=>K(!1)}))}}}]); |