laipower/wp-content/plugins/jetpack-protect/jetpack_vendor/automattic/jetpack-connection/dist/jetpack-connection.js

7 lines
91 KiB
JavaScript
Raw Normal View History

/*! For license information please see jetpack-connection.js.LICENSE.txt */
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.JetpackConnection=n():e.JetpackConnection=n()}(self,(()=>(()=>{var e={7689:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});const o={error:"TcCZnGE6mad8Dvz9pCZi",button:"_mn6o2Dtm5pfFWc8_A1K"}},2258:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});const o={button:"zI5tJ_qhWE6Oe6Lk75GY","is-icon-button":"tuBt2DLqimiImoqVzPqo",small:"Na39I683LAaSA99REg14",normal:"ipS7tKy9GntCS4R3vekF",icon:"paGLQwtPEaJmtArCcmyK",regular:"lZAo6_oGfclXOO9CC6Rd","full-width":"xJDOiJxTt0R_wSl8Ipz_",loading:"q_tVWqMjl39RcY6WtQA6","external-icon":"CDuBjJp_8jxzx5j6Nept"}},9535:()=>{},8403:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});const o={sm:"(max-width: 599px)",md:"(min-width: 600px) and (max-width: 959px)",lg:"(min-width: 960px)"}},6406:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});const o={placeholder:"NisihrgiIKl_knpYJtfg",pulse:"R2i0K45dEF157drbVRPI"}},4319:()=>{},8325:()=>{},9634:()=>{},4495:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});const o={reset:"WQVtrU6q0L1Igcj7wCrQ","headline-medium":"UujoBFTnQNY2cWU2SIsH","headline-small":"TeGO5V_thHw5lDAm1_2M","headline-small-regular":"WolQzb2MsSgiNmLtc7_j","title-medium":"hUB0JT8p1T2Hw28N6qC8","title-medium-semi-bold":"gKZWDv5chz3_O3Syp74H","title-small":"zY2No8Ga4b8shbOQGhnv",body:"tIj0D1t8Cc892ikmgFPZ","body-small":"KdcN0BnOaVeVhyLRKqhS","body-extra-small":"dso3Rh3tl3Xv1GumBktz","body-extra-small-bold":"mQ1UlbN9u4Mg9byO8m7v",label:"PItlW5vRExLnTj4a8eLE","m-0":"TwRpPlktzxhmFVeua7P5","mx-0":"zVfqx7gyb3o9mxfGynn1","my-0":"iSHVzNiB9iVleGljaQxy","mt-0":"xqDIp6cNVr_E6RXaiPyD","mr-0":"S8EwaXk1kyPizt6x4WH2","mb-0":"ODX5Vr1TARoLFkDDFooD","ml-0":"cphJ8dCpfimnky7P2FHg","m-1":"PFgIhNxIyiSuNvQjAIYj","mx-1":"M2jKmUzDxvJjjVEPU3zn","my-1":"io15gAh8tMTNbSEfwJKk","mt-1":"rcTN5uw9xIEeMEGL3Xi_","mr-1":"CQSkybjq2TcRM1Xo9COV","mb-1":"hfqOWgq6_MEGdFE82eOY","ml-1":"I8MxZQYTbuu595yfesWA","m-2":"kQkc6rmdpvLKPkyoJtVQ","mx-2":"j6vFPxWuu4Jan2ldoxpp","my-2":"hqr39dC4H_AbactPAkCG","mt-2":"c3dQnMi16C6J6Ecy4283","mr-2":"YNZmHOuRo6hU7zzKfPdP","mb-2":"Db8lbak1_wunpPk8NwKU","ml-2":"ftsYE5J9hLzquQ0tA5dY","m-3":"Det4MHzLUW7EeDnafPzq","mx-3":"h_8EEAztC29Vve1datb5","my-3":"YXIXJ0h1k47u6hzK8KcM","mt-3":"soADBBkcIKCBXzCTuV9_","mr-3":"zSX59ziEaEWGjnpZa4uV","mb-3":"yrVTnq_WBMbejg89c2ZQ","ml-3":"UKtHPJnI2cXBWtPDm5hM","m-4":"guexok_Tqd5Tf52hRlbT","mx-4":"oS1E2KfTBZkJ3F0tN7T6","my-4":"DN1OhhXi6AoBgEdDSbGd","mt-4":"ot2kkMcYHv53hLZ4LSn0","mr-4":"A1krOZZhlQ6Sp8Cy4bly","mb-4":"pkDbXXXL32237M0hokEh","ml-4":"XXv4kDTGvEnQeuGKOPU3","m-5":"yGqHk1a57gaISwkXwXe6","mx-5":"X8cghM358X3DkXLc9aNK","my-5":"GdfSmGwHlFnN2S6xBn1f","mt-5":"yqeuzwyGQ7zG0avrGqi_","mr-5":"g9emeCkuHvYhveiJbfXO","mb-5":"Lvk3dqcyHbZ07QCRlrUQ","ml-5":"r3yQECDQ9qX0XZzXlVAg","m-6":"aQhlPwht2Cz1X_63Miw0","mx-6":"JyHb0vK3wJgpblL9s5j8","my-6":"cY2gULL1lAv6WPNIRuf3","mt-6":"NBWQ9Lwhh_fnry3lg_p7","mr-6":"yIOniNe5E40C8fWvBm5V","mb-6":"t30usboNSyqfQWIwHvT3","ml-6":"Nm_TyFkYCMhOoghoToKJ","m-7":"C4qJKoBXpgKtpmrqtEKB","mx-7":"S93Srbu6NQ_PBr7DmTiD","my-7":"fJj8k6gGJDks3crUZxOS","mt-7":"cW6D6djs7Ppm7fD7TeoV","mr-7":"DuCnqNfcxcP3Z__Yo5Ro","mb-7":"im8407m2fw5vOg7O2zsw","ml-7":"G0fbeBgvz2sh3uTP9gNl","m-8":"kvW3sBCxRxUqz1jrVMJl","mx-8":"tOjEqjLONQdkiYx_XRnw","my-8":"op5hFSx318zgxsoZZNLN","mt-8":"c9WfNHP6TFKWIfLxv52J","mr-8":"sBA75QqcqRwwYSHJh2wc","mb-8":"GpL6idrXmSOM6jB8Ohsf","ml-8":"HbtWJoQwpgGycz8dGzeT","p-0":"uxX3khU88VQ_Ah49Ejsa","px-0":"KX0FhpBKwKzs9fOUdbNz","py-0":"PfK8vKDyN32dnimlzYjz","pt-0":"emxLHRjQuJsImnPbQIzE","pr-0":"kJ8WzlpTVgdViXt8ukP9","pb-0":"tg_UIUI11VBzrTAn2AzJ","pl-0":"uczvl8kaz84oPQJ2DB2R","p-1":"o7UHPcdVK3lt7q3lqV4o","px-1":"IDqEOxvDoYrFYxELPmtX","py-1":"DdywPW2qSYlu2pt8tpO2","pt-1":"npy3hw4A5QSkDicb2CJJ","pr-1":"LgbptTApNY5NwLQvEFAt","pb-1":"WZQy2SZuZso59bUsXXyl","pl-1":"o331apInxNunbYB3SfPE","p-2":"fMPIyD9Vqki1Lrc_yJnG","px-2":"i2pMcTcdrr10IQoiSm_L","py-2":"eA702gn32kwptiI1obXH","pt-2":"o9bGieUKcYc8o0Ij9oZX","pr-2":"SwZcFez1RDqWsOFjB5iG","pb-2":"eHpLc_idmuEqeqCTvqkN","pl-2":"vU39i2B4P1fUTMB2l6Vo","p-3":"JHWNzBnE29awhdu5BEh1","px-3":"X72lGbb56L3
__("(opens in a new tab)","jetpack-connection"))),A=f?"_blank":void 0,N=t?.[0]&&null!==t[0]&&"components-tooltip"!==t?.[0]?.props?.className;return d().createElement(c.Button,i()({target:A,variant:o,className:(0,l.A)(v,{"has-text":!!m&&N}),icon:f?void 0:m,iconSize:g,disabled:h,"aria-disabled":h,isDestructive:_,text:k},E),y&&d().createElement(c.Spinner,null),d().createElement("span",null,t),w)}));m.displayName="Button";const g=m},9121:(e,n,t)=>{"use strict";t.d(n,{A:()=>o});t(9535);const o=({format:e="horizontal",icon:n,imageUrl:t})=>React.createElement("div",{className:"jp-components__decorative-card "+(e?"jp-components__decorative-card--"+e:"")},React.createElement("div",{className:"jp-components__decorative-card__image",style:{backgroundImage:t?`url( ${t} )`:""}}),React.createElement("div",{className:"jp-components__decorative-card__content"},React.createElement("div",{className:"jp-components__decorative-card__lines"})),n?React.createElement("div",{className:"jp-components__decorative-card__icon-container"},React.createElement("span",{className:"jp-components__decorative-card__icon jp-components__decorative-card__icon--"+n})):null)},7142:(e,n,t)=>{"use strict";t.d(n,{A:()=>l});var o=t(8579),i=t.n(o),c=t(7723),r=t(2231),s=t(1609),a=t.n(s);const __=c.__,l=({logoColor:e="#069e08",showText:n=!0,className:t,height:o=32,...c})=>{const s=n?"0 0 118 32":"0 0 32 32";return a().createElement("svg",i()({xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:s,className:(0,r.A)("jetpack-logo",t),"aria-labelledby":"jetpack-logo-title",height:o},c,{role:"img"}),a().createElement("title",{id:"jetpack-logo-title"},__("Jetpack Logo","jetpack-connection")),a().createElement("path",{fill:e,d:"M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"}),n&&a().createElement(a().Fragment,null,a().createElement("path",{d:"M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"}),a().createElement("path",{d:"M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"}),a().createElement("path",{d:"M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"}),a().createElement("path",{d:"M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z"}),a().createElement("path",{d:"M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z"}),a().createElement("path",{d:"M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z"}),a().createElement("path",{d:"M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z"})))}},442:(e,n,t)=>{"use strict";t.d(n,{A:()=>r});var o=t(9491),i=t(8403);const c=["sm","md","lg"],r=(e,n)=>{const t=Array.isArray(e)?e:[e],r=Array.isArray(n)?n:[n],[s,a,l]=c,p={sm:(0,o.useMediaQuery)(i.A[s]),md:(0,o.useMediaQuery)(i.A[a]),lg:(0,o.useMediaQuery)(i.A[l])};return t.map(((e,n)=>{const t=r[n];return t?((e,n,t)=>{const o=c.indexOf(e),i=o+1,r=n.includes("=");let s=[];return n.startsWith("<")&&(s=c.slice(0,r?i:o)),n.startsWith(">")&&(s=c.slice(r?o:i)),s?.length?s.some((e=>t[e])):t[e]})(e,t,p):p[e]}))}},1876:(e,n,t)=>{"use strict";t.d(n,{A:()=>s});var o=t(2231),i=t(1609),c=t.n(i),r=t(6406);const s=({children:e=null,width:n=null,height:t=null,className:i=""})=>c().createElement("div",{className:(0,o.A)(r.A.placeholder,
__("Icon for the product %s","jetpack-connection"),t.title)}):t.icon),React.createElement("h1",{className:"jp-components__pricing-card__title"},t.title),React.createElement("div",{className:"jp-components__pricing-card__pricing"},t.priceBefore!==t.priceAfter&&t.priceAfter>0?React.createElement("div",{className:"jp-components__pricing-card__price-before"},React.createElement("span",{className:"jp-components__pricing-card__currency"},l.symbol),React.createElement("span",{className:"jp-components__pricing-card__price"},l.integer),a(l)&&React.createElement("span",{className:"jp-components__pricing-card__price-decimal"}," ",l.fraction),React.createElement("div",{className:"jp-components__pricing-card__price-strikethrough"})):React.createElement(i.A,{width:"100%",height:48}),t.priceAfter>0&&React.createElement(React.Fragment,null,React.createElement("div",{className:"jp-components__pricing-card__price-after"},React.createElement("span",{className:"jp-components__pricing-card__currency"},p.symbol),React.createElement("span",{className:"jp-components__pricing-card__price"},p.integer),a(p)&&React.createElement("span",{className:"jp-components__pricing-card__price-decimal"},p.fraction)),React.createElement("span",{className:"jp-components__pricing-card__price-details"},n))),t.children&&React.createElement("div",{className:"jp-components__pricing-card__extra-content-wrapper"},t.children),t.tosText&&React.createElement("div",{className:"jp-components__pricing-card__tos"},t.tosText),t.ctaText&&React.createElement(React.Fragment,null,!t.tosText&&React.createElement("div",{className:"jp-components__pricing-card__tos"},React.createElement(s.A,{agreeButtonLabel:t.ctaText})),React.createElement("div",{className:"jp-components__pricing-card__cta"},React.createElement(c.Button,{className:"jp-components__pricing-card__button",label:t.ctaText,onClick:t.onCtaClick},t.ctaText))),t.infoText&&React.createElement("div",{className:"jp-components__pricing-card__info"},t.infoText))}},6461:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});var o=t(3619),i=t.n(o),c=t(1609),r=t.n(c);t(8325);const s=({color:e="#FFFFFF",className:n="",size:t=20})=>{const o=n+" jp-components-spinner",i={width:t,height:t,fontSize:t,borderTopColor:e},c={borderTopColor:e,borderRightColor:e};return r().createElement("div",{className:o},r().createElement("div",{className:"jp-components-spinner__outer",style:i},r().createElement("div",{className:"jp-components-spinner__inner",style:c})))};s.propTypes={color:i().string,className:i().string,size:i().number};const a=s},5879:(e,n,t)=>{"use strict";t.d(n,{A:()=>m});var o=t(8579),i=t.n(o),c=t(6087),r=t(7723),s=t(2231),a=t(3924),l=t(7425);t(9634);const __=r.__,p=({multipleButtonsLabels:e})=>Array.isArray(e)&&e.length>1?(0,c.createInterpolateElement)((0,r.sprintf)(/* translators: %1$s is button label 1 and %2$s is button label 2 */
__("By clicking <strong>%1$s</strong> or <strong>%2$s</strong>, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your sites data</shareDetailsLink> with us.","jetpack-connection"),e[0],e[1]),{strong:React.createElement("strong",null),tosLink:React.createElement(u,{slug:"wpcom-tos"}),shareDetailsLink:React.createElement(u,{slug:"jetpack-support-what-data-does-jetpack-sync"})}):(0,c.createInterpolateElement)(__("By clicking the buttons above, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your sites data</shareDetailsLink> with us.","jetpack-connection"),{tosLink:React.createElement(u,{slug:"wpcom-tos"}),shareDetailsLink:React.createElement(u,{slug:"jetpack-support-what-data-does-jetpack-sync"})}),d=({agreeButtonLabel:e})=>(0,c.createInterpolateElement)((0,r.sprintf)(/* translators: %s is a button label */
__("By clicking <strong>%s</strong>, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your sites data</shareDetailsLink> with us.","jetpack-connection"),e),{strong:React.createElement("strong",null),tosLink:React.createElement(u,{slug:"wpcom-tos"}),shareDetailsLink:React.createElement(u,{slug:"jetpack-support-what-data-does-jetpack-sync"})}),u=({slug:e,children:n})=>React.createElement("a",{className:"terms-of-service__link",href:(0,a.A)(e),rel:"noopener noreferrer",target:"_blank"},n),m=({className:e,multipleButtons:n,agreeButtonLabel:t,...o})=>React.createElement(l.Ay,i()({className:(0,s.A)(e,"terms-of-service")},o),n?React.createElement(p,{multipleButtonsLabels:n}):React.createElement(d,{agreeButtonLabel:t}))},110:(e,n,t)=>{"use strict";t.d(n,{Q:()=>o,Z:()=>i});const o={"headline-medium":"h1","headline-small":"h2","headline-small-regular":"h2","title-medium":"h3","title-medium-semi-bold":"h3","title-small":"h4",body:"p","body-small":"p","body-extra-small":"p","body-extra-small-bold":"p",label:"p"},i=["mt","mr","mb","ml","mx","my","m","pt","pr","pb","pl","px","py","p"]},7425:(e,n,t)=>{"use strict";t.d(n,{Ay:()=>d});var o=t(8579),i=t.n(o),c=t(2231),r=t(1609),s=t.n(r),a=t(110),l=t(4495);const p=(0,r.forwardRef)((({variant:e="body",children:n,component:t,className:o,...p},d)=>{const u=t||a.Q[e]||"span",m=(0,r.useMemo)((()=>a.Z.reduce(((e,n)=>(void 0!==p[n]&&(e+=l.A[`${n}-${p[n]}`]+" ",delete p[n]),e)),"")),[p]);return p.ref=d,s().createElement(u,i()({className:(0,c.A)(l.A.reset,l.A[e],o,m)},p),n)}));p.displayName="Text";const d=p},3924:(e,n,t)=>{"use strict";function o(e,n={}){const t={};let o;if("undefined"!=typeof window&&(o=window?.JP_CONNECTION_INITIAL_STATE?.calypsoEnv),0===e.search("https://")){const n=new URL(e);e=`https://${n.host}${n.pathname}`,t.url=encodeURIComponent(e)}else t.source=encodeURIComponent(e);for(const e in n)t[e]=encodeURIComponent(n[e]);!Object.keys(t).includes("site")&&"undefined"!=typeof jetpack_redirects&&Object.hasOwn(jetpack_redirects,"currentSiteRawUrl")&&(t.site=jetpack_redirects.currentBlogID??jetpack_redirects.currentSiteRawUrl),o&&(t.calypso_env=o);return"https://jetpack.com/redirect/?"+Object.keys(t).map((e=>e+"="+t[e])).join("&")}t.d(n,{A:()=>o})},6439:(e,n,t)=>{let o={};try{o=t(9074)}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),o={missingConfig:!0}}const i=e=>Object.hasOwn(o,e);e.exports={jetpackConfigHas:i,jetpackConfigGet:e=>{if(!i(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return o[e]}}},8421:(e,n,t)=>{"use strict";t.d(n,{A:()=>d});var o=t(8089),i=t(7723),c=t(3619),r=t.n(c),s=t(1609),a=t.n(s),l=t(9660);const __=i.__,p=e=>{const{apiRoot:n,apiNonce:t,connectLabel:i=__("Connect","jetpack-connection"),registrationNonce:c,redirectUri:r=null,from:s,autoTrigger:p=!1}=e,{handleRegisterSite:d,isRegistered:u,isUserConnected:m,siteIsRegistering:g,userIsConnecting:h,registrationError:_}=(0,l.A)({registrationNonce:c,redirectUri:r,apiRoot:n,apiNonce:t,autoTrigger:p,from:s});return a().createElement(a().Fragment,null,(!u||!m)&&a().createElement(o.A,{label:i,onClick:d,displayError:!!_,isLoading:g||h}))};p.propTypes={connectLabel:r().string,apiRoot:r().string.isRequired,apiNonce:r().string.isRequired,from:r().string,redirectUri:r().string.isRequired,registrationNonce:r().string.isRequired,autoTrigger:r().bool};const d=p},6212:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});var o=t(7723),i=t(1609),c=t.n(i),r=t(9660),s=t(5582);const __=o.__,a=({title:e,buttonLabel:n,loadingLabel:t,apiRoot:o,apiNonce:i,registrationNonce:a,from:l,redirectUri:p,images:d,children:u,assetBaseUrl:m,autoTrigger:g,footer:h,skipUserConnection:_,logo:y})=>{const{handleRegisterSite:f,siteIsRegistering:b,userIsConnecting:k,registrationError:C,isOfflineMode:E}=(0,r.A)({registrationNonce:a,redirectUri:p,apiRoot:o,apiNonce:i,autoTrigger:g,from:l,skipUserConnection:_}),v=Boolean(C),j=b||k,w=C?.response?.code;return c().creat
__("There was an error reconnecting Jetpack. Error: %s","jetpack-connection"),a))):null;return p().createElement(p().Fragment,null,g,p().createElement(c.Notice,{status:"error",isDismissible:!1,className:u},p().createElement("div",{className:d.A.message},m,n),s&&p().createElement("a",{onClick:s,onKeyDown:s,className:d.A.button,href:"#"},__("Restore Connection","jetpack-connection"))))};u.propTypes={message:a().string.isRequired,restoreConnectionCallback:a().func,isRestoringConnection:a().bool,restoreConnectionError:a().string};const m=u},7499:(e,n,t)=>{"use strict";t.d(n,{A:()=>a});var o=t(3619),i=t.n(o),c=t(1609),r=t.n(c);t(7419);const s=e=>{const{title:n,value:t,description:o}=e;return r().createElement("div",{className:"jp-connection__disconnect-card card"},r().createElement("div",{className:"jp-connection__disconnect-card__card-content"},r().createElement("p",{className:"jp-connection__disconnect-card__card-headline"},n),(t||o)&&r().createElement("div",{className:"jp-connection__disconnect-card__card-stat-block"},r().createElement("span",{className:"jp-connection__disconnect-card__card-stat"},t),r().createElement("div",{className:"jp-connection__disconnect-card__card-description"},o))))};s.propTypes={title:i().string,value:i().oneOfType([i().string,i().number]),description:i().string};const a=s},3269:(e,n,t)=>{"use strict";t.d(n,{A:()=>y});var o=t(372),i=t(5932),c=t(6439),r=t(6427),s=t(7723),a=t(3619),l=t.n(a),p=t(1609),d=t.n(p),u=(t(785),t(4472)),m=t(8503),g=t(412),h=t(8090);const __=s.__,_=e=>{const[n,t]=(0,p.useState)(!1),[s,a]=(0,p.useState)(!1),[l,_]=(0,p.useState)(!1),[y,f]=(0,p.useState)(!1),[b,k]=(0,p.useState)(!1),[C,E]=(0,p.useState)(!1),{apiRoot:v,apiNonce:j,connectedPlugins:w,title:A=__("Are you sure you want to disconnect?","jetpack-connection"),pluginScreenDisconnectCallback:N,onDisconnected:S,onError:R,disconnectStepComponent:T,context:O="jetpack-dashboard",connectedUser:I={},connectedSiteId:D,isOpen:P,onClose:x}=e;let U="";(0,c.jetpackConfigHas)("consumer_slug")&&(U=(0,c.jetpackConfigGet)("consumer_slug"));const F=(0,p.useMemo)((()=>({context:O,plugin:U})),[O,U]);(0,p.useEffect)((()=>{i.Ay.setApiRoot(v),i.Ay.setApiNonce(j)}),[v,j]),(0,p.useEffect)((()=>{I&&I.ID&&I.login&&o.A.initialize(I.ID,I.login)}),[I,I.ID,I.login]),(0,p.useEffect)((()=>{P&&o.A.tracks.recordEvent("jetpack_disconnect_dialog_open",F)}),[P,F]),(0,p.useEffect)((()=>{P&&(s?!s||y||b?y&&!b?o.A.tracks.recordEvent("jetpack_disconnect_dialog_step",Object.assign({},{step:"survey"},F)):b&&o.A.tracks.recordEvent("jetpack_disconnect_dialog_step",Object.assign({},{step:"thank_you"},F)):o.A.tracks.recordEvent("jetpack_disconnect_dialog_step",Object.assign({},{step:"disconnect_confirm"},F)):o.A.tracks.recordEvent("jetpack_disconnect_dialog_step",Object.assign({},{step:"disconnect"},F)))}),[P,s,y,b,F]);const L=(0,p.useCallback)((()=>{i.Ay.disconnectSite().then((()=>{t(!1),a(!0)})).catch((e=>{t(!1),_(e),R&&R(e)}))}),[t,a,_,R]),B=(0,p.useCallback)(((e,n)=>{E(!0),fetch("https://public-api.wordpress.com/wpcom/v2/marketing/feedback-survey",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e)}).then((e=>e.json())).then((e=>{if(!0!==e.success)throw new Error("Survey endpoint returned error code "+e.code);o.A.tracks.recordEvent("jetpack_disconnect_survey_submit",n),k(!0),E(!1)})).catch((e=>{o.A.tracks.recordEvent("jetpack_disconnect_survey_error",Object.assign({},{error:e.message},n)),k(!0),E(!1)}))}),[E,k]),M=(0,p.useCallback)((e=>{e&&e.preventDefault(),_(!1),t(!0),"plugins"!==O?L():N&&N(e)}),[_,t,N,O,L]),$=(0,p.useCallback)((e=>o.A.tracks.recordEvent(e,F)),[F]),J=(0,p.useCallback)((()=>!(!I.ID||!D)),[I,D]),z=(0,p.useCallback)(((e,n,t)=>{if(t&&t.preventDefault(),!J())return void k(!0);const o={site_id:D,user_id:I.ID,survey_id:"jetpack-plugin-disconnect",survey_responses:{"why-cancel":{response:e,text:n||null}}},i=Object.assign({},F,{disconnect_reason:e});B(o,i)}),[B,k,J,D,I,F]),q=(0,p.useCallback)((e=>{e&&e.preventDefault(),S&&S(),x()}),[S,x]),G=(0,p.useCallback)((e=>{e&&e.preventDefault(),f(!0)}),[f])