cted an array, got ' + arguments.length + ' arguments. ' +\n 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'\n );\n } else {\n printWarning('Invalid argument supplied to oneOf, expected an array.');\n }\n }\n return emptyFunctionThatReturnsNull;\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n for (var i = 0; i < expectedValues.length; i++) {\n if (is(propValue, expectedValues[i])) {\n return null;\n }\n }\n\n var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {\n var type = getPreciseType(value);\n if (type === 'symbol') {\n return String(value);\n }\n return value;\n });\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createObjectOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');\n }\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));\n }\n for (var key in propValue) {\n if (has(propValue, key)) {\n var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createUnionTypeChecker(arrayOfTypeCheckers) {\n if (!Array.isArray(arrayOfTypeCheckers)) {\n process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;\n return emptyFunctionThatReturnsNull;\n }\n\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (typeof checker !== 'function') {\n printWarning(\n 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +\n 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'\n );\n return emptyFunctionThatReturnsNull;\n }\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {\n return null;\n }\n }\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createNodeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n if (!isNode(props[propName])) {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n for (var key in shapeTypes) {\n var checker = shapeTypes[key];\n if (!checker) {\n continue;\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createStrictShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n // We need to check all keys in case some are required but missing from\n // props.\n var allKeys = assign({}, props[propName], shapeTypes);\n for (var key in allKeys) {\n var checker = shapeTypes[key];\n if (!checker) {\n return new PropTypeError(\n 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +\n '\\nBad object: ' + JSON.stringify(props[propName], null, ' ') +\n '\\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')\n );\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n\n return createChainableTypeChecker(validate);\n }\n\n function isNode(propValue) {\n switch (typeof propValue) {\n case 'number':\n case 'string':\n case 'undefined':\n return true;\n case 'boolean':\n return !propValue;\n case 'object':\n if (Array.isArray(propValue)) {\n return propValue.every(isNode);\n }\n if (propValue === null || isValidElement(propValue)) {\n return true;\n }\n\n var iteratorFn = getIteratorFn(propValue);\n if (iteratorFn) {\n var iterator = iteratorFn.call(propValue);\n var step;\n if (iteratorFn !== propValue.entries) {\n while (!(step = iterator.next()).done) {\n if (!isNode(step.value)) {\n return false;\n }\n }\n } else {\n // Iterator will provide entry [k,v] tuples rather than values.\n while (!(step = iterator.next()).done) {\n var entry = step.value;\n if (entry) {\n if (!isNode(entry[1])) {\n return false;\n }\n }\n }\n }\n } else {\n return false;\n }\n\n return true;\n default:\n return false;\n }\n }\n\n function isSymbol(propType, propValue) {\n // Native Symbol.\n if (propType === 'symbol') {\n return true;\n }\n\n // falsy value can't be a Symbol\n if (!propValue) {\n return false;\n }\n\n // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n if (propValue['@@toStringTag'] === 'Symbol') {\n return true;\n }\n\n // Fallback for non-spec compliant Symbols which are polyfilled.\n if (typeof Symbol === 'function' && propValue instanceof Symbol) {\n return true;\n }\n\n return false;\n }\n\n // Equivalent of `typeof` but with special handling for array and regexp.\n function getPropType(propValue) {\n var propType = typeof propValue;\n if (Array.isArray(propValue)) {\n return 'array';\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return 'object';\n }\n if (isSymbol(propType, propValue)) {\n return 'symbol';\n }\n return propType;\n }\n\n // This handles more types than `getPropType`. Only used for error messages.\n // See `createPrimitiveTypeChecker`.\n function getPreciseType(propValue) {\n if (typeof propValue === 'undefined' || propValue === null) {\n return '' + propValue;\n }\n var propType = getPropType(propValue);\n if (propType === 'object') {\n if (propValue instanceof Date) {\n return 'date';\n } else if (propValue instanceof RegExp) {\n return 'regexp';\n }\n }\n return propType;\n }\n\n // Returns a string that is postfixed to a warning about an invalid type.\n // For example, \"undefined\" or \"of type array\"\n function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case 'array':\n case 'object':\n return 'an ' + type;\n case 'boolean':\n case 'date':\n case 'regexp':\n return 'a ' + type;\n default:\n return type;\n }\n }\n\n // Returns class name of the object, if any.\n function getClassName(propValue) {\n if (!propValue.constructor || !propValue.constructor.name) {\n return ANONYMOUS;\n }\n return propValue.constructor.name;\n }\n\n ReactPropTypes.checkPropTypes = checkPropTypes;\n ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","/**\n * External dependencies\n */\nimport { assign } from 'lodash';\n\n/**\n * Helps create new custom error classes to better notify upper layers.\n *\n * @param {string} name - the Error name that will be availble in Error.name\n * @returns {Error} a new custom error class.\n */\nfunction createCustomError( name ) {\n\tclass CustomError extends Error {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\t\t\tthis.name = name;\n\t\t}\n\t}\n\treturn CustomError;\n}\n\nexport const JsonParseError = createCustomError( 'JsonParseError' );\nexport const JsonParseAfterRedirectError = createCustomError( 'JsonParseAfterRedirectError' );\nexport const Api404Error = createCustomError( 'Api404Error' );\nexport const Api404AfterRedirectError = createCustomError( 'Api404AfterRedirectError' );\nexport const FetchNetworkError = createCustomError( 'FetchNetworkError' );\n\n/**\n * Create a Jetpack Rest Api Client\n *\n * @param {string} root - The API root\n * @param {string} nonce - The API Nonce\n */\nfunction JetpackRestApiClient( root, nonce ) {\n\tlet apiRoot = root,\n\t\theaders = {\n\t\t\t'X-WP-Nonce': nonce,\n\t\t},\n\t\tgetParams = {\n\t\t\tcredentials: 'same-origin',\n\t\t\theaders,\n\t\t},\n\t\tpostParams = {\n\t\t\tmethod: 'post',\n\t\t\tcredentials: 'same-origin',\n\t\t\theaders: assign( {}, headers, {\n\t\t\t\t'Content-type': 'application/json',\n\t\t\t} ),\n\t\t},\n\t\tcacheBusterCallback = addCacheBuster;\n\n\tconst methods = {\n\t\tsetApiRoot( newRoot ) {\n\t\t\tapiRoot = newRoot;\n\t\t},\n\t\tsetApiNonce( newNonce ) {\n\t\t\theaders = {\n\t\t\t\t'X-WP-Nonce': newNonce,\n\t\t\t};\n\t\t\tgetParams = {\n\t\t\t\tcredentials: 'same-origin',\n\t\t\t\theaders: headers,\n\t\t\t};\n\t\t\tpostParams = {\n\t\t\t\tmethod: 'post',\n\t\t\t\tcredentials: 'same-origin',\n\t\t\t\theaders: assign( {}, headers, {\n\t\t\t\t\t'Content-type': 'application/json',\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\tsetCacheBusterCallback: callback => {\n\t\t\tcacheBusterCallback = callback;\n\t\t},\n\n\t\tregisterSite: ( registrationNonce, redirectUri ) => {\n\t\t\tconst params = {\n\t\t\t\tregistration_nonce: registrationNonce,\n\t\t\t\tno_iframe: true,\n\t\t\t};\n\n\t\t\tif ( null !== redirectUri ) {\n\t\t\t\tparams.redirect_uri = redirectUri;\n\t\t\t}\n\n\t\t\treturn postRequest( `${ apiRoot }jetpack/v4/connection/register`, postParams, {\n\t\t\t\tbody: JSON.stringify( params ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse );\n\t\t},\n\n\t\tfetchAuthorizationUrl: redirectUri =>\n\t\t\tgetRequest(\n\t\t\t\t`${ apiRoot }jetpack/v4/connection/authorize_url?no_iframe=1&redirect_uri=${ encodeURIComponent(\n\t\t\t\t\tredirectUri\n\t\t\t\t) }`,\n\t\t\t\tgetParams\n\t\t\t)\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchSiteConnectionData: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/connection/data`, getParams ).then( parseJsonResponse ),\n\n\t\tfetchSiteConnectionStatus: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/connection`, getParams ).then( parseJsonResponse ),\n\n\t\tfetchSiteConnectionTest: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/connection/test`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchUserConnectionData: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/connection/data`, getParams ).then( parseJsonResponse ),\n\n\t\tfetchUserTrackingSettings: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/tracking/settings`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tupdateUserTrackingSettings: newSettings =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/tracking/settings`, postParams, {\n\t\t\t\tbody: JSON.stringify( newSettings ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tdisconnectSite: () =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/connection`, postParams, {\n\t\t\t\tbody: JSON.stringify( { isActive: false } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchConnectUrl: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/connection/url`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tunlinkUser: () =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/connection/user`, postParams, {\n\t\t\t\tbody: JSON.stringify( { linked: false } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\treconnect: () =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/connection/reconnect`, postParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchConnectedPlugins: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/connection/plugins`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchModules: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/module/all`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchModule: slug =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/module/${ slug }`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tactivateModule: slug =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/module/${ slug }/active`, postParams, {\n\t\t\t\tbody: JSON.stringify( { active: true } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tdeactivateModule: slug =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/module/${ slug }/active`, postParams, {\n\t\t\t\tbody: JSON.stringify( { active: false } ),\n\t\t\t} ),\n\n\t\tupdateModuleOptions: ( slug, newOptionValues ) =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/module/${ slug }`, postParams, {\n\t\t\t\tbody: JSON.stringify( newOptionValues ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tupdateSettings: newOptionValues =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/settings`, postParams, {\n\t\t\t\tbody: JSON.stringify( newOptionValues ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tgetProtectCount: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/module/protect/data`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tresetOptions: options =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/options/${ options }`, postParams, {\n\t\t\t\tbody: JSON.stringify( { reset: true } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tactivateVaultPress: () =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/plugins`, postParams, {\n\t\t\t\tbody: JSON.stringify( { slug: 'vaultpress', status: 'active' } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tgetVaultPressData: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/module/vaultpress/data`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tinstallPlugin: ( slug, source ) => {\n\t\t\tconst props = { slug, status: 'active' };\n\n\t\t\tif ( source ) {\n\t\t\t\tprops.source = source;\n\t\t\t}\n\n\t\t\treturn postRequest( `${ apiRoot }jetpack/v4/plugins`, postParams, {\n\t\t\t\tbody: JSON.stringify( props ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse );\n\t\t},\n\n\t\tactivateAkismet: () =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/plugins`, postParams, {\n\t\t\t\tbody: JSON.stringify( { slug: 'akismet', status: 'active' } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tgetAkismetData: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/module/akismet/data`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tcheckAkismetKey: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/module/akismet/key/check`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tcheckAkismetKeyTyped: apiKey =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/module/akismet/key/check`, postParams, {\n\t\t\t\tbody: JSON.stringify( { api_key: apiKey } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchStatsData: range =>\n\t\t\tgetRequest( statsDataUrl( range ), getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse )\n\t\t\t\t.then( handleStatsResponseError ),\n\n\t\tgetPluginUpdates: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/updates/plugins`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tgetPlans: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/plans`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchSettings: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/settings`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tupdateSetting: updatedSetting =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/settings`, postParams, {\n\t\t\t\tbody: JSON.stringify( updatedSetting ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchSiteData: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/site`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse )\n\t\t\t\t.then( body => JSON.parse( body.data ) ),\n\n\t\tfetchSiteFeatures: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/site/features`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse )\n\t\t\t\t.then( body => JSON.parse( body.data ) ),\n\n\t\tfetchSiteProducts: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/site/products`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchSitePurchases: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/site/purchases`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse )\n\t\t\t\t.then( body => JSON.parse( body.data ) ),\n\n\t\tfetchSiteBenefits: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/site/benefits`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse )\n\t\t\t\t.then( body => JSON.parse( body.data ) ),\n\n\t\tfetchSetupQuestionnaire: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/setup/questionnaire`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchRecommendationsData: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/recommendations/data`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchRecommendationsProductSuggestions: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/recommendations/product-suggestions`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchRecommendationsUpsell: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/recommendations/upsell`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tsaveRecommendationsData: data =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/recommendations/data`, postParams, {\n\t\t\t\tbody: JSON.stringify( { data } ),\n\t\t\t} ).then( checkStatus ),\n\n\t\tfetchProducts: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/products`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchRewindStatus: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/rewind`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse )\n\t\t\t\t.then( body => JSON.parse( body.data ) ),\n\n\t\tfetchScanStatus: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/scan`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse )\n\t\t\t\t.then( body => JSON.parse( body.data ) ),\n\n\t\tdismissJetpackNotice: notice =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/notice/${ notice }`, postParams, {\n\t\t\t\tbody: JSON.stringify( { dismissed: true } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchPluginsData: () =>\n\t\t\tgetRequest( `${ apiRoot }jetpack/v4/plugins`, getParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tfetchVerifySiteGoogleStatus: keyringId => {\n\t\t\tconst request =\n\t\t\t\tkeyringId !== null\n\t\t\t\t\t? getRequest( `${ apiRoot }jetpack/v4/verify-site/google/${ keyringId }`, getParams )\n\t\t\t\t\t: getRequest( `${ apiRoot }jetpack/v4/verify-site/google`, getParams );\n\n\t\t\treturn request.then( checkStatus ).then( parseJsonResponse );\n\t\t},\n\n\t\tverifySiteGoogle: keyringId =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/verify-site/google`, postParams, {\n\t\t\t\tbody: JSON.stringify( { keyring_id: keyringId } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tsendMobileLoginEmail: () =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/mobile/send-login-email`, postParams )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tsubmitSurvey: surveyResponse =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/marketing/survey`, postParams, {\n\t\t\t\tbody: JSON.stringify( surveyResponse ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tsaveSetupQuestionnaire: props =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/setup/questionnaire`, postParams, {\n\t\t\t\tbody: JSON.stringify( props ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tupdateLicensingError: props =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/licensing/error`, postParams, {\n\t\t\t\tbody: JSON.stringify( props ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tupdateLicenseKey: license =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/licensing/set-license`, postParams, {\n\t\t\t\tbody: JSON.stringify( { license } ),\n\t\t\t} )\n\t\t\t\t.then( checkStatus )\n\t\t\t\t.then( parseJsonResponse ),\n\n\t\tupdateRecommendationsStep: step =>\n\t\t\tpostRequest( `${ apiRoot }jetpack/v4/recommendations/step`, postParams, {\n\t\t\t\tbody: JSON.stringify( { step } ),\n\t\t\t} ).then( checkStatus ),\n\t};\n\n\t/**\n\t * The default callback to add a cachebuster parameter to route\n\t *\n\t * @param {string} route - the route\n\t * @returns {string} - the route with the cachebuster appended\n\t */\n\tfunction addCacheBuster( route ) {\n\t\tconst parts = route.split( '?' ),\n\t\t\tquery = parts.length > 1 ? parts[ 1 ] : '',\n\t\t\targs = query.length ? query.split( '&' ) : [];\n\n\t\targs.push( '_cacheBuster=' + new Date().getTime() );\n\n\t\treturn parts[ 0 ] + '?' + args.join( '&' );\n\t}\n\n\t/**\n\t * Generate a request promise for the route and params. Automatically adds a cachebuster.\n\t *\n\t * @param {string} route - the route\n\t * @param {object} params - the params\n\t * @returns {Promise<Response>} - the http request promise\n\t */\n\tfunction getRequest( route, params ) {\n\t\treturn fetch( cacheBusterCallback( route ), params );\n\t}\n\n\t/**\n\t * Generate a POST request promise for the route and params. Automatically adds a cachebuster.\n\t *\n\t * @param {string} route - the route\n\t * @param {object} params - the params\n\t * @param {string} body - the body\n\t * @returns {Promise<Response>} - the http response promise\n\t */\n\tfunction postRequest( route, params, body ) {\n\t\treturn fetch( route, assign( {}, params, body ) ).catch( catchNetworkErrors );\n\t}\n\n\t/**\n\t * Returns the stats data URL for the given date range\n\t *\n\t * @param {string} range - the range\n\t * @returns {string} - the stats URL\n\t */\n\tfunction statsDataUrl( range ) {\n\t\tlet url = `${ apiRoot }jetpack/v4/module/stats/data`;\n\t\tif ( url.indexOf( '?' ) !== -1 ) {\n\t\t\turl = url + `&range=${ encodeURIComponent( range ) }`;\n\t\t} else {\n\t\t\turl = url + `?range=${ encodeURIComponent( range ) }`;\n\t\t}\n\t\treturn url;\n\t}\n\n\t/**\n\t * Returns stats data if possible, otherwise an empty object\n\t *\n\t * @param {object} statsData - the stats data or error\n\t * @returns {object} - the handled stats data\n\t */\n\tfunction handleStatsResponseError( statsData ) {\n\t\t// If we get a .response property, it means that .com's response is errory.\n\t\t// Probably because the site does not have stats yet.\n\t\tconst responseOk =\n\t\t\t( statsData.general && statsData.general.response === undefined ) ||\n\t\t\t( statsData.week && statsData.week.response === undefined ) ||\n\t\t\t( statsData.month && statsData.month.response === undefined );\n\t\treturn responseOk ? statsData : {};\n\t}\n\n\tassign( this, methods );\n}\n\nconst restApi = new JetpackRestApiClient();\n\nexport default restApi;\n\n/**\n * Check the status of the response. Throw an error if it was not OK\n *\n * @param {Response} response - the API response\n * @returns {Promise<object>} - a promise to return the parsed JSON body as an object\n */\nfunction checkStatus( response ) {\n\t// Regular success responses\n\tif ( response.status >= 200 && response.status < 300 ) {\n\t\treturn response;\n\t}\n\n\tif ( response.status === 404 ) {\n\t\treturn new Promise( () => {\n\t\t\tconst err = response.redirected\n\t\t\t\t? new Api404AfterRedirectError( response.redirected )\n\t\t\t\t: new Api404Error();\n\t\t\tthrow err;\n\t\t} );\n\t}\n\n\treturn response\n\t\t.json()\n\t\t.catch( e => catchJsonParseError( e ) )\n\t\t.then( json => {\n\t\t\tconst error = new Error( `${ json.message } (Status ${ response.status })` );\n\t\t\terror.response = json;\n\t\t\terror.name = 'ApiError';\n\t\t\tthrow error;\n\t\t} );\n}\n\n/**\n * Parse the JSON response\n *\n * @param {Response} response - the response object\n * @returns {Promise<object>} - promise to return the parsed json object\n */\nfunction parseJsonResponse( response ) {\n\treturn response.json().catch( e => catchJsonParseError( e, response.redirected, response.url ) );\n}\n\n/**\n * Throw appropriate exception given an API error\n *\n * @param {Error} e - the error\n * @param {boolean} redirected - are we being redirected?\n * @param {string} url - the URL that returned the error\n */\nfunction catchJsonParseError( e, redirected, url ) {\n\tconst err = redirected ? new JsonParseAfterRedirectError( url ) : new JsonParseError();\n\tthrow err;\n}\n\n/**\n * Catches TypeError coming from the Fetch API implementation\n */\nfunction catchNetworkErrors() {\n\t//Either one of:\n\t// * A preflight error like a redirection to an external site (which results in a CORS)\n\t// * A preflight error like ERR_TOO_MANY_REDIRECTS\n\tthrow new FetchNetworkError();\n}\n","/**\n * External dependencies\n */\nimport PropTypes from 'prop-types';\nimport React, { Fragment } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nclass JetpackLogo extends React.Component {\n\tstatic propTypes = {\n\t\tclassName: PropTypes.string,\n\t\twidth: PropTypes.number,\n\t\theight: PropTypes.number,\n\t\tshowText: PropTypes.bool,\n\t\tlogoColor: PropTypes.string,\n\t};\n\n\tstatic defaultProps = {\n\t\tclassName: '',\n\t\theight: 32,\n\t\tshowText: true,\n\t\tlogoColor: '#00BE28',\n\t};\n\n\trender() {\n\t\tconst { logoColor, showText, className, ...otherProps } = this.props;\n\t\tconst viewBox = showText ? '0 0 118 32' : '0 0 32 32';\n\n\t\treturn (\n\t\t\t<svg\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\tx=\"0px\"\n\t\t\t\ty=\"0px\"\n\t\t\t\tviewBox={ viewBox }\n\t\t\t\tclassName={ classnames( 'jetpack-logo', className ) }\n\t\t\t\taria-labelledby=\"jetpack-logo-title\"\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t<title id=\"jetpack-logo-title\">{ __( 'Jetpack Logo', 'jetpack' ) }</title>\n\t\t\t\t<path\n\t\t\t\t\tfill={ logoColor }\n\t\t\t\t\td=\"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\t\t\t\t/>\n\t\t\t\t{ showText && (\n\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t<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\" />\n\t\t\t\t\t\t<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\" />\n\t\t\t\t\t\t<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\" />\n\t\t\t\t\t\t<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\" />\n\t\t\t\t\t\t<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\" />\n\t\t\t\t\t\t<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\" />\n\t\t\t\t\t\t<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\" />\n\t\t\t\t\t</Fragment>\n\t\t\t\t) }\n\t\t\t</svg>\n\t\t);\n\t}\n}\n\nexport default JetpackLogo;\n","/**\n * External dependencies\n */\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\n\nconst Spinner = props => {\n\tconst className = props.className + ' jp-components-spinner';\n\n\tconst style = {\n\t\twidth: props.size,\n\t\theight: props.size,\n\t\tfontSize: props.size, // allows border-width to be specified in em units\n\t};\n\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<div className=\"jp-components-spinner__outer\" style={ style }>\n\t\t\t\t<div className=\"jp-components-spinner__inner\" />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nSpinner.propTypes = {\n\tclassName: PropTypes.string,\n\tsize: PropTypes.number,\n};\n\nSpinner.defaultProps = {\n\tsize: 20,\n\tclassName: '',\n};\n\nexport default Spinner;\n","/* global jetpack_redirects */\n/**\n * Builds an URL using the jetpack.com/redirect/ service\n *\n * If $source is a simple slug, it will be sent using the source query parameter. e.g. jetpack.com/redirect/?source=slug\n *\n * If $source is a full URL, starting with https://, it will be sent using the url query parameter. e.g. jetpack.com/redirect/?url=https://wordpress.com\n *\n * Note: if using full URL, query parameters and anchor must be passed in args. Any querystring of url fragment in the URL will be discarded.\n *\n * @since 0.2.0\n * @param {string} source - The URL handler registered in the server or the full destination URL (starting with https://).\n * @param {object} args - {\n *\n * Additional arguments to build the url. This is not a complete list as any argument passed here will be sent to as a query parameter to the Redirect server. These parameters will not necessarily be passed over to the final destination URL. If you want to add a parameter to the final destination URL, use the `query` argument.\n * @type {string} site URL of the current site. Will default to the value of jetpack_redirects.currentSiteRawUrl, if available.\n * @type {string} path Additional path to be appended to the URL\n * @type {string} query Query parameters to be added to the final destination URL. should be in query string format (e.g. 'key=value&foo=bar').\n * @type {string} anchor Anchor to be added to the URL\n * }\n * @returns {string} The redirect URL\n */\nexport default function getRedirectUrl( source, args = {} ) {\n\tconst queryVars = {};\n\n\tlet calypsoEnv;\n\tif ( typeof window !== 'undefined' ) {\n\t\tcalypsoEnv = window.Initial_State?.calypsoEnv;\n\t}\n\n\tif ( source.search( 'https://' ) === 0 ) {\n\t\tconst parsedUrl = new URL( source );\n\n\t\t// discard any query and fragments.\n\t\tsource = `https://${ parsedUrl.host }${ parsedUrl.pathname }`;\n\t\tqueryVars.url = encodeURIComponent( source );\n\t} else {\n\t\tqueryVars.source = encodeURIComponent( source );\n\t}\n\n\tObject.keys( args ).map( argName => {\n\t\tqueryVars[ argName ] = encodeURIComponent( args[ argName ] );\n\t} );\n\n\tif (\n\t\t! Object.keys( queryVars ).includes( 'site' ) &&\n\t\ttypeof jetpack_redirects !== 'undefined' &&\n\t\tjetpack_redirects.hasOwnProperty( 'currentSiteRawUrl' )\n\t) {\n\t\tqueryVars.site = jetpack_redirects.currentSiteRawUrl;\n\t}\n\n\tif ( calypsoEnv ) {\n\t\tqueryVars.calypso_env = calypsoEnv;\n\t}\n\n\tconst queryString = Object.keys( queryVars )\n\t\t.map( key => key + '=' + queryVars[ key ] )\n\t\t.join( '&' );\n\n\treturn `https://jetpack.com/redirect/?` + queryString;\n}\n","/**\n * External dependencies\n */\nimport React, { useEffect, useCallback, useState } from 'react';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport PropTypes from 'prop-types';\nimport restApi from '@automattic/jetpack-api';\nimport { Spinner } from '@automattic/jetpack-components';\n\n/**\n * Internal dependencies\n */\nimport ConnectUser from '../connect-user';\nimport './style.scss';\n\n/**\n * The RNA connection component.\n *\n * @param {object} props -- The properties.\n * @param {string} props.connectLabel -- The \"Connect\" button label.\n * @param {string} props.apiRoot -- API root URL, required.\n * @param {string} props.apiNonce -- API Nonce, required.\n * @param {string} props.registrationNonce -- Separate registration nonce, required.\n * @param {Function} props.onRegistered -- The callback to be called upon registration success.\n * @param {string} props.redirectUri -- The redirect admin URI.\n * @param {string} props.from -- Where the connection request is coming from.\n * @param {object} props.connectionStatus -- The connection status object.\n * @param {boolean} props.connectionStatusIsFetching -- The flag indicating that connection status is being fetched.\n * @param {boolean} props.autoTrigger -- Whether to initiate the connection process automatically upon rendering the component.\n * @returns {React.Component} The RNA connection component.\n */\nconst ConnectButton = props => {\n\tconst [ isRegistering, setIsRegistering ] = useState( false );\n\tconst [ isUserConnecting, setIsUserConnecting ] = useState( false );\n\tconst [ registationError, setRegistrationError ] = useState( false );\n\n\tconst [ authorizationUrl, setAuthorizationUrl ] = useState( null );\n\n\tconst {\n\t\tapiRoot,\n\t\tapiNonce,\n\t\tconnectLabel,\n\t\tonRegistered,\n\t\tregistrationNonce,\n\t\tredirectUri,\n\t\tfrom,\n\t\tconnectionStatus,\n\t\tconnectionStatusIsFetching,\n\t\tautoTrigger,\n\t} = props;\n\n\t/**\n\t * Initialize the REST API.\n\t */\n\tuseEffect( () => {\n\t\trestApi.setApiRoot( apiRoot );\n\t\trestApi.setApiNonce( apiNonce );\n\t}, [ apiRoot, apiNonce ] );\n\n\t/**\n\t * Initialize the site registration process.\n\t */\n\tconst registerSite = useCallback(\n\t\te => {\n\t\t\te && e.preventDefault();\n\n\t\t\tsetRegistrationError( false );\n\n\t\t\tif ( connectionStatus.isRegistered ) {\n\t\t\t\tsetIsUserConnecting( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetIsRegistering( true );\n\n\t\t\trestApi\n\t\t\t\t.registerSite( registrationNonce, redirectUri )\n\t\t\t\t.then( response => {\n\t\t\t\t\tsetIsRegistering( false );\n\n\t\t\t\t\tif ( onRegistered ) {\n\t\t\t\t\t\tonRegistered( response );\n\t\t\t\t\t}\n\n\t\t\t\t\tsetAuthorizationUrl( response.authorizeUrl );\n\t\t\t\t\tsetIsUserConnecting( true );\n\t\t\t\t} )\n\t\t\t\t.catch( error => {\n\t\t\t\t\tsetIsRegistering( false );\n\t\t\t\t\tsetRegistrationError( error );\n\t\t\t\t\tthrow error;\n\t\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tsetIsRegistering,\n\t\t\tsetAuthorizationUrl,\n\t\t\tconnectionStatus,\n\t\t\tonRegistered,\n\t\t\tregistrationNonce,\n\t\t\tredirectUri,\n\t\t]\n\t);\n\n\t/**\n\t * Auto-trigger the flow, only do it once.\n\t */\n\tuseEffect( () => {\n\t\tif ( autoTrigger && ! isRegistering && ! isUserConnecting ) {\n\t\t\tregisterSite();\n\t\t}\n\t}, [] ); // eslint-disable-line react-hooks/exhaustive-deps\n\n\treturn (\n\t\t<div className=\"jp-connect-button\">\n\t\t\t{ connectionStatusIsFetching && `Loading...` }\n\n\t\t\t{ ( ! connectionStatus.isRegistered || ! connectionStatus.isUserConnected ) &&\n\t\t\t\t! connectionStatusIsFetching && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"jp-connect-button--button\"\n\t\t\t\t\t\tlabel={ connectLabel }\n\t\t\t\t\t\tonClick={ registerSite }\n\t\t\t\t\t\tisPrimary\n\t\t\t\t\t\tdisabled={ isRegistering || isUserConnecting }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isRegistering || isUserConnecting ? <Spinner /> : connectLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t{ registationError && (\n\t\t\t\t<p className=\"jp-connect-button__error\">\n\t\t\t\t\t{ __( 'An error occurred. Please try again.', 'jetpack' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\n\t\t\t{ isUserConnecting && (\n\t\t\t\t<ConnectUser connectUrl={ authorizationUrl } redirectUri={ redirectUri } from={ from } />\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nConnectButton.propTypes = {\n\tconnectLabel: PropTypes.string,\n\tapiRoot: PropTypes.string.isRequired,\n\tapiNonce: PropTypes.string.isRequired,\n\tonRegistered: PropTypes.func,\n\tfrom: PropTypes.string,\n\tredirectUri: PropTypes.string.isRequired,\n\tregistrationNonce: PropTypes.string.isRequired,\n\tautoTrigger: PropTypes.bool,\n};\n\nConnectButton.defaultProps = {\n\tconnectLabel: __( 'Connect', 'jetpack' ),\n\tredirectUri: null,\n\tautoTrigger: false,\n};\n\nexport default ConnectButton;\n","/**\n * External dependencies\n */\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\n/**\n * The ImageSlider component.\n *\n * @param {object} props -- The properties.\n * @param {Array} props.images -- Images to display on the right side.\n * @param {string} props.assetBaseUrl -- The assets base URL\n * @returns {React.Component} The `ImageSlider` component.\n */\nconst ImageSlider = props => {\n\tconst { images, assetBaseUrl } = props;\n\n\tif ( ! images.length ) {\n\t\treturn null;\n\t}\n\n\tconst imagesHTML = [];\n\timages.forEach( image =>\n\t\timagesHTML.push(\n\t\t\t<React.Fragment>\n\t\t\t\t<img src={ assetBaseUrl + image } alt=\"\" />\n\t\t\t</React.Fragment>\n\t\t)\n\t);\n\n\treturn <div className=\"jp-connect-screen--image-slider\">{ imagesHTML }</div>;\n};\n\nImageSlider.propTypes = {\n\timages: PropTypes.arrayOf( PropTypes.string ).isRequired,\n\tassetBaseUrl: PropTypes.string,\n};\n\nImageSlider.defaultProps = {\n\tassetBaseUrl: '',\n};\n\nexport default ImageSlider;\n","/**\n * External dependencies\n */\nimport React, { useCallback, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { __ } from '@wordpress/i18n';\nimport { JetpackLogo, getRedirectUrl } from '@automattic/jetpack-components';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ConnectButton from '../connect-button';\nimport withConnectionStatus from '../with-connection-status';\nimport ImageSlider from './image-slider';\nimport './style.scss';\n\nconst ConnectButtonWithConnectionStatus = withConnectionStatus( ConnectButton );\n\n/**\n * The Connection Screen component.\n *\n * @param {object} props -- The properties.\n * @param {string} props.apiRoot -- API root URL, required.\n * @param {string} props.apiNonce -- API Nonce, required.\n * @param {string} props.registrationNonce -- Separate registration nonce, required.\n * @param {string} props.redirectUri -- The redirect admin URI.\n * @param {string} props.from -- Where the connection request is coming from.\n * @param {string} props.title -- Page title.\n * @param {Function} props.statusCallback -- Callback to pull connection status from the component.\n * @param {Array} props.images -- Images to display on the right side.\n * @param {string} props.assetBaseUrl -- The assets base URL.\n * @param {boolean} props.autoTrigger -- Whether to initiate the connection process automatically upon rendering the component.\n * @returns {React.Component} The `ConnectScreen` component.\n */\nconst ConnectScreen = props => {\n\tconst {\n\t\ttitle,\n\t\tbuttonLabel,\n\t\tapiRoot,\n\t\tapiNonce,\n\t\tregistrationNonce,\n\t\tfrom,\n\t\tredirectUri,\n\t\tstatusCallback,\n\t\timages,\n\t\tchildren,\n\t\tassetBaseUrl,\n\t\tautoTrigger,\n\t} = props;\n\n\tconst showImageSlider = images.length;\n\n\tconst [ connectionStatus, setConnectionStatus ] = useState( {} );\n\n\tconst statusHandler = useCallback(\n\t\tstatus => {\n\t\t\tsetConnectionStatus( status );\n\n\t\t\tif ( statusCallback && {}.toString.call( statusCallback ) === '[object Function]' ) {\n\t\t\t\treturn statusCallback( status );\n\t\t\t}\n\t\t},\n\t\t[ statusCallback, setConnectionStatus ]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={\n\t\t\t\t'jp-connect-screen' +\n\t\t\t\t( showImageSlider ? ' jp-connect-screen--two-columns' : '' ) +\n\t\t\t\t( connectionStatus.hasOwnProperty( 'isRegistered' ) ? '' : ' jp-connect-screen--loading' )\n\t\t\t}\n\t\t>\n\t\t\t<div className=\"jp-connect-screen--left\">\n\t\t\t\t<JetpackLogo />\n\n\t\t\t\t<h2>{ title }</h2>\n\n\t\t\t\t{ children }\n\n\t\t\t\t<ConnectButtonWithConnectionStatus\n\t\t\t\t\tapiRoot={ apiRoot }\n\t\t\t\t\tapiNonce={ apiNonce }\n\t\t\t\t\tregistrationNonce={ registrationNonce }\n\t\t\t\t\tfrom={ from }\n\t\t\t\t\tredirectUri={ redirectUri }\n\t\t\t\t\tstatusCallback={ statusHandler }\n\t\t\t\t\tconnectLabel={ buttonLabel }\n\t\t\t\t\tautoTrigger={ autoTrigger }\n\t\t\t\t/>\n\n\t\t\t\t<div className=\"jp-connect-screen--tos\">\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'By clicking the button above, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>share details</shareDetailsLink> with WordPress.com.',\n\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttosLink: (\n\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\thref={ getRedirectUrl( 'wpcom-tos' ) }\n\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tshareDetailsLink: (\n\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\thref={ getRedirectUrl( 'jetpack-support-what-data-does-jetpack-sync' ) }\n\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{ showImageSlider ? (\n\t\t\t\t<div className=\"jp-connect-screen--right\">\n\t\t\t\t\t<ImageSlider images={ images } assetBaseUrl={ assetBaseUrl } />\n\t\t\t\t</div>\n\t\t\t) : null }\n\n\t\t\t<div className=\"jp-connect-screen--clearfix\"></div>\n\t\t</div>\n\t);\n};\n\nConnectScreen.propTypes = {\n\ttitle: PropTypes.string,\n\tbody: PropTypes.string,\n\tbuttonLabel: PropTypes.string,\n\tapiRoot: PropTypes.string.isRequired,\n\tapiNonce: PropTypes.string.isRequired,\n\tfrom: PropTypes.string,\n\tredirectUri: PropTypes.string.isRequired,\n\tregistrationNonce: PropTypes.string.isRequired,\n\tstatusCallback: PropTypes.func,\n\timages: PropTypes.arrayOf( PropTypes.string ),\n\tassetBaseUrl: PropTypes.string,\n\tautoTrigger: PropTypes.bool,\n};\n\nConnectScreen.defaultProps = {\n\ttitle: __( 'Over 5 million WordPress sites are faster and more secure', 'jetpack' ),\n\tbuttonLabel: __( 'Set up Jetpack', 'jetpack' ),\n\timages: [],\n\tredirectUri: null,\n\tautoTrigger: false,\n};\n\nexport default ConnectScreen;\n","/**\n * External dependencies\n */\nimport { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport restApi from '@automattic/jetpack-api';\n\n/**\n * The user connection component.\n *\n * @param {object} props -- The properties.\n * @param {Function} props.redirectFunc -- The redirect function (`window.location.assign()` by default).\n * @param {string} props.connectUrl -- The authorization URL (no-iframe).\n * @param {string} props.redirectUri -- The redirect admin URI.\n * @param {string} props.from -- Where the connection request is coming from.\n * @returns {null} -- Nothing to return.\n */\nconst ConnectUser = props => {\n\tconst { redirectFunc, connectUrl, redirectUri, from } = props;\n\n\tconst [ authorizationUrl, setAuthorizationUrl ] = useState( null );\n\n\tif ( connectUrl && connectUrl !== authorizationUrl ) {\n\t\tsetAuthorizationUrl( connectUrl );\n\t}\n\n\t/**\n\t * Fetch the authorization URL on the first render.\n\t * To be only run once.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! authorizationUrl ) {\n\t\t\trestApi\n\t\t\t\t.fetchAuthorizationUrl( redirectUri )\n\t\t\t\t.then( response => setAuthorizationUrl( response.authorizeUrl ) )\n\t\t\t\t.catch( error => {\n\t\t\t\t\tthrow error;\n\t\t\t\t} );\n\t\t}\n\t}, [] ); // eslint-disable-line react-hooks/exhaustive-deps\n\n\tif ( ! authorizationUrl ) {\n\t\treturn null;\n\t}\n\n\tredirectFunc(\n\t\tauthorizationUrl +\n\t\t\t( from\n\t\t\t\t? ( authorizationUrl.includes( '?' ) ? '&' : '?' ) + 'from=' + encodeURIComponent( from )\n\t\t\t\t: '' )\n\t);\n\treturn null;\n};\n\nConnectUser.propTypes = {\n\tconnectUrl: PropTypes.string,\n\tredirectUri: PropTypes.string.isRequired,\n\tfrom: PropTypes.string,\n\tredirectFunc: PropTypes.func,\n};\n\nConnectUser.defaultProps = {\n\tredirectFunc: url => window.location.assign( url ),\n\tredirectUri: null,\n};\n\nexport default ConnectUser;\n","/**\n * External dependencies\n */\nimport React, { useEffect, useState, useCallback, useRef } from 'react';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport PropTypes from 'prop-types';\nimport restApi from '@automattic/jetpack-api';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ConnectUser from '../connect-user';\nimport DisconnectDialog from '../disconnect-dialog';\nimport { STORE_ID } from '../../state/store';\nimport './style.scss';\n\n/**\n * The RNA Connection Status Card component.\n *\n * @param {object} props -- The properties.\n * @param {string} props.apiRoot -- API root URL, required.\n * @param {string} props.apiNonce -- API Nonce, required.\n * @param {boolean} props.isRegistered -- Whether a site level connection has already been established, required. If not, the component will not render.\n * @param {string} props.isUserConnected -- Whether the current user has connected their WordPress.com account, required.\n * @param {string} props.redirectUri -- The redirect admin URI after the user has connected their WordPress.com account.\n * @param {string} props.title -- The Card title.\n * @param {string} props.connectionInfoText -- The text that will be displayed under the title, containing info how to leverage the connection.\n * @param {Function} props.onDisconnected -- The callback to be called upon disconnection success.\n * @returns {React.Component} The `ConnectionStatusCard` component.\n */\n\nconst ConnectionStatusCard = props => {\n\tconst {\n\t\tapiRoot,\n\t\tapiNonce,\n\t\tisRegistered,\n\t\tisUserConnected,\n\t\tredirectUri,\n\t\ttitle,\n\t\tconnectionInfoText,\n\t\tonDisconnected,\n\t} = props;\n\n\tconst [ isFetchingConnectionData, setIsFetchingConnectionData ] = useState( false );\n\tconst [ connectedUserData, setConnectedUserData ] = useState( {} );\n\tconst [ isUserConnecting, setIsUserConnecting ] = useState( false );\n\tconst { setConnectionStatus } = useDispatch( STORE_ID );\n\n\tconst avatarRef = useRef();\n\n\t/**\n\t * Initialize the REST API.\n\t */\n\tuseEffect( () => {\n\t\trestApi.setApiRoot( apiRoot );\n\t\trestApi.setApiNonce( apiNonce );\n\t}, [ apiRoot, apiNonce ] );\n\n\t/**\n\t * Fetch the connection data on the first render.\n\t * To be only run once.\n\t */\n\tuseEffect( () => {\n\t\tsetIsFetchingConnectionData( true );\n\n\t\trestApi\n\t\t\t.fetchSiteConnectionData()\n\t\t\t.then( response => {\n\t\t\t\tsetIsFetchingConnectionData( false );\n\t\t\t\tsetConnectedUserData( response.currentUser?.wpcomUser );\n\t\t\t\tconst avatar = response.currentUser?.wpcomUser?.avatar;\n\t\t\t\tif ( avatar ) {\n\t\t\t\t\tavatarRef.current.style.backgroundImage = `url('${ avatar }')`;\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( error => {\n\t\t\t\tsetIsFetchingConnectionData( false );\n\t\t\t\tthrow error;\n\t\t\t} );\n\t}, [ setIsFetchingConnectionData, setConnectedUserData ] );\n\n\tconst onDisconnectedCallback = useCallback(\n\t\te => {\n\t\t\te && e.preventDefault();\n\n\t\t\tsetConnectionStatus( { isActive: false, isRegistered: false, isUserConnected: false } );\n\n\t\t\tif ( onDisconnected && {}.toString.call( onDisconnected ) === '[object Function]' ) {\n\t\t\t\tonDisconnected();\n\t\t\t}\n\t\t},\n\t\t[ onDisconnected, setConnectionStatus ]\n\t);\n\n\t// Prevent component from rendering if site is not connected.\n\tif ( ! isRegistered ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"jp-connection-status-card\">\n\t\t\t<h3>{ title }</h3>\n\n\t\t\t<p>{ connectionInfoText }</p>\n\n\t\t\t<div className=\"jp-connection-status-card--status\">\n\t\t\t\t<div className=\"jp-connection-status-card--cloud\"></div>\n\t\t\t\t<div\n\t\t\t\t\tclassName={\n\t\t\t\t\t\t'jp-connection-status-card--line' +\n\t\t\t\t\t\t( isUserConnected ? '' : ' jp-connection-status-card--site-only' )\n\t\t\t\t\t}\n\t\t\t\t></div>\n\t\t\t\t<div className=\"jp-connection-status-card--jetpack-logo\"></div>\n\t\t\t\t<div className=\"jp-connection-status-card--avatar\" ref={ avatarRef }></div>\n\t\t\t</div>\n\n\t\t\t<ul className=\"jp-connection-status-card--list\">\n\t\t\t\t<li className=\"jp-connection-status-card--list-item-success\">\n\t\t\t\t\t{ __( 'Site connected.', 'jetpack' ) } \n\t\t\t\t\t<DisconnectDialog\n\t\t\t\t\t\tapiRoot={ apiRoot }\n\t\t\t\t\t\tapiNonce={ apiNonce }\n\t\t\t\t\t\tonDisconnected={ onDisconnectedCallback }\n\t\t\t\t\t>\n\t\t\t\t\t\t<h2>\n\t\t\t\t\t\t\t{ __( 'Jetpack is currently powering multiple products on your site.', 'jetpack' ) }\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t{ __( 'Once you disconnect Jetpack, these will no longer work.', 'jetpack' ) }\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t</DisconnectDialog>\n\t\t\t\t</li>\n\n\t\t\t\t{ isUserConnected && ! isFetchingConnectionData && (\n\t\t\t\t\t<li className=\"jp-connection-status-card--list-item-success\">\n\t\t\t\t\t\t{ __( 'Logged in as', 'jetpack' ) } { connectedUserData?.display_name }\n\t\t\t\t\t</li>\n\t\t\t\t) }\n\n\t\t\t\t{ ! isUserConnected && ! isFetchingConnectionData && (\n\t\t\t\t\t<li className=\"jp-connection-status-card--list-item-error\">\n\t\t\t\t\t\t{ __( 'Your WordPress.com account is not connected.', 'jetpack' ) }\n\t\t\t\t\t</li>\n\t\t\t\t) }\n\t\t\t</ul>\n\n\t\t\t{ ! isUserConnected && ! isFetchingConnectionData && (\n\t\t\t\t<Button\n\t\t\t\t\tisPrimary\n\t\t\t\t\tdisabled={ isUserConnecting }\n\t\t\t\t\tonClick={ setIsUserConnecting }\n\t\t\t\t\tclassName=\"jp-connection-status-card--btn-connect-user\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Connect your WordPress.com account', 'jetpack' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\n\t\t\t{ isUserConnecting && <ConnectUser redirectUri={ redirectUri } /> }\n\t\t</div>\n\t);\n};\n\nConnectionStatusCard.propTypes = {\n\tapiRoot: PropTypes.string.isRequired,\n\tapiNonce: PropTypes.string.isRequired,\n\tisRegistered: PropTypes.bool.isRequired,\n\tisUserConnected: PropTypes.bool.isRequired,\n\tredirectUri: PropTypes.string.isRequired,\n\ttitle: PropTypes.string,\n\tconnectionInfoText: PropTypes.string,\n\tonDisconnected: PropTypes.func,\n};\n\nConnectionStatusCard.defaultProps = {\n\ttitle: __( 'Connection', 'jetpack' ),\n\tconnectionInfoText: __(\n\t\t'Leverages the Jetpack Cloud for more features on your side.',\n\t\t'jetpack'\n\t),\n};\n\nexport default ConnectionStatusCard;\n","/**\n * External dependencies\n */\nimport React, { useEffect, useCallback, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { __ } from '@wordpress/i18n';\nimport { Button, Modal } from '@wordpress/components';\nimport { JetpackLogo, getRedirectUrl } from '@automattic/jetpack-components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport restApi from '@automattic/jetpack-api';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\n\n/**\n * The RNA Disconnect Dialog component.\n *\n * @param {object} props -- The properties.\n * @param {string} props.apiRoot -- API root URL, required.\n * @param {string} props.apiNonce -- API Nonce, required.\n * @param {string} props.title -- The modal title.\n * @param {Function} props.onDisconnected -- The callback to be called upon disconnection success.\n * @param {Function} props.onError -- The callback to be called upon disconnection failure.\n * @param {Function} props.errorMessage -- The error message to display upon disconnection failure.\n * @returns {React.Component} The `DisconnectDialog` component.\n */\n\nconst DisconnectDialog = props => {\n\tconst [ isOpen, setOpen ] = useState( false );\n\n\tconst [ isDisconnecting, setIsDisconnecting ] = useState( false );\n\tconst [ isDisconnected, setIsDisconnected ] = useState( false );\n\tconst [ disconnectError, setDisconnectError ] = useState( false );\n\n\tconst { apiRoot, apiNonce, title, onDisconnected, onError, errorMessage, children } = props;\n\n\t/**\n\t * Initialize the REST API.\n\t */\n\tuseEffect( () => {\n\t\trestApi.setApiRoot( apiRoot );\n\t\trestApi.setApiNonce( apiNonce );\n\t}, [ apiRoot, apiNonce ] );\n\n\t/**\n\t * Open the Disconnect Dialog.\n\t */\n\tconst openModal = useCallback(\n\t\te => {\n\t\t\te && e.preventDefault();\n\t\t\tsetOpen( true );\n\t\t},\n\t\t[ setOpen ]\n\t);\n\n\t/**\n\t * Close the Disconnect Dialog.\n\t */\n\tconst closeModal = useCallback(\n\t\te => {\n\t\t\te && e.preventDefault();\n\t\t\tsetOpen( false );\n\t\t},\n\t\t[ setOpen ]\n\t);\n\n\t/**\n\t * Disconnect - Triggered upon clicking the 'Disconnect' button.\n\t */\n\tconst disconnect = useCallback(\n\t\te => {\n\t\t\te && e.preventDefault();\n\n\t\t\tsetDisconnectError( false );\n\t\t\tsetIsDisconnecting( true );\n\n\t\t\trestApi\n\t\t\t\t.disconnectSite()\n\t\t\t\t.then( () => {\n\t\t\t\t\tsetIsDisconnecting( false );\n\n\t\t\t\t\tsetIsDisconnected( true );\n\t\t\t\t} )\n\t\t\t\t.catch( error => {\n\t\t\t\t\tsetIsDisconnecting( false );\n\t\t\t\t\tsetDisconnectError( error );\n\n\t\t\t\t\tif ( onError ) {\n\t\t\t\t\t\tonError( error );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t},\n\t\t[ setIsDisconnecting, setIsDisconnected, setDisconnectError, onError ]\n\t);\n\n\t/**\n\t * Close modal and fire 'onDisconnected' callback if exists.\n\t * Triggered upon clicking the 'Back To WordPress' button.\n\t */\n\tconst backToWordpress = useCallback(\n\t\te => {\n\t\t\te && e.preventDefault();\n\n\t\t\tif ( onDisconnected ) {\n\t\t\t\tonDisconnected();\n\t\t\t}\n\n\t\t\tcloseModal();\n\t\t},\n\t\t[ onDisconnected, closeModal ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<Button variant=\"link\" onClick={ openModal } className=\"jp-disconnect-dialog__link\">\n\t\t\t\t{ __( 'Disconnect', 'jetpack' ) }\n\t\t\t</Button>\n\n\t\t\t{ isOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle=\"\"\n\t\t\t\t\tcontentLabel={ title }\n\t\t\t\t\taria={ {\n\t\t\t\t\t\tlabelledby: 'jp-disconnect-dialog__heading',\n\t\t\t\t\t} }\n\t\t\t\t\tonRequestClose={ closeModal }\n\t\t\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\t\t\tshouldCloseOnEsc={ false }\n\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\t'jp-disconnect-dialog' + ( isDisconnected ? ' jp-disconnect-dialog__success' : '' )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ! isDisconnected && (\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<div className=\"jp-disconnect-dialog__content\">\n\t\t\t\t\t\t\t\t<h1 id=\"jp-disconnect-dialog__heading\">{ title }</h1>\n\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div className=\"jp-disconnect-dialog__actions\">\n\t\t\t\t\t\t\t\t<div className=\"jp-row\">\n\t\t\t\t\t\t\t\t\t<div className=\"lg-col-span-8 md-col-span-8 sm-col-span-4\">\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>Need help?</strong> Learn more about the <jpConnectionInfoLink>Jetpack connection</jpConnectionInfoLink> or <jpSupportLink>contact Jetpack support</jpSupportLink>',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tstrong: <strong></strong>,\n\t\t\t\t\t\t\t\t\t\t\t\t\tjpConnectionInfoLink: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thref={ getRedirectUrl(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'why-the-wordpress-com-connection-is-important-for-jetpack'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"jp-disconnect-dialog__link\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\tjpSupportLink: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thref={ getRedirectUrl( 'jetpack-support' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"jp-disconnect-dialog__link\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"jp-disconnect-dialog__button-wrap lg-col-span-4 md-col-span-8 sm-col-span-4\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tisPrimary\n\t\t\t\t\t\t\t\t\t\t\tdisabled={ isDisconnecting }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"jp-disconnect-dialog__btn-dismiss\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Stay connected', 'jetpack' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tisPrimary\n\t\t\t\t\t\t\t\t\t\t\tdisabled={ isDisconnecting }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ disconnect }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"jp-disconnect-dialog__btn-disconnect\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Disconnect', 'jetpack' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t{ disconnectError && (\n\t\t\t\t\t\t\t\t\t<p className=\"jp-disconnect-dialog__error\">{ errorMessage }</p>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isDisconnected && (\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<JetpackLogo />\n\n\t\t\t\t\t\t\t<h1>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__( 'Jetpack has been <br/>successfully disconnected.', 'jetpack' ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tbr: <br />,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</h1>\n\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tisPrimary\n\t\t\t\t\t\t\t\tonClick={ backToWordpress }\n\t\t\t\t\t\t\t\tclassName=\"jp-disconnect-dialog__btn-back-to-wp\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Back to WordPress', 'jetpack' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nDisconnectDialog.propTypes = {\n\tapiRoot: PropTypes.string.isRequired,\n\tapiNonce: PropTypes.string.isRequired,\n\ttitle: PropTypes.string,\n\tonDisconnected: PropTypes.func,\n\tonError: PropTypes.func,\n\terrorMessage: PropTypes.string,\n};\n\nDisconnectDialog.defaultProps = {\n\ttitle: __( 'Are you sure you want to disconnect?', 'jetpack' ),\n\terrorMessage: __( 'Failed to disconnect. Please try again.', 'jetpack' ),\n};\n\nexport default DisconnectDialog;\n","/**\n * External dependencies\n */\nimport React, { useCallback } from 'react';\nimport restApi from '@automattic/jetpack-api';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { STORE_ID } from '../../state/store';\n\n/**\n * Fetch the connection status and update the state accordingly.\n *\n * @param {string} apiRoot - API root URL.\n * @param {string} apiNonce - API Nonce.\n * @param {Function} onSuccess - Callback that's called upon successfully fetching the connection status.\n * @param {Function} onError - Callback that's called in case of fetching error.\n */\nconst fetchConnectionStatus = ( apiRoot, apiNonce, onSuccess, onError ) => {\n\trestApi.setApiRoot( apiRoot );\n\trestApi.setApiNonce( apiNonce );\n\n\trestApi.fetchSiteConnectionStatus().then( onSuccess ).catch( onError );\n};\n\n/**\n * Higher order component to fetch connection status and pass it further as a parameter.\n *\n * @param {React.Component} WrappedComponent - The component that needs connection status.\n * @returns {React.Component} The higher order component.\n */\nconst withConnectionStatus = WrappedComponent => {\n\t/**\n\t * The `WrappedComponent` with connection status passed into it.\n\t *\n\t * @param {object} props -- The properties.\n\t * @param {Function} props.statusCallback -- Callback to pull connection status from the component.\n\t * @returns {React.Component} The higher order component.\n\t */\n\treturn props => {\n\t\tconst { apiRoot, apiNonce, statusCallback } = props;\n\n\t\tconst connectionStatus = useSelect( select => select( STORE_ID ).getConnectionStatus(), [] );\n\t\tconst { setConnectionStatus, setConnectionStatusIsFetching } = useDispatch( STORE_ID );\n\n\t\tconst connectionStatusIsFetching = useSelect(\n\t\t\tselect => select( STORE_ID ).getConnectionStatusIsFetching(),\n\t\t\t[]\n\t\t);\n\n\t\tconst hasConnectionStatus = connectionStatus.hasOwnProperty( 'isActive' );\n\n\t\tconst onSuccess = useCallback(\n\t\t\tresponse => {\n\t\t\t\tsetConnectionStatus( response );\n\t\t\t\tsetConnectionStatusIsFetching( false );\n\t\t\t},\n\t\t\t[ setConnectionStatus, setConnectionStatusIsFetching ]\n\t\t);\n\n\t\tconst onError = useCallback(\n\t\t\terror => {\n\t\t\t\tsetConnectionStatusIsFetching( false );\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t\t[ setConnectionStatusIsFetching ]\n\t\t);\n\n\t\tconst statusCallbackWrapped = useCallback( () => {\n\t\t\tif ( statusCallback && {}.toString.call( statusCallback ) === '[object Function]' ) {\n\t\t\t\treturn statusCallback( connectionStatus );\n\t\t\t}\n\t\t}, [ connectionStatus, statusCallback ] );\n\n\t\tif ( ! hasConnectionStatus && ! connectionStatusIsFetching ) {\n\t\t\tsetConnectionStatusIsFetching( true );\n\n\t\t\tfetchConnectionStatus( apiRoot, apiNonce, onSuccess, onError );\n\t\t}\n\n\t\thasConnectionStatus && ! connectionStatusIsFetching && statusCallbackWrapped();\n\n\t\treturn (\n\t\t\t<WrappedComponent\n\t\t\t\tconnectionStatus={ connectionStatus }\n\t\t\t\tconnectionStatusIsFetching={ connectionStatusIsFetching }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t};\n};\n\nexport default withConnectionStatus;\n","const SET_CONNECTION_STATUS = 'SET_CONNECTION_STATUS';\nconst SET_CONNECTION_STATUS_IS_FETCHING = 'SET_CONNECTION_STATUS_IS_FETCHING';\n\nconst connectionStatusActions = {\n\tsetConnectionStatus: connectionStatus => {\n\t\treturn { type: SET_CONNECTION_STATUS, connectionStatus };\n\t},\n\tsetConnectionStatusIsFetching: isFetching => {\n\t\treturn { type: SET_CONNECTION_STATUS_IS_FETCHING, isFetching };\n\t},\n};\n\nexport {\n\tSET_CONNECTION_STATUS,\n\tSET_CONNECTION_STATUS_IS_FETCHING,\n\tconnectionStatusActions as default,\n};\n","/**\n * Internal dependencies\n */\nimport { SET_CONNECTION_STATUS, SET_CONNECTION_STATUS_IS_FETCHING } from './actions';\n\nconst connectionStatus = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase SET_CONNECTION_STATUS:\n\t\t\treturn { ...state, ...action.connectionStatus };\n\t}\n\n\treturn state;\n};\n\nconst connectionStatusIsFetching = ( state = false, action ) => {\n\tswitch ( action.type ) {\n\t\tcase SET_CONNECTION_STATUS_IS_FETCHING:\n\t\t\treturn action.isFetching;\n\t}\n\n\treturn state;\n};\n\nexport { connectionStatus, connectionStatusIsFetching };\n","const connectionSelectors = {\n\tgetConnectionStatus: state => state.connectionStatus || {},\n\tgetConnectionStatusIsFetching: state => state.connectionStatusIsFetching || false,\n};\n\nexport default connectionSelectors;\n","/**\n * Internal dependencies\n */\nimport connectionStatusActions from '../components/with-connection-status/state/actions';\n\nconst actions = {\n\t...connectionStatusActions,\n};\n\nexport default actions;\n","/**\n * External dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tconnectionStatus,\n\tconnectionStatusIsFetching,\n} from '../components/with-connection-status/state/reducers';\n\nconst reducers = combineReducers( {\n\tconnectionStatus,\n\tconnectionStatusIsFetching,\n} );\n\nexport default reducers;\n","/**\n * Internal dependencies\n */\nimport connectionSelectors from '../components/with-connection-status/state/selectors';\n\nconst selectors = {\n\t...connectionSelectors,\n};\n\nexport default selectors;\n","/**\n * External dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\nclass storeHolder {\n\tstatic store = null;\n\n\tstatic mayBeInit( storeId, storeConfig ) {\n\t\tif ( null === storeHolder.store ) {\n\t\t\tstoreHolder.store = createReduxStore( storeId, storeConfig );\n\t\t\tregister( storeHolder.store );\n\t\t}\n\t}\n}\n\nexport default storeHolder;\n","/**\n * Internal dependencies\n */\nimport reducer from './reducers';\nimport actions from './actions';\nimport selectors from './selectors';\nimport storeHolder from './store-holder';\n\nconst STORE_ID = 'jetpack-connection';\n\nstoreHolder.mayBeInit( STORE_ID, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nexport { STORE_ID };\n","const SET_CONNECTION_STATUS = 'SET_CONNECTION_STATUS';\n\nconst connectionStatusActions = {\n\tsetConnectionStatus: connectionStatus => {\n\t\treturn { type: SET_CONNECTION_STATUS, connectionStatus };\n\t},\n};\n\nexport { SET_CONNECTION_STATUS, connectionStatusActions as default };\n","/**\n * Internal dependencies\n */\nimport connectionStatusActions from './connection-status';\n\nconst actions = {\n\t...connectionStatusActions,\n};\n\nexport default actions;\n","/**\n * External dependencies\n */\nimport React, { useCallback } from 'react';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nimport { ConnectionStatusCard, ConnectScreen } from '@automattic/jetpack-connection';\n\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { STORE_ID } from '../../store';\nimport Header from '../header';\nimport './style.scss';\nimport ConnectRight from './assets/connect-right.png';\n\n/**\n * The Connection IU Admin App.\n *\n * @returns {object} The Admin component.\n */\nexport default function Admin() {\n\tconst APINonce = useSelect( select => select( STORE_ID ).getAPINonce(), [] );\n\tconst APIRoot = useSelect( select => select( STORE_ID ).getAPIRoot(), [] );\n\tconst registrationNonce = useSelect( select => select( STORE_ID ).getRegistrationNonce(), [] );\n\tconst assetBuildUrl = useSelect( select => select( STORE_ID ).getAssetBuildUrl(), [] );\n\n\tconst connectionStatus = useSelect( select => select( STORE_ID ).getConnectionStatus(), [] );\n\tconst { setConnectionStatus } = useDispatch( STORE_ID );\n\n\tconst statusCallback = useCallback(\n\t\tstatus => {\n\t\t\tsetConnectionStatus( status );\n\t\t},\n\t\t[ setConnectionStatus ]\n\t);\n\n\tconst onDisconnectedCallback = useCallback( () => {\n\t\tsetConnectionStatus( { isActive: false, isRegistered: false, isUserConnected: false } );\n\t}, [ setConnectionStatus ] );\n\n\treturn (\n\t\t<React.Fragment>\n\t\t\t<Header />\n\n\t\t\t{ connectionStatus.isRegistered && (\n\t\t\t\t<ConnectionStatusCard\n\t\t\t\t\tisRegistered={ connectionStatus.isRegistered }\n\t\t\t\t\tisUserConnected={ connectionStatus.isUserConnected }\n\t\t\t\t\tapiRoot={ APIRoot }\n\t\t\t\t\tapiNonce={ APINonce }\n\t\t\t\t\tonDisconnected={ onDisconnectedCallback }\n\t\t\t\t\tredirectUri=\"tools.php?page=wpcom-connection-manager\"\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ ! connectionStatus.isRegistered && (\n\t\t\t\t<ConnectScreen\n\t\t\t\t\tapiRoot={ APIRoot }\n\t\t\t\t\tapiNonce={ APINonce }\n\t\t\t\t\tregistrationNonce={ registrationNonce }\n\t\t\t\t\tfrom=\"connection-ui\"\n\t\t\t\t\tredirectUri=\"tools.php?page=wpcom-connection-manager\"\n\t\t\t\t\tstatusCallback={ statusCallback }\n\t\t\t\t\timages={ [ ConnectRight ] }\n\t\t\t\t\tassetBaseUrl={ assetBuildUrl }\n\t\t\t\t>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\"Secure and speed up your site for free with Jetpack's powerful WordPress tools.\",\n\t\t\t\t\t\t\t'jetpack'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t<li>{ __( 'Measure your impact with beautiful stats', 'jetpack' ) }</li>\n\t\t\t\t\t\t<li>{ __( 'Speed up your site with optimized images', 'jetpack' ) }</li>\n\t\t\t\t\t\t<li>{ __( 'Protect your site against bot attacks', 'jetpack' ) }</li>\n\t\t\t\t\t\t<li>{ __( 'Get notifications if your site goes offline', 'jetpack' ) }</li>\n\t\t\t\t\t\t<li>{ __( 'Enhance your site with dozens of other features', 'jetpack' ) }</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</ConnectScreen>\n\t\t\t) }\n\t\t</React.Fragment>\n\t);\n}\n","/**\n * External dependencies\n */\nimport React from 'react';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\n\n/**\n * The Connection UI header.\n *\n * @returns {object} The header component.\n */\nconst Header = () => {\n\treturn (\n\t\t<div className=\"jetpack-cui__header\">\n\t\t\t<h1>{ __( 'Connection Manager', 'jetpack' ) }</h1>\n\t\t</div>\n\t);\n};\n\nexport default Header;\n","const API = ( state = {} ) => {\n\treturn state;\n};\n\nexport default API;\n","const assets = ( state = {} ) => {\n\treturn state;\n};\n\nexport default assets;\n","/**\n * Internal dependencies\n */\nimport { SET_CONNECTION_STATUS } from '../actions/connection-status';\n\nconst connectionStatus = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase SET_CONNECTION_STATUS:\n\t\t\treturn action.connectionStatus;\n\t}\n\n\treturn state;\n};\n\nexport default connectionStatus;\n","/**\n * External dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport connectionStatus from './connection-status';\nimport API from './api';\nimport assets from './assets';\n\nconst reducer = combineReducers( {\n\tconnectionStatus,\n\tAPI,\n\tassets,\n} );\n\nexport default reducer;\n","const APISelectors = {\n\tgetAPIRoot: state => state.API.WP_API_root || null,\n\tgetAPINonce: state => state.API.WP_API_nonce || null,\n\tgetRegistrationNonce: state => state.API.registrationNonce || null,\n};\n\nexport default APISelectors;\n","const assetsSelectors = {\n\tgetAssetBuildUrl: state => state.assets.buildUrl || null,\n};\n\nexport default assetsSelectors;\n","const connectionSelectors = {\n\tgetConnectionStatus: state => state.connectionStatus || {},\n};\n\nexport default connectionSelectors;\n","/**\n * Internal dependencies\n */\nimport connectionSelectors from './connection-status';\nimport APISelectors from './api';\nimport assetsSelectors from './assets';\n\nconst selectors = {\n\t...connectionSelectors,\n\t...APISelectors,\n\t...assetsSelectors,\n};\n\nexport default selectors;\n","/**\n * Internal dependencies\n */\nimport reducer from './reducers';\nimport actions from './actions';\nimport selectors from './selectors';\n\nexport const STORE_ID = 'jetpack-connection-ui';\nexport const storeConfig = {\n\treducer,\n\tactions,\n\tselectors,\n\tinitialState: window.CUI_INITIAL_STATE || {},\n};\n","module.exports = window[\"React\"];","module.exports = window[\"ReactDOM\"];","module.exports = window[\"lodash\"];","module.exports = window[\"wp\"][\"components\"];","module.exports = window[\"wp\"][\"data\"];","module.exports = window[\"wp\"][\"element\"];","module.exports = window[\"wp\"][\"i18n\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * External dependencies\n */\nimport ReactDOM from 'react-dom';\nimport React from 'react';\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Admin from './components/admin';\nimport { STORE_ID, storeConfig } from './store';\n\nconst store = createReduxStore( STORE_ID, storeConfig );\nregister( store );\n\n/**\n * The initial renderer function.\n */\nfunction render() {\n\tconst container = document.getElementById( 'jetpack-connection-ui-container' );\n\n\tif ( null === container ) {\n\t\treturn;\n\t}\n\n\tReactDOM.render( <Admin />, container );\n}\n\nrender();\n"],"names":["assign","createCustomError","name","CustomError","args","Error","JsonParseError","JsonParseAfterRedirectError","Api404Error","Api404AfterRedirectError","FetchNetworkError","JetpackRestApiClient","root","nonce","apiRoot","headers","getParams","credentials","postParams","method","cacheBusterCallback","addCacheBuster","methods","setApiRoot","newRoot","setApiNonce","newNonce","setCacheBusterCallback","callback","registerSite","registrationNonce","redirectUri","params","registration_nonce","no_iframe","redirect_uri","postRequest","body","JSON","stringify","then","checkStatus","parseJsonResponse","fetchAuthorizationUrl","getRequest","encodeURIComponent","fetchSiteConnectionData","fetchSiteConnectionStatus","fetchSiteConnectionTest","fetchUserConnectionData","fetchUserTrackingSettings","updateUserTrackingSettings","newSettings","disconnectSite","isActive","fetchConnectUrl","unlinkUser","linked","reconnect","fetchConnectedPlugins","fetchModules","fetchModule","slug","activateModule","active","deactivateModule","updateModuleOptions","newOptionValues","updateSettings","getProtectCount","resetOptions","options","reset","activateVaultPress","status","getVaultPressData","installPlugin","source","props","activateAkismet","getAkismetData","checkAkismetKey","checkAkismetKeyTyped","apiKey","api_key","fetchStatsData","range","statsDataUrl","handleStatsResponseError","getPluginUpdates","getPlans","fetchSettings","updateSetting","updatedSetting","fetchSiteData","parse","data","fetchSiteFeatures","fetchSiteProducts","fetchSitePurchases","fetchSiteBenefits","fetchSetupQuestionnaire","fetchRecommendationsData","fetchRecommendationsProductSuggestions","fetchRecommendationsUpsell","saveRecommendationsData","fetchProducts","fetchRewindStatus","fetchScanStatus","dismissJetpackNotice","notice","dismissed","fetchPluginsData","fetchVerifySiteGoogleStatus","keyringId","request","verifySiteGoogle","keyring_id","sendMobileLoginEmail","submitSurvey","surveyResponse","saveSetupQuestionnaire","updateLicensingError","updateLicenseKey","license","updateRecommendationsStep","step","route","parts","split","query","length","push","Date","getTime","join","fetch","catchNetworkErrors","url","indexOf","statsData","responseOk","general","response","undefined","week","month","restApi","Promise","err","redirected","json","e","catchJsonParseError","error","message","PropTypes","React","Fragment","classnames","JetpackLogo","logoColor","showText","className","otherProps","viewBox","__","Component","string","width","number","height","bool","Spinner","style","size","fontSize","propTypes","defaultProps","getRedirectUrl","queryVars","calypsoEnv","window","Initial_State","search","parsedUrl","URL","host","pathname","Object","keys","map","argName","includes","jetpack_redirects","hasOwnProperty","site","currentSiteRawUrl","calypso_env","queryString","key","useEffect","useCallback","useState","Button","ConnectUser","ConnectButton","isRegistering","setIsRegistering","isUserConnecting","setIsUserConnecting","registationError","setRegistrationError","authorizationUrl","setAuthorizationUrl","apiNonce","connectLabel","onRegistered","from","connectionStatus","connectionStatusIsFetching","autoTrigger","preventDefault","isRegistered","authorizeUrl","isUserConnected","isRequired","func","ImageSlider","images","assetBaseUrl","imagesHTML","forEach","image","arrayOf","createInterpolateElement","withConnectionStatus","ConnectButtonWithConnectionStatus","ConnectScreen","title","buttonLabel","statusCallback","children","showImageSlider","setConnectionStatus","statusHandler","toString","call","tosLink","shareDetailsLink","redirectFunc","connectUrl","location","useRef","useDispatch","DisconnectDialog","STORE_ID","ConnectionStatusCard","connectionInfoText","onDisconnected","isFetchingConnectionData","setIsFetchingConnectionData","connectedUserData","setConnectedUserData","avatarRef","currentUser","wpcomUser","avatar","current","backgroundImage","onDisconnectedCallback","display_name","Modal","isOpen","setOpen","isDisconnecting","setIsDisconnecting","isDisconnected","setIsDisconnected","disconnectError","setDisconnectError","onError","errorMessage","openModal","closeModal","disconnect","backToWordpress","labelledby","strong","jpConnectionInfoLink","jpSupportLink","br","useSelect","fetchConnectionStatus","onSuccess","WrappedComponent","select","getConnectionStatus","setConnectionStatusIsFetching","getConnectionStatusIsFetching","hasConnectionStatus","statusCallbackWrapped","SET_CONNECTION_STATUS","SET_CONNECTION_STATUS_IS_FETCHING","connectionStatusActions","type","isFetching","default","state","action","connectionSelectors","actions","combineReducers","reducers","selectors","createReduxStore","register","storeHolder","storeId","storeConfig","store","reducer","mayBeInit","Header","ConnectRight","Admin","APINonce","getAPINonce","APIRoot","getAPIRoot","getRegistrationNonce","assetBuildUrl","getAssetBuildUrl","API","assets","APISelectors","WP_API_root","WP_API_nonce","assetsSelectors","buildUrl","initialState","CUI_INITIAL_STATE","ReactDOM","render","container","document","getElementById"],"sourceRoot":""}