@bigbinary/neeto-molecules 5.1.21 → 5.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ErrorPage.js CHANGED
@@ -1,34 +1,48 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import { useShallow } from 'zustand/shallow';
3
3
  import { useEffect } from 'react';
4
- import { S as SvgInternalServerError, a as SvgUnauthorized, b as SvgPageNotFound, p as purify } from './unauthorized-DLPyUaeK.js';
4
+ import { p as purify } from './purify.es-CRFzu7ib.js';
5
5
  import { useErrorDisplayStore } from '@bigbinary/neeto-commons-frontend/react-utils/useDisplayErrorPage';
6
+ import Home from '@bigbinary/neeto-icons/Home';
7
+ import Left from '@bigbinary/neeto-icons/Left';
6
8
  import Button from '@bigbinary/neetoui/Button';
7
9
  import Typography from '@bigbinary/neetoui/Typography';
8
10
  import { Helmet } from 'react-helmet';
9
11
  import { useTranslation, Trans } from 'react-i18next';
12
+ import Lock from '@bigbinary/neeto-icons/Lock';
13
+ import Search from '@bigbinary/neeto-icons/Search';
14
+ import Warning from '@bigbinary/neeto-icons/Warning';
10
15
  import { n } from './inject-css-C2dztUxs.js';
11
16
  import { jsx, jsxs } from 'react/jsx-runtime';
12
17
 
13
18
  var ERRORS = {
14
19
  404: {
15
- Image: SvgPageNotFound,
20
+ Icon: Search,
16
21
  errorKey: "neetoMolecules.errorPage.cantBeFound",
17
- titleKey: "neetoMolecules.errorPage.title.cantBeFound"
22
+ titleKey: "neetoMolecules.errorPage.title.cantBeFound",
23
+ descriptionKey: "neetoMolecules.errorPage.description.cantBeFound",
24
+ primaryAction: "home",
25
+ usesChat: true
18
26
  },
19
27
  403: {
20
- Image: SvgUnauthorized,
28
+ Icon: Lock,
21
29
  errorKey: "neetoMolecules.errorPage.unauthorized",
22
- titleKey: "neetoMolecules.errorPage.title.unauthorized"
30
+ titleKey: "neetoMolecules.errorPage.title.unauthorized",
31
+ descriptionKey: "neetoMolecules.errorPage.description.unauthorized",
32
+ primaryAction: "back",
33
+ usesChat: false
23
34
  },
24
35
  500: {
25
- Image: SvgInternalServerError,
36
+ Icon: Warning,
26
37
  errorKey: "neetoMolecules.errorPage.internalServerError",
27
- titleKey: "neetoMolecules.errorPage.title.internalServerError"
38
+ titleKey: "neetoMolecules.errorPage.title.internalServerError",
39
+ descriptionKey: "neetoMolecules.errorPage.description.internalServerError",
40
+ primaryAction: "home",
41
+ usesChat: true
28
42
  }
29
43
  };
30
44
 
