@cloud-ru/uikit-product-error-pages 0.13.7

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023 Cloud technology Limited (Ltd.)
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Error Pages
2
+
3
+ ## Installation
4
+ `npm i @cloud-ru/uikit-product-error-pages`
5
+
6
+ ## Props
7
+
8
+ ```ts
9
+ enum LogoVariant {
10
+ MLSpace = 'MLSpace',
11
+ Cloud = 'Cloud',
12
+ None = 'None',
13
+ }
14
+
15
+ enum ErrorType {
16
+ FrontendError = 'FrontendError',
17
+ PageUnavailable = 'PageUnavailable',
18
+ PageNotFound = 'PageNotFound',
19
+ }
20
+
21
+ type ErrorPageProps = WithSupportProps<{
22
+ className: string;
23
+ mainPageUrl: string;
24
+ onSupportCenterClick(): void;
25
+ logoVariant?: LogoVariant;
26
+ errorType?: ErrorType;
27
+ }>;
28
+ ```
29
+
30
+
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@cloud-ru/uikit-product-error-pages",
3
+ "title": "Error Pages",
4
+ "version": "0.13.7",
5
+ "sideEffects": [
6
+ "*.css",
7
+ "*.woff",
8
+ "*.woff2"
9
+ ],
10
+ "description": "",
11
+ "types": "./dist/esm/index.d.ts",
12
+ "exports": {
13
+ "import": "./dist/esm/index.js",
14
+ "require": "./dist/cjs/index.js"
15
+ },
16
+ "files": [
17
+ "dist/esm",
18
+ "dist/cjs",
19
+ "src",
20
+ "./CHANGELOG.md",
21
+ "./LICENSE"
22
+ ],
23
+ "homepage": "https://gitverse.ru/cloud-ru-tech/uikit-product/-/tree/master/packages/error-pages",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://gitverse.ru/cloud-ru-tech/uikit-product.git",
27
+ "directory": "packages/error-pages"
28
+ },
29
+ "author": {
30
+ "name": "Akhremenko Grigorii",
31
+ "url": "https://github.com/AGrigorii"
32
+ },
33
+ "license": "Apache-2.0",
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "scripts": {},
38
+ "dependencies": {
39
+ "@cloud-ru/uikit-product-icons": "15.1.1",
40
+ "@cloud-ru/uikit-product-utils": "7.0.0",
41
+ "@snack-uikit/button": "0.19.7",
42
+ "@snack-uikit/link": "0.15.9",
43
+ "@snack-uikit/tag": "0.12.4",
44
+ "@snack-uikit/utils": "3.7.0",
45
+ "classnames": "2.5.1"
46
+ },
47
+ "peerDependencies": {
48
+ "@cloud-ru/uikit-product-locale": "*"
49
+ },
50
+ "gitHead": "e8bd79bc92b26a8f52611972eec98a867536ccd3"
51
+ }
@@ -0,0 +1,208 @@
1
+ import cn from 'classnames';
2
+ import { useMemo } from 'react';
3
+
4
+ import { CloudFullLogoSVG, MailInterfaceSVG, MlSpaceFullLogoSVG } from '@cloud-ru/uikit-product-icons';
5
+ import { useLocale } from '@cloud-ru/uikit-product-locale';
6
+ import { extractSupportProps, WithSupportProps } from '@cloud-ru/uikit-product-utils';
7
+ import { ButtonFilled, ButtonOutline } from '@snack-uikit/button';
8
+ import { Link } from '@snack-uikit/link';
9
+ import { Tag } from '@snack-uikit/tag';
10
+ import { isBrowser } from '@snack-uikit/utils';
11
+
12
+ import { COLORS, ErrorType, LogoVariant } from './constants';
13
+ import { useGetButtonPropsByErrorType, useGetContentByErrorType } from './hooks';
14
+ import styles from './styles.module.scss';
15
+
16
+ export type ErrorPageProps = WithSupportProps<{
17
+ className?: string;
18
+ mainPageUrl?: string;
19
+ onSupportCenterClick?(): void;
20
+ logoVariant?: LogoVariant;
21
+ errorType?: ErrorType;
22
+ showMainButton?: boolean;
23
+ }>;
24
+
25
+ export function ErrorPage({
26
+ className,
27
+ mainPageUrl = '/',
28
+ onSupportCenterClick,
29
+ logoVariant = LogoVariant.None,
30
+ errorType = ErrorType.FrontendError,
31
+ showMainButton = true,
32
+ ...rest
33
+ }: ErrorPageProps) {
34
+ const { t } = useLocale('ErrorPage');
35
+ const content = useGetContentByErrorType(errorType);
36
+ const button = useGetButtonPropsByErrorType(errorType, mainPageUrl);
37
+
38
+ const hasMainPageLink = [ErrorType.FrontendError].includes(errorType);
39
+ const hasBackLink = [ErrorType.FrontendError, ErrorType.PageUnavailable].includes(errorType);
40
+
41
+ const logo = useMemo(() => {
42
+ switch (logoVariant) {
43
+ case LogoVariant.MLSpace:
44
+ return (
45
+ <div className={styles.logo}>
46
+ <MlSpaceFullLogoSVG />
47
+ </div>
48
+ );
49
+ case LogoVariant.Cloud:
50
+ return (
51
+ <div className={styles.logo}>
52
+ <CloudFullLogoSVG />
53
+ </div>
54
+ );
55
+ case LogoVariant.None:
56
+ default:
57
+ return null;
58
+ }
59
+ }, [logoVariant]);
60
+
61
+ return (
62
+ <div className={cn(styles.wrapper, className)} {...extractSupportProps(rest)}>
63
+ <div className={styles.leftSide}>
64
+ <div className={styles.textContainer}>
65
+ {logo}
66
+
67
+ <h1 className={styles.title} data-user>
68
+ {content.title}
69
+
70
+ {content.statusCode && (
71
+ <Tag className={styles.statusCode} appearance='neutral' size='s' label={String(content.statusCode)} />
72
+ )}
73
+ </h1>
74
+
75
+ <div className={styles.actionWrapper}>
76
+ <span className={styles.actionsTitle}>{content.text}</span>
77
+
78
+ <div className={styles.actionsLink}>
79
+ {hasMainPageLink && <Link size='m' href={mainPageUrl} target={'_self'} text={t('mainPageLink')} />}
80
+
81
+ {hasBackLink && (
82
+ <Link
83
+ size='m'
84
+ onClick={() => isBrowser() && window.history.back()}
85
+ target={'_self'}
86
+ text={t('backLink')}
87
+ />
88
+ )}
89
+ </div>
90
+ </div>
91
+ </div>
92
+
93
+ <div className={styles.buttonContainer}>
94
+ {onSupportCenterClick && (
95
+ <ButtonOutline
96
+ size='m'
97
+ className={styles.button}
98
+ label={t('supportCenterButton')}
99
+ onClick={onSupportCenterClick}
100
+ icon={<MailInterfaceSVG />}
101
+ />
102
+ )}
103
+ {showMainButton && (
104
+ <ButtonFilled
105
+ size='m'
106
+ className={styles.button}
107
+ label={button.text}
108
+ href={button.href}
109
+ target={button.href && '_self'}
110
+ onClick={button.onClick}
111
+ icon={button.icon}
112
+ />
113
+ )}
114
+ </div>
115
+ </div>
116
+ <div className={styles.rightSide}>
117
+ <svg className={styles.pic} viewBox='0 0 863 520' fill='none' xmlns='http://www.w3.org/2000/svg'>
118
+ <path
119
+ d='M721.711 93H94.2882C86.397 93 80 99.8168 80 108.226V446.774C80 455.183 86.397 462 94.2882 462H721.711C729.602 462 735.999 455.183 735.999 446.774V108.226C735.999 99.8168 729.602 93 721.711 93Z'
120
+ fill={`var(${COLORS.svgBackground})`}
121
+ stroke={`var(${COLORS.svgStroke})`}
122
+ strokeWidth='2'
123
+ strokeMiterlimit='10'
124
+ />
125
+ <path d='M735.999 165H81.7061' stroke={`var(${COLORS.svgStroke})`} strokeWidth='2' strokeMiterlimit='10' />
126
+ <path
127
+ d='M126.81 129C126.81 135.079 121.902 140 115.857 140C109.812 140 104.905 135.079 104.905 129C104.905 122.921 109.812 118 115.857 118C121.902 118 126.81 122.921 126.81 129Z'
128
+ stroke={`var(${COLORS.svgStroke})`}
129
+ strokeWidth='2'
130
+ />
131
+ <path
132
+ d='M158.681 129C158.681 135.079 153.773 140 147.729 140C141.684 140 136.776 135.079 136.776 129C136.776 122.921 141.684 118 147.729 118C153.773 118 158.681 122.921 158.681 129Z'
133
+ stroke={`var(${COLORS.svgStroke})`}
134
+ strokeWidth='2'
135
+ />
136
+ <path
137
+ d='M190.557 129C190.557 135.079 185.649 140 179.605 140C173.56 140 168.652 135.079 168.652 129C168.652 122.921 173.56 118 179.605 118C185.649 118 190.557 122.921 190.557 129Z'
138
+ stroke={`var(${COLORS.svgStroke})`}
139
+ strokeWidth='2'
140
+ />
141
+ <path
142
+ d='M22.0427 284.986L116.584 256.508C116.925 256.415 117.286 256.426 117.621 256.539C117.957 256.652 118.251 256.863 118.468 257.144C118.685 257.425 118.814 257.765 118.839 258.12C118.864 258.476 118.785 258.83 118.61 259.14L67.8006 344.25C67.6327 344.526 67.3933 344.75 67.108 344.899C66.8227 345.047 66.5024 345.115 66.1819 345.093C65.8613 345.072 65.5527 344.963 65.2893 344.778C65.0259 344.593 64.8177 344.338 64.6874 344.043L54.9955 322.218C54.8828 321.975 54.7176 321.759 54.5117 321.588C54.3059 321.417 54.0646 321.294 53.8056 321.229C53.5466 321.164 53.2765 321.158 53.0148 321.211C52.7532 321.265 52.5067 321.376 52.2934 321.538L16.6093 349.484C16.2343 349.771 15.7621 349.898 15.2948 349.837C14.8276 349.777 14.4029 349.533 14.1129 349.159L9.14941 342.742L4.36224 336.531C4.07866 336.159 3.95338 335.688 4.01394 335.222C4.0745 334.757 4.3159 334.334 4.68526 334.047L40.3693 306.101C40.6056 305.935 40.7986 305.714 40.9319 305.456C41.0651 305.199 41.1347 304.913 41.1347 304.623C41.1347 304.332 41.0651 304.046 40.9319 303.789C40.7986 303.532 40.6056 303.31 40.3693 303.144L21.426 287.914C21.2068 287.709 21.0442 287.45 20.9539 287.163C20.8636 286.875 20.8488 286.569 20.9109 286.274C20.973 285.98 21.11 285.706 21.3083 285.48C21.5067 285.255 21.7597 285.084 22.0427 284.986Z'
143
+ fill={`var(${COLORS.svgBackground})`}
144
+ stroke={`var(${COLORS.svgStroke})`}
145
+ strokeWidth='2'
146
+ strokeLinecap='round'
147
+ />
148
+ <path
149
+ d='M148.586 311.289L124.086 283.727'
150
+ stroke={`var(${COLORS.svgStroke})`}
151
+ strokeWidth='2'
152
+ strokeLinecap='round'
153
+ />
154
+ <path
155
+ d='M159.336 300.565L130.242 279.127'
156
+ stroke={`var(${COLORS.svgStroke})`}
157
+ strokeWidth='2'
158
+ strokeLinecap='round'
159
+ />
160
+ <path
161
+ d='M166.969 286.789L133.281 273.008'
162
+ stroke={`var(${COLORS.svgStroke})`}
163
+ strokeWidth='2'
164
+ strokeLinecap='round'
165
+ />
166
+ <path
167
+ d='M390.619 52.8901L157.466 483.672C155.767 486.812 154.919 490.334 155.006 493.894C155.093 497.454 156.112 500.932 157.964 503.987C159.815 507.041 162.436 509.57 165.57 511.325C168.704 513.08 172.245 514.001 175.847 514H642.153C645.755 514.001 649.296 513.08 652.43 511.325C655.564 509.57 658.185 507.041 660.036 503.987C661.888 500.932 662.907 497.454 662.994 493.894C663.081 490.334 662.233 486.812 660.534 483.672L427.41 52.8901C425.627 49.5993 422.974 46.8484 419.735 44.9306C416.495 43.0129 412.79 42 409.015 42C405.239 42 401.534 43.0129 398.294 44.9306C395.055 46.8484 392.402 49.5993 390.619 52.8901Z'
168
+ fill={`var(${COLORS.svgBackground})`}
169
+ stroke={`var(${COLORS.svgStroke})`}
170
+ strokeWidth='2'
171
+ strokeLinecap='round'
172
+ />
173
+ <path
174
+ d='M408.107 376C405.042 375.986 402.075 374.935 399.7 373.022C397.324 371.109 395.683 368.449 395.05 365.485L368.005 235.997C366.644 229.996 366.665 223.77 368.067 217.779C369.469 211.787 372.215 206.184 376.104 201.384C379.992 196.583 384.922 192.708 390.53 190.045C396.137 187.383 402.279 186 408.5 186C414.721 186 420.863 187.383 426.47 190.045C432.078 192.708 437.008 196.583 440.896 201.384C444.785 206.184 447.531 211.787 448.933 217.779C450.335 223.77 450.356 229.996 448.995 235.997L422.095 364.708C421.422 367.887 419.666 370.743 417.12 372.798C414.575 374.853 411.393 375.983 408.107 376Z'
175
+ fill={`var(${COLORS.svgExclamationMark})`}
176
+ />
177
+ <path
178
+ d='M408 454C402.66 454 397.44 452.416 393 449.45C388.559 446.483 385.099 442.266 383.055 437.332C381.012 432.399 380.477 426.97 381.519 421.733C382.561 416.495 385.132 411.684 388.908 407.908C392.684 404.132 397.495 401.561 402.733 400.519C407.97 399.477 413.399 400.012 418.332 402.055C423.266 404.099 427.483 407.559 430.45 412C433.416 416.44 435 421.66 435 427C434.992 434.158 432.145 441.021 427.083 446.083C422.021 451.145 415.158 453.992 408 454Z'
179
+ fill={`var(${COLORS.svgExclamationMark})`}
180
+ />
181
+ <path
182
+ fillRule='evenodd'
183
+ clipRule='evenodd'
184
+ d='M758.622 69.709C758.622 65.2907 762.204 61.709 766.622 61.709H777.378C781.796 61.709 785.378 65.2907 785.378 69.709V75.6192C785.378 79.4239 788.076 82.6524 791.712 83.7722C795.74 85.0126 799.606 86.623 803.269 88.5639C806.631 90.3449 810.821 89.9691 813.511 87.279L817.695 83.0952C820.819 79.971 825.884 79.971 829.009 83.0952L836.614 90.7003C839.738 93.8245 839.738 98.8899 836.614 102.014L832.43 106.198C829.74 108.888 829.364 113.078 831.145 116.44C833.086 120.103 834.697 123.969 835.937 127.997C837.057 131.633 840.285 134.331 844.09 134.331H850C854.418 134.331 858 137.913 858 142.331V153.087C858 157.505 854.418 161.087 850 161.087H844.09C840.285 161.087 837.057 163.785 835.937 167.421C834.697 171.449 833.086 175.315 831.145 178.978C829.364 182.34 829.74 186.53 832.43 189.22L836.614 193.404C839.738 196.528 839.738 201.593 836.614 204.718L829.009 212.323C825.884 215.447 820.819 215.447 817.695 212.323L813.511 208.139C810.821 205.449 806.631 205.073 803.269 206.854C799.606 208.795 795.74 210.405 791.712 211.646C788.076 212.766 785.378 215.994 785.378 219.799V225.709C785.378 230.127 781.796 233.709 777.378 233.709H766.622C762.204 233.709 758.622 230.127 758.622 225.709V219.799C758.622 215.994 755.924 212.766 752.288 211.646C748.26 210.405 744.395 208.795 740.731 206.854C737.369 205.073 733.179 205.449 730.489 208.139L726.305 212.323C723.181 215.447 718.116 215.447 714.992 212.323L707.386 204.718C704.262 201.593 704.262 196.528 707.386 193.404L711.57 189.22C714.26 186.53 714.636 182.34 712.855 178.978C710.914 175.315 709.303 171.449 708.063 167.421C706.943 163.785 703.715 161.087 699.91 161.087H694C689.582 161.087 686 157.505 686 153.087V142.331C686 137.913 689.582 134.331 694 134.331H699.91C703.715 134.331 706.943 131.633 708.063 127.997C709.303 123.969 710.914 120.103 712.855 116.44C714.636 113.078 714.26 108.888 711.57 106.198L707.386 102.014C704.262 98.8899 704.262 93.8246 707.386 90.7004L714.992 83.0952C718.116 79.971 723.181 79.971 726.305 83.0952L730.489 87.279C733.179 89.9691 737.369 90.3449 740.731 88.5639C744.395 86.623 748.26 85.0126 752.288 83.7722C755.924 82.6524 758.622 79.4239 758.622 75.6192V69.709ZM772 181.153C753.529 181.153 738.556 166.18 738.556 147.709C738.556 129.238 753.529 114.265 772 114.265C790.471 114.265 805.444 129.238 805.444 147.709C805.444 166.18 790.471 181.153 772 181.153Z'
185
+ fill={`var(${COLORS.svgBackground})`}
186
+ stroke={`var(${COLORS.svgStroke})`}
187
+ strokeWidth='2'
188
+ strokeMiterlimit='10'
189
+ className={styles.rotateSmall}
190
+ />
191
+ <path
192
+ fillRule='evenodd'
193
+ clipRule='evenodd'
194
+ d='M646 8C646 5.79102 647.791 4 650 4H662C664.209 4 666 5.79102 666 8V14.4608C666 18.2656 668.708 21.4784 672.304 22.7186C674.226 23.3813 676.095 24.1579 677.903 25.0403C681.322 26.7089 685.507 26.3511 688.197 23.6611L692.77 19.0889C694.332 17.5264 696.864 17.5264 698.427 19.0889L706.912 27.5732C708.474 29.1357 708.474 31.6689 706.912 33.2305L702.34 37.8025C699.649 40.4926 699.292 44.6783 700.96 48.0973C701.842 49.9049 702.619 51.7737 703.281 53.6955C704.521 57.2925 707.734 60 711.539 60H718C720.209 60 722 61.791 722 64V76C722 78.209 720.209 80 718 80H711.539C707.734 80 704.521 82.7075 703.281 86.3045C702.619 88.2261 701.842 90.0947 700.96 91.9021C699.292 95.3209 699.649 99.5063 702.339 102.196L706.912 106.77C708.474 108.331 708.474 110.864 706.912 112.426L698.427 120.911C696.864 122.474 694.332 122.474 692.77 120.911L688.198 116.339C685.508 113.649 681.322 113.292 677.903 114.96C676.095 115.843 674.226 116.619 672.305 117.282C668.708 118.522 666 121.734 666 125.539V132C666 134.209 664.209 136 662 136H650C647.791 136 646 134.209 646 132V125.539C646 121.734 643.292 118.522 639.696 117.281C637.774 116.619 635.905 115.842 634.097 114.96C630.679 113.291 626.493 113.649 623.803 116.339L619.23 120.912C617.668 122.474 615.136 122.474 613.574 120.912L605.088 112.427C603.526 110.864 603.526 108.332 605.088 106.77L609.661 102.197C612.351 99.5074 612.709 95.3217 611.04 91.9027C610.158 90.0951 609.381 88.2263 608.719 86.3045C607.479 82.7075 604.266 80 600.461 80H594C591.791 80 590 78.209 590 76V64C590 61.791 591.791 60 594 60H600.461C604.266 60 607.479 57.2925 608.719 53.6955C609.381 51.7737 610.158 49.9049 611.04 48.0973C612.709 44.6783 612.351 40.4926 609.661 37.8025L605.088 33.2305C603.526 31.668 603.526 29.1357 605.088 27.5732L613.574 19.0879C615.136 17.5264 617.668 17.5264 619.23 19.0879L623.803 23.6605C626.493 26.3503 630.679 26.708 634.098 25.0396C635.905 24.1574 637.774 23.381 639.696 22.7185C643.292 21.4784 646 18.2656 646 14.4609V8ZM656 95C642.193 95 631 83.8066 631 70C631 56.1934 642.193 45 656 45C669.807 45 681 56.1934 681 70C681 83.8066 669.807 95 656 95Z'
195
+ fill={`var(${COLORS.svgBackground})`}
196
+ stroke={`var(${COLORS.svgStroke})`}
197
+ strokeWidth='2'
198
+ strokeMiterlimit='10'
199
+ className={styles.rotateBig}
200
+ />
201
+ </svg>
202
+ </div>
203
+ </div>
204
+ );
205
+ }
206
+
207
+ ErrorPage.logoVariants = LogoVariant;
208
+ ErrorPage.errorTypes = ErrorType;
@@ -0,0 +1,19 @@
1
+ export enum LogoVariant {
2
+ MLSpace = 'MLSpace',
3
+ Cloud = 'Cloud',
4
+ None = 'None',
5
+ }
6
+
7
+ export enum ErrorType {
8
+ FrontendError = 'FrontendError',
9
+ PageUnavailable = 'PageUnavailable',
10
+ PageNotFound = 'PageNotFound',
11
+ Offline = 'Offline',
12
+ Redirect = 'Redirect',
13
+ }
14
+
15
+ export const COLORS = {
16
+ svgExclamationMark: '--svgExclamationMark',
17
+ svgStroke: '--svgStroke',
18
+ svgBackground: '--svgBackground',
19
+ };
@@ -0,0 +1,71 @@
1
+ import { useMemo } from 'react';
2
+
3
+ import { HomeOutlineInterfaceSVG, RefreshInterfaceSVG } from '@cloud-ru/uikit-product-icons';
4
+ import { useLocale } from '@cloud-ru/uikit-product-locale';
5
+ import { isBrowser } from '@snack-uikit/utils';
6
+
7
+ import { ErrorType } from './constants';
8
+
9
+ export function useGetContentByErrorType(errorType: ErrorType) {
10
+ const { t } = useLocale('ErrorPage');
11
+
12
+ return useMemo(() => {
13
+ switch (errorType) {
14
+ case ErrorType.PageUnavailable:
15
+ return {
16
+ title: t('pageUnavailableTitle'),
17
+ text: t('actionRedirectTitle'),
18
+ statusCode: 403,
19
+ };
20
+ case ErrorType.PageNotFound:
21
+ return {
22
+ title: t('pageNotFoundTitle'),
23
+ text: t('actionRedirectTitle'),
24
+ statusCode: 404,
25
+ };
26
+ case ErrorType.Offline:
27
+ return {
28
+ title: t('offlineTitle'),
29
+ text: t('offlineText'),
30
+ };
31
+ case ErrorType.Redirect:
32
+ return {
33
+ title: t('redirectTitle'),
34
+ text: t('redirectText'),
35
+ };
36
+ case ErrorType.FrontendError:
37
+ default:
38
+ return {
39
+ title: t('frontendErrorTitle'),
40
+ text: t('actionRedirectTitle'),
41
+ };
42
+ }
43
+ }, [errorType, t]);
44
+ }
45
+
46
+ export function useGetButtonPropsByErrorType(errorType: ErrorType, mainPageUrl?: string) {
47
+ const { t } = useLocale('ErrorPage');
48
+
49
+ return useMemo(() => {
50
+ switch (errorType) {
51
+ case ErrorType.PageNotFound:
52
+ case ErrorType.PageUnavailable:
53
+ return {
54
+ text: t('mainPageLink'),
55
+ icon: <HomeOutlineInterfaceSVG />,
56
+ href: mainPageUrl,
57
+ };
58
+ case ErrorType.Redirect:
59
+ return {
60
+ text: t('redirectButton'),
61
+ href: mainPageUrl,
62
+ };
63
+ default:
64
+ return {
65
+ text: t('refreshButton'),
66
+ icon: <RefreshInterfaceSVG />,
67
+ onClick: () => isBrowser() && window.location.reload(),
68
+ };
69
+ }
70
+ }, [errorType, mainPageUrl, t]);
71
+ }
@@ -0,0 +1 @@
1
+ export * from './ErrorPage';