Liferay.Loader.define("layout-reports-web@1.0.56/js/components/error-alert/ErrorAlert",["module","exports","require","@frontend-taglib-clay$clayui/alert","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/link","liferay!frontend-js-react-web$react","../../constants/googlePageSpeed","../../context/StoreContext","./ErrorAlertExtendedInfo"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/alert")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/link")),o=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),i=a("../../constants/googlePageSpeed"),u=a("../../context/StoreContext"),d=_interopRequireDefault(a("./ErrorAlertExtendedInfo"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=()=>{const[e,t]=(0,o.useState)(!1),{data:a,error:c}=(0,o.useContext)(u.StoreStateContext),f=(null==c?void 0:c.code)===i.PAGE_SPEED_API_KEY_ERROR_CODE&&(null==c?void 0:c.status)===i.PAGE_SPEED_API_KEY_INVALID_STATUS,g=(null==c?void 0:c.code)===i.PAGE_SPEED_SERVER_ERROR_CODE,s=g||(null==a?void 0:a.privateLayout),p=!(null==a?void 0:a.configureGooglePageSpeedURL),y=f?Liferay.Language.get("the-api-key-is-invalid"):s?Liferay.Language.get("this-page-cannot-be-audited"):Liferay.Language.get("an-unexpected-error-occurred"),_=e?Liferay.Language.get("hide-details"):Liferay.Language.get("show-details");return o.default.createElement(r.default,{displayType:f||!f&&!s?"danger":"warning",title:y,variant:"stripe"},s&&o.default.createElement("span",null,"".concat(Liferay.Language.get("private-local-or-intranet-pages-cannot-be-audited-as-they-are-not-accessible-from-the-internet")," ")),p&&f&&o.default.createElement("span",null,"".concat(Liferay.Language.get("you-can-set-the-api-key-from-site-settings-pages-google-pagespeed-insights")," ")),(f||g)&&o.default.createElement(n.default,{className:"link-primary",displayType:"unstyled",onClick:()=>t((e=>!e))},_),e&&o.default.createElement(d.default,{error:c}),f&&(null==a?void 0:a.configureGooglePageSpeedURL)&&o.default.createElement(r.default.Footer,null,o.default.createElement(l.default,{className:"alert-btn btn btn-outline-danger",href:null==a?void 0:a.configureGooglePageSpeedURL},Liferay.Language.get("set-api-key"))))};t.default=_default}}));
//# sourceMappingURL=ErrorAlert.js.map