31
- var css = ".neeto-molecules-error-page__wrapper{align-items:center;container-name:error-page-wrapper;container-type:inline-size;display:flex;flex-direction:column;justify-content:center;min-height:100vh;min-height:100dvh;width:100%}.neeto-molecules-error-page__container{display:flex;flex-direction:column;gap:32px;max-width:100%;padding:16px;width:768px}@container error-page-wrapper (min-width: 768px){.neeto-molecules-error-page__container{flex-direction:row;gap:48px;padding:24px}}.neeto-molecules-error-page__image{flex-shrink:0;max-width:180px;width:100%}@container error-page-wrapper (min-width: 768px){.neeto-molecules-error-page__image{max-width:240px}}.neeto-molecules-error-page__action-btn{align-items:flex-start;display:flex;flex-direction:column;gap:12px}.neeto-molecules-error-page__action-btn a{text-decoration:none}.neeto-ui-theme--dark .neeto-molecules-error-code path{fill:rgb(var(--neeto-ui-black))}";
45
+ var css = ".neeto-molecules-error-page__wrapper{align-items:center;container-name:error-page-wrapper;container-type:inline-size;display:flex;flex-direction:column;justify-content:center;min-height:100vh;min-height:100dvh;width:100%}.neeto-molecules-error-page__container{align-items:center;display:flex;flex-direction:column;gap:24px;max-width:100%;padding:16px;text-align:center;width:768px}@container error-page-wrapper (min-width: 768px){.neeto-molecules-error-page__container{align-items:center;flex-direction:row;gap:48px;padding:24px;text-align:start}}.neeto-molecules-error-page__status-code{letter-spacing:.08em;text-transform:uppercase}.neeto-molecules-error-page__icon{align-items:center;background-color:rgb(var(--neeto-ui-gray-100));border:1px solid rgb(var(--neeto-ui-gray-300));border-radius:9999px;display:flex;flex-shrink:0;height:96px;justify-content:center;width:96px}.neeto-molecules-error-page__action-btn{align-items:center;display:flex;flex-direction:row;flex-wrap:wrap;gap:12px}.neeto-molecules-error-page__action-btn a{text-decoration:none}";
32
46
  n(css,{});
33
47
 
34
48
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -58,9 +72,12 @@ var ErrorPage = function ErrorPage(_ref) {
58
72
  showErrorPage = _useErrorDisplayStore.showErrorPage;
59
73
  status = status || storeStatusCode;
60
74
  var _ref2 = ERRORS[status] || ERRORS[404],
61
- Image = _ref2.Image,
75
+ Icon = _ref2.Icon,
62
76
  errorKey = _ref2.errorKey,
63
- titleKey = _ref2.titleKey;
77
+ titleKey = _ref2.titleKey,
78
+ descriptionKey = _ref2.descriptionKey,
79
+ primaryAction = _ref2.primaryAction,
80
+ usesChat = _ref2.usesChat;
64
81
  useEffect(function () {
65
82
  var pageLoader = document.getElementById("neeto-page-loader");
66
83
  if (pageLoader) pageLoader.remove();
@@ -80,43 +97,66 @@ var ErrorPage = function ErrorPage(_ref) {
80
97
  (_window$NeetoChat = window.NeetoChat) === null || _window$NeetoChat === void 0 || (_window$NeetoChat = _window$NeetoChat.contextualHelp) === null || _window$NeetoChat === void 0 || _window$NeetoChat.maximizeWidget();
81
98
  (_window$NeetoChat2 = window.NeetoChat) === null || _window$NeetoChat2 === void 0 || (_window$NeetoChat2 = _window$NeetoChat2.contextualHelp) === null || _window$NeetoChat2 === void 0 || _window$NeetoChat2.openWidget();
82
99
  };
100
+
101
+ // Falls back to homeUrl when the user landed on the error page directly
102
+ // (deep link / fresh tab) and has no in-app history to go back to.
103
+ var handleGoBack = function handleGoBack() {
104
+ if (window.history.length > 1) {
105
+ window.history.back();
106
+ } else {
107
+ window.location.href = homeUrl;
108
+ }
109
+ };
110
+ var showDefaultDescription = !usesChat || showNeetoChatWidget;
83
111
  return /*#__PURE__*/jsx("div", {
84
112
  className: "neeto-molecules-error-page__wrapper",
85
113
  "data-testid": "error-page-container",
86
114
  children: /*#__PURE__*/jsxs("div", {
87
115
  className: "neeto-molecules-error-page__container",
88
- children: [/*#__PURE__*/jsx(Image, {
89
- className: "neeto-molecules-error-code neeto-molecules-error-page__image",
90
- "data-testid": "error-image"
116
+ children: [/*#__PURE__*/jsx("div", {
117
+ className: "neeto-molecules-error-page__icon",
118
+ "data-testid": "error-image",
119
+ children: /*#__PURE__*/jsx(Icon, {
120
+ className: "neeto-ui-text-gray-500",
121
+ size: 40
122
+ })
91
123
  }), /*#__PURE__*/jsxs("div", {
92
124
  className: "neeto-ui-flex neeto-ui-flex-col justify-center md:min-w-0 md:flex-grow",
93
125
  children: [/*#__PURE__*/jsx(Helmet, {
94
126
  children: /*#__PURE__*/jsx("title", {
95
127
  children: t(titleKey)
96
128
  })
129
+ }), !!status && /*#__PURE__*/jsx(Typography, {
130
+ className: "neeto-molecules-error-page__status-code neeto-ui-mb-2 neeto-ui-text-gray-500",
131
+ "data-testid": "status-code",
132
+ style: "body3",
133
+ weight: "semibold",
134
+ children: t("neetoMolecules.errorPage.statusCodeLabel", {
135
+ status: status
136
+ })
97
137
  }), /*#__PURE__*/jsx(Typography, {
98
- className: "neeto-ui-mb-4",
138
+ className: "neeto-ui-mb-3",
99
139
  "data-testid": "title",
100
140
  style: "h2",
101
141
  weight: "semibold",
102
142
  children: title || /*#__PURE__*/jsx(Trans, {
103
143
  i18nKey: errorKey
104
144
  })
105
- }), !!description && /*#__PURE__*/jsx(Typography, {
106
- className: "neeto-ui-mb-4",
145
+ }), description ? /*#__PURE__*/jsx(Typography, {
146
+ className: "neeto-ui-mb-6",
107
147
  dangerouslySetInnerHTML: {
108
148
  __html: sanitize(description)
109
149
  },
110
150
  "data-testid": "description",
111
151
  style: "body1"
112
- }), showNeetoChatWidget && /*#__PURE__*/jsx(Typography, {
152
+ }) : showDefaultDescription && /*#__PURE__*/jsx(Typography, {
113
153
  className: "neeto-ui-mb-6",
114
- "data-testid": "title",
154
+ "data-testid": "description",
115
155
  style: "body1",
116
156
  children: /*#__PURE__*/jsx(Trans, {
117
- i18nKey: "neetoMolecules.errorPage.contactUs",
157
+ i18nKey: descriptionKey,
118
158
  components: {
119
- button: /*#__PURE__*/jsx(Button, {
159
+ contactLink: /*#__PURE__*/jsx(Button, {
120
160
  className: "neeto-ui-font-size-inherit",
121
161
  size: "large",
122
162
  style: "link",
@@ -126,8 +166,17 @@ var ErrorPage = function ErrorPage(_ref) {
126
166
  })
127
167
  }), /*#__PURE__*/jsxs("div", {
128
168
  className: "neeto-molecules-error-page__action-btn",
129
- children: [!hideBackToHomeButton && /*#__PURE__*/jsx(Button, _objectSpread({
169
+ children: [primaryAction === "back" ? /*#__PURE__*/jsx(Button, {
170
+ icon: Left,
171
+ iconPosition: "left",
172
+ label: t("neetoMolecules.errorPage.goBack"),
173
+ size: "large",
174
+ style: "primary",
175
+ onClick: handleGoBack
176
+ }) : !hideBackToHomeButton && /*#__PURE__*/jsx(Button, _objectSpread({
130
177
  href: homeUrl,
178
+ icon: Home,
179
+ iconPosition: "left",
131
180
  label: t("neetoMolecules.errorPage.backToHome"),
132
181
  size: "large",
133
182
  style: "primary"
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorPage.js","sources":["../src/components/ErrorPage/constants.js","../src/components/ErrorPage/index.jsx"],"sourcesContent":["import InternalServerErrorImage from \"assets/images/internal-server-error\";\nimport PageNotFoundImage from \"assets/images/page-not-found\";\nimport UnauthorizedImage from \"assets/images/unauthorized\";\n\nexport const ERRORS = {\n 404: {\n Image: PageNotFoundImage,\n errorKey: \"neetoMolecules.errorPage.cantBeFound\",\n titleKey: \"neetoMolecules.errorPage.title.cantBeFound\",\n },\n 403: {\n Image: UnauthorizedImage,\n errorKey: \"neetoMolecules.errorPage.unauthorized\",\n titleKey: \"neetoMolecules.errorPage.title.unauthorized\",\n },\n 500: {\n Image: InternalServerErrorImage,\n errorKey: \"neetoMolecules.errorPage.internalServerError\",\n titleKey: \"neetoMolecules.errorPage.title.internalServerError\",\n },\n};\n","// NOTE:\n// Do not use TailwindCSS classes in this molecule. Please define the styles in\n// the `error-page.scss` file or through neeto-ui helper classes.\n// The error.js entrypoint does not use TailwidCSS.\n\nimport { useEffect } from \"react\";\n\nimport DOMPurify from \"dompurify\";\nimport { useErrorDisplayStore } from \"neetocommons/react-utils/useDisplayErrorPage\";\nimport { Button, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { Helmet } from \"react-helmet\";\nimport { Trans, useTranslation } from \"react-i18next\";\n\nimport { ERRORS } from \"./constants\";\nimport \"./error-page.scss\";\n\nconst sanitize = DOMPurify.sanitize;\n\nconst ErrorPage = ({\n homeUrl = \"/\",\n status,\n backToHomeButtonProps,\n children,\n showNeetoChatWidget = true,\n description,\n title,\n hideBackToHomeButton = false,\n}) => {\n const { t } = useTranslation();\n const { statusCode: storeStatusCode, showErrorPage } =\n useErrorDisplayStore.pick();\n\n status = status || storeStatusCode;\n const { Image, errorKey, titleKey } = ERRORS[status] || ERRORS[404];\n\n useEffect(() => {\n const pageLoader = document.getElementById(\"neeto-page-loader\");\n if (pageLoader) pageLoader.remove();\n\n const onBackButtonPress = () => {\n if (!showErrorPage) return;\n useErrorDisplayStore.setState({ showErrorPage: false });\n };\n\n window.addEventListener(\"popstate\", onBackButtonPress);\n\n return () => {\n window.removeEventListener(\"popstate\", onBackButtonPress);\n };\n }, []);\n\n const openChatWidget = () => {\n window.NeetoChat?.contextualHelp?.maximizeWidget();\n window.NeetoChat?.contextualHelp?.openWidget();\n };\n\n return (\n <div\n className=\"neeto-molecules-error-page__wrapper\"\n data-testid=\"error-page-container\"\n >\n <div className=\"neeto-molecules-error-page__container\">\n <Image\n className=\"neeto-molecules-error-code neeto-molecules-error-page__image\"\n data-testid=\"error-image\"\n />\n <div className=\"neeto-ui-flex neeto-ui-flex-col justify-center md:min-w-0 md:flex-grow\">\n <Helmet>\n <title>{t(titleKey)}</title>\n </Helmet>\n <Typography\n className=\"neeto-ui-mb-4\"\n data-testid=\"title\"\n style=\"h2\"\n weight=\"semibold\"\n >\n {title || <Trans i18nKey={errorKey} />}\n </Typography>\n {!!description && (\n <Typography\n className=\"neeto-ui-mb-4\"\n dangerouslySetInnerHTML={{ __html: sanitize(description) }}\n data-testid=\"description\"\n style=\"body1\"\n />\n )}\n {showNeetoChatWidget && (\n <Typography\n className=\"neeto-ui-mb-6\"\n data-testid=\"title\"\n style=\"body1\"\n >\n <Trans\n i18nKey=\"neetoMolecules.errorPage.contactUs\"\n components={{\n button: (\n <Button\n className=\"neeto-ui-font-size-inherit\"\n size=\"large\"\n style=\"link\"\n onClick={openChatWidget}\n />\n ),\n }}\n />\n </Typography>\n )}\n <div className=\"neeto-molecules-error-page__action-btn\">\n {!hideBackToHomeButton && (\n <Button\n href={homeUrl}\n label={t(\"neetoMolecules.errorPage.backToHome\")}\n size=\"large\"\n style=\"primary\"\n {...backToHomeButtonProps}\n />\n )}\n {children}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nErrorPage.propTypes = {\n /**\n * The URL to which the user will be taken to when user clicks on back to home button.\n */\n homeUrl: PropTypes.string,\n /**\n * The status code of the error.\n */\n status: PropTypes.oneOf([403, 404, 500]),\n /**\n * Decides whether 'contact us' link should be displayed or not.\n */\n showNeetoChatWidget: PropTypes.bool,\n /**\n * Description about the error.\n */\n description: PropTypes.string,\n /**\n * Decides whether 'back to home' button should be displayed or not.\n */\n hideBackToHomeButton: PropTypes.bool,\n /**\n * The title of the error page.\n */\n title: PropTypes.string,\n};\n\nexport default ErrorPage;\n"],"names":["ERRORS","Image","PageNotFoundImage","errorKey","titleKey","UnauthorizedImage","InternalServerErrorImage","sanitize","DOMPurify","ErrorPage","_ref","_ref$homeUrl","homeUrl","status","backToHomeButtonProps","children","_ref$showNeetoChatWid","showNeetoChatWidget","description","title","_ref$hideBackToHomeBu","hideBackToHomeButton","_useTranslation","useTranslation","t","_useErrorDisplayStore","useErrorDisplayStore","useShallow","store","statusCode","showErrorPage","storeStatusCode","_ref2","useEffect","pageLoader","document","getElementById","remove","onBackButtonPress","setState","window","addEventListener","removeEventListener","openChatWidget","_window$NeetoChat","_window$NeetoChat2","NeetoChat","contextualHelp","maximizeWidget","openWidget","_jsx","className","_jsxs","Helmet","Typography","style","weight","Trans","i18nKey","dangerouslySetInnerHTML","__html","components","button","Button","size","onClick","_objectSpread","href","label"],"mappings":";;;;;;;;;;;;AAIO,IAAMA,MAAM,GAAG;AACpB,EAAA,GAAG,EAAE;AACHC,IAAAA,KAAK,EAAEC,eAAiB;AACxBC,IAAAA,QAAQ,EAAE,sCAAsC;AAChDC,IAAAA,QAAQ,EAAE;GACX;AACD,EAAA,GAAG,EAAE;AACHH,IAAAA,KAAK,EAAEI,eAAiB;AACxBF,IAAAA,QAAQ,EAAE,uCAAuC;AACjDC,IAAAA,QAAQ,EAAE;GACX;AACD,EAAA,GAAG,EAAE;AACHH,IAAAA,KAAK,EAAEK,sBAAwB;AAC/BH,IAAAA,QAAQ,EAAE,8CAA8C;AACxDC,IAAAA,QAAQ,EAAE;AACZ;AACF,CAAC;;;;;;;ACHD,IAAMG,QAAQ,GAAGC,MAAS,CAACD,QAAQ;AAEnC,IAAME,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAST;AAAA,EAAA,IAAAC,YAAA,GAAAD,IAAA,CARJE,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAG,GAAG,GAAAA,YAAA;IACbE,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,qBAAqB,GAAAJ,IAAA,CAArBI,qBAAqB;IACrBC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAAC,qBAAA,GAAAN,IAAA,CACRO,mBAAmB;AAAnBA,IAAAA,mBAAmB,GAAAD,qBAAA,KAAA,MAAA,GAAG,IAAI,GAAAA,qBAAA;IAC1BE,WAAW,GAAAR,I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ACF,EACAC,QAAQ;AAAA,SACN,CAAC;AAAA,OACH,CAAC;KACH;AAAC,GACH,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"ErrorPage.js","sources":["../src/components/ErrorPage/constants.js","../src/components/ErrorPage/index.jsx"],"sourcesContent":["import { Lock, Search, Warning } from \"neetoicons\";\n\nexport const ERRORS = {\n 404: {\n Icon: Search,\n errorKey: \"neetoMolecules.errorPage.cantBeFound\",\n titleKey: \"neetoMolecules.errorPage.title.cantBeFound\",\n descriptionKey: \"neetoMolecules.errorPage.description.cantBeFound\",\n primaryAction: \"home\",\n usesChat: true,\n },\n 403: {\n Icon: Lock,\n errorKey: \"neetoMolecules.errorPage.unauthorized\",\n titleKey: \"neetoMolecules.errorPage.title.unauthorized\",\n descriptionKey: \"neetoMolecules.errorPage.description.unauthorized\",\n primaryAction: \"back\",\n usesChat: false,\n },\n 500: {\n Icon: Warning,\n errorKey: \"neetoMolecules.errorPage.internalServerError\",\n titleKey: \"neetoMolecules.errorPage.title.internalServerError\",\n descriptionKey: \"neetoMolecules.errorPage.description.internalServerError\",\n primaryAction: \"home\",\n usesChat: true,\n },\n};\n","// NOTE:\n// Do not use TailwindCSS classes in this molecule. Please define the styles in\n// the `error-page.scss` file or through neeto-ui helper classes.\n// The error.js entrypoint does not use TailwidCSS.\n\nimport { useEffect } from \"react\";\n\nimport DOMPurify from \"dompurify\";\nimport { useErrorDisplayStore } from \"neetocommons/react-utils/useDisplayErrorPage\";\nimport { Home, Left } from \"neetoicons\";\nimport { Button, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { Helmet } from \"react-helmet\";\nimport { Trans, useTranslation } from \"react-i18next\";\n\nimport { ERRORS } from \"./constants\";\nimport \"./error-page.scss\";\n\nconst sanitize = DOMPurify.sanitize;\n\nconst ErrorPage = ({\n homeUrl = \"/\",\n status,\n backToHomeButtonProps,\n children,\n showNeetoChatWidget = true,\n description,\n title,\n hideBackToHomeButton = false,\n}) => {\n const { t } = useTranslation();\n const { statusCode: storeStatusCode, showErrorPage } =\n useErrorDisplayStore.pick();\n\n status = status || storeStatusCode;\n const { Icon, errorKey, titleKey, descriptionKey, primaryAction, usesChat } =\n ERRORS[status] || ERRORS[404];\n\n useEffect(() => {\n const pageLoader = document.getElementById(\"neeto-page-loader\");\n if (pageLoader) pageLoader.remove();\n\n const onBackButtonPress = () => {\n if (!showErrorPage) return;\n useErrorDisplayStore.setState({ showErrorPage: false });\n };\n\n window.addEventListener(\"popstate\", onBackButtonPress);\n\n return () => {\n window.removeEventListener(\"popstate\", onBackButtonPress);\n };\n }, []);\n\n const openChatWidget = () => {\n window.NeetoChat?.contextualHelp?.maximizeWidget();\n window.NeetoChat?.contextualHelp?.openWidget();\n };\n\n // Falls back to homeUrl when the user landed on the error page directly\n // (deep link / fresh tab) and has no in-app history to go back to.\n const handleGoBack = () => {\n if (window.history.length > 1) {\n window.history.back();\n } else {\n window.location.href = homeUrl;\n }\n };\n\n const showDefaultDescription = !usesChat || showNeetoChatWidget;\n\n return (\n <div\n className=\"neeto-molecules-error-page__wrapper\"\n data-testid=\"error-page-container\"\n >\n <div className=\"neeto-molecules-error-page__container\">\n <div\n className=\"neeto-molecules-error-page__icon\"\n data-testid=\"error-image\"\n >\n <Icon className=\"neeto-ui-text-gray-500\" size={40} />\n </div>\n <div className=\"neeto-ui-flex neeto-ui-flex-col justify-center md:min-w-0 md:flex-grow\">\n <Helmet>\n <title>{t(titleKey)}</title>\n </Helmet>\n {!!status && (\n <Typography\n className=\"neeto-molecules-error-page__status-code neeto-ui-mb-2 neeto-ui-text-gray-500\"\n data-testid=\"status-code\"\n style=\"body3\"\n weight=\"semibold\"\n >\n {t(\"neetoMolecules.errorPage.statusCodeLabel\", { status })}\n </Typography>\n )}\n <Typography\n className=\"neeto-ui-mb-3\"\n data-testid=\"title\"\n style=\"h2\"\n weight=\"semibold\"\n >\n {title || <Trans i18nKey={errorKey} />}\n </Typography>\n {description ? (\n <Typography\n className=\"neeto-ui-mb-6\"\n dangerouslySetInnerHTML={{ __html: sanitize(description) }}\n data-testid=\"description\"\n style=\"body1\"\n />\n ) : (\n showDefaultDescription && (\n <Typography\n className=\"neeto-ui-mb-6\"\n data-testid=\"description\"\n style=\"body1\"\n >\n <Trans\n i18nKey={descriptionKey}\n components={{\n contactLink: (\n <Button\n className=\"neeto-ui-font-size-inherit\"\n size=\"large\"\n style=\"link\"\n onClick={openChatWidget}\n />\n ),\n }}\n />\n </Typography>\n )\n )}\n <div className=\"neeto-molecules-error-page__action-btn\">\n {primaryAction === \"back\" ? (\n <Button\n icon={Left}\n iconPosition=\"left\"\n label={t(\"neetoMolecules.errorPage.goBack\")}\n size=\"large\"\n style=\"primary\"\n onClick={handleGoBack}\n />\n ) : (\n !hideBackToHomeButton && (\n <Button\n href={homeUrl}\n icon={Home}\n iconPosition=\"left\"\n label={t(\"neetoMolecules.errorPage.backToHome\")}\n size=\"large\"\n style=\"primary\"\n {...backToHomeButtonProps}\n />\n )\n )}\n {children}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nErrorPage.propTypes = {\n /**\n * The URL to which the user will be taken to when user clicks on back to home button.\n */\n homeUrl: PropTypes.string,\n /**\n * The status code of the error.\n */\n status: PropTypes.oneOf([403, 404, 500]),\n /**\n * Decides whether 'contact us' link should be displayed or not.\n */\n showNeetoChatWidget: PropTypes.bool,\n /**\n * Description about the error.\n */\n description: PropTypes.string,\n /**\n * Decides whether 'back to home' button should be displayed or not.\n */\n hideBackToHomeButton: PropTypes.bool,\n /**\n * The title of the error page.\n */\n title: PropTypes.string,\n};\n\nexport default ErrorPage;\n"],"names":["ERRORS","Icon","Search","errorKey","titleKey","descriptionKey","primaryAction","usesChat","Lock","Warning","sanitize","DOMPurify","ErrorPage","_ref","_ref$homeUrl","homeUrl","status","backToHomeButtonProps","children","_ref$showNeetoChatWid","showNeetoChatWidget","description","title","_ref$hideBackToHomeBu","hideBackToHomeButton","_useTranslation","useTranslation","t","_useErrorDisplayStore","useErrorDisplayStore","useShallow","store","statusCode","showErrorPage","storeStatusCode","_ref2","useEffect","pageLoader","document","getElementById","remove","onBackButtonPress","setState","window","addEventListener","removeEventListener","openChatWidget","_window$NeetoChat","_window$NeetoChat2","NeetoChat","contextualHelp","maximizeWidget","openWidget","handleGoBack","history","length","back","location","href","showDefaultDescription","_jsx","className","_jsxs","size","Helmet","Typography","style","weight","Trans","i18nKey","dangerouslySetInnerHTML","__html","components","contactLink","Button","onClick","icon","Left","iconPosition","label","_objectSpread","Home"],"mappings":";;;;;;;;;;;;;;;;;AAEO,IAAMA,MAAM,GAAG;AACpB,EAAA,GAAG,EAAE;AACHC,IAAAA,IAAI,EAAEC,MAAM;AACZC,IAAAA,QAAQ,EAAE,sCAAsC;AAChDC,IAAAA,QAAQ,EAAE,4CAA4C;AACtDC,IAAAA,cAAc,EAAE,kDAAkD;AAClEC,IAAAA,aAAa,EAAE,MAAM;AACrBC,IAAAA,QAAQ,EAAE;GACX;AACD,EAAA,GAAG,EAAE;AACHN,IAAAA,IAAI,EAAEO,IAAI;AACVL,IAAAA,QAAQ,EAAE,uCAAuC;AACjDC,IAAAA,QAAQ,EAAE,6CAA6C;AACvDC,IAAAA,cAAc,EAAE,mDAAmD;AACnEC,IAAAA,aAAa,EAAE,MAAM;AACrBC,IAAAA,QAAQ,EAAE;GACX;AACD,EAAA,GAAG,EAAE;AACHN,IAAAA,IAAI,EAAEQ,OAAO;AACbN,IAAAA,QAAQ,EAAE,8CAA8C;AACxDC,IAAAA,QAAQ,EAAE,oDAAoD;AAC9DC,IAAAA,cAAc,EAAE,0DAA0D;AAC1EC,IAAAA,aAAa,EAAE,MAAM;AACrBC,IAAAA,QAAQ,EAAE;AACZ;AACF,CAAC;;;;;;;ACTD,IAAMG,QAAQ,GAAGC,MAAS,CAACD,QAAQ;AAEnC,IAAME,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAST;AAAA,EAAA,IAAAC,YAAA,GAAAD,IAAA,CARJE,OAAO;AAAPA,IAAAA,OAA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O,EAAEtB;WACV,CAAC,GAEF,CAAC7B,oBAAoB,iBACnBoC,GAAA,CAACc,MAAM,EAAAM,aAAA,CAAA;AACLtB,YAAAA,IAAI,EAAE3C,OAAQ;AACd6D,YAAAA,IAAI,EAAEK,IAAK;AACXH,YAAAA,YAAY,EAAC,MAAM;AACnBC,YAAAA,KAAK,EAAEpD,CAAC,CAAC,qCAAqC,CAAE;AAChDoC,YAAAA,IAAI,EAAC,OAAO;AACZG,YAAAA,KAAK,EAAC;AAAS,WAAA,EACXjD,qBAAqB,CAC1B,CAEJ,EACAC,QAAQ;AAAA,SACN,CAAC;AAAA,OACH,CAAC;KACH;AAAC,GACH,CAAC;AAEV;;;;"}
@@ -44,9 +44,14 @@ import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
44
44
  import CardLayout from './CardLayout.js';
45
45
  import Header$1 from './Header.js';
46
46
  import 'zustand/shallow';
47
- import './unauthorized-DLPyUaeK.js';
47
+ import './purify.es-CRFzu7ib.js';
48
48
  import '@bigbinary/neeto-commons-frontend/react-utils/useDisplayErrorPage';
49
+ import '@bigbinary/neeto-icons/Home';
50
+ import '@bigbinary/neeto-icons/Left';
49
51
  import 'react-helmet';
52
+ import '@bigbinary/neeto-icons/Lock';
53
+ import '@bigbinary/neeto-icons/Search';
54
+ import '@bigbinary/neeto-icons/Warning';
50
55
  import './index-DAYCJu79.js';
51
56
  import './_commonjsHelpers-BFTU3MAI.js';
52
57
  import '@bigbinary/neeto-icons/Copy';
@@ -62,7 +67,6 @@ import './Search.js';
62
67
  import '@bigbinary/neeto-commons-frontend/react-utils/useFuncDebounce';
63
68
  import '@bigbinary/neeto-commons-frontend/react-utils/useQueryParams';
64
69
  import '@bigbinary/neeto-commons-frontend/react-utils/useUpdateEffect';
65
- import '@bigbinary/neeto-icons/Search';
66
70
 
67
71
  var ExpiryNotice = function ExpiryNotice(_ref) {
68
72
  var expiryConfiguration = _ref.expiryConfiguration;