@alfalab/core-components-confirmation 8.2.2 → 8.3.0

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/component.d.ts +28 -0
  3. package/dist/component.js +21 -7
  4. package/dist/components/code-input/component.js +1 -1
  5. package/dist/components/code-input/index.css +11 -8
  6. package/dist/components/countdown/component.js +1 -1
  7. package/dist/components/countdown/index.css +13 -13
  8. package/dist/components/countdown-loader/component.js +1 -1
  9. package/dist/components/countdown-loader/index.css +2 -2
  10. package/dist/components/index.d.ts +1 -0
  11. package/dist/components/index.js +3 -0
  12. package/dist/components/overlimit/component.d.ts +12 -0
  13. package/dist/components/overlimit/component.js +73 -0
  14. package/dist/components/overlimit/index.css +90 -0
  15. package/dist/components/overlimit/index.d.ts +1 -0
  16. package/dist/components/overlimit/index.js +17 -0
  17. package/dist/components/sign-confirmation/component.js +1 -1
  18. package/dist/components/sign-confirmation/index.css +13 -13
  19. package/dist/cssm/component.d.ts +28 -0
  20. package/dist/cssm/component.js +21 -6
  21. package/dist/cssm/components/code-input/index.module.css +3 -0
  22. package/dist/cssm/components/index.d.ts +1 -0
  23. package/dist/cssm/components/index.js +4 -0
  24. package/dist/cssm/components/overlimit/component.d.ts +12 -0
  25. package/dist/cssm/components/overlimit/component.js +74 -0
  26. package/dist/cssm/components/overlimit/index.d.ts +1 -0
  27. package/dist/cssm/components/overlimit/index.js +20 -0
  28. package/dist/cssm/components/overlimit/index.module.css +89 -0
  29. package/dist/cssm/index.js +4 -0
  30. package/dist/esm/component.d.ts +28 -0
  31. package/dist/esm/component.js +21 -7
  32. package/dist/esm/components/code-input/component.js +1 -1
  33. package/dist/esm/components/code-input/index.css +11 -8
  34. package/dist/esm/components/countdown/component.js +1 -1
  35. package/dist/esm/components/countdown/index.css +13 -13
  36. package/dist/esm/components/countdown-loader/component.js +1 -1
  37. package/dist/esm/components/countdown-loader/index.css +2 -2
  38. package/dist/esm/components/index.d.ts +1 -0
  39. package/dist/esm/components/index.js +2 -0
  40. package/dist/esm/components/overlimit/component.d.ts +12 -0
  41. package/dist/esm/components/overlimit/component.js +65 -0
  42. package/dist/esm/components/overlimit/index.css +90 -0
  43. package/dist/esm/components/overlimit/index.d.ts +1 -0
  44. package/dist/esm/components/overlimit/index.js +9 -0
  45. package/dist/esm/components/sign-confirmation/component.js +1 -1
  46. package/dist/esm/components/sign-confirmation/index.css +13 -13
  47. package/dist/esm/index.css +14 -14
  48. package/dist/esm/index.js +2 -0
  49. package/dist/index.css +14 -14
  50. package/dist/index.js +3 -0
  51. package/dist/modern/component.d.ts +28 -0
  52. package/dist/modern/component.js +20 -6
  53. package/dist/modern/components/code-input/component.js +1 -1
  54. package/dist/modern/components/code-input/index.css +11 -8
  55. package/dist/modern/components/countdown/component.js +1 -1
  56. package/dist/modern/components/countdown/index.css +13 -13
  57. package/dist/modern/components/countdown-loader/component.js +1 -1
  58. package/dist/modern/components/countdown-loader/index.css +2 -2
  59. package/dist/modern/components/index.d.ts +1 -0
  60. package/dist/modern/components/index.js +2 -0
  61. package/dist/modern/components/overlimit/component.d.ts +12 -0
  62. package/dist/modern/components/overlimit/component.js +64 -0
  63. package/dist/modern/components/overlimit/index.css +90 -0
  64. package/dist/modern/components/overlimit/index.d.ts +1 -0
  65. package/dist/modern/components/overlimit/index.js +9 -0
  66. package/dist/modern/components/sign-confirmation/component.js +1 -1
  67. package/dist/modern/components/sign-confirmation/index.css +13 -13
  68. package/dist/modern/index.css +14 -14
  69. package/dist/modern/index.js +2 -0
  70. package/package.json +3 -2
@@ -1,4 +1,4 @@
1
- /* hash: 1hhpc */
1
+ /* hash: 4r9p5 */
2
2
  :root {
3
3
  --color-light-graphic-tertiary: #b6bcc3;
4
4
  }
@@ -19,7 +19,7 @@
19
19
 
20
20
  /* input */
21
21
  }
22
- .confirmation__circle_1hhpc {
22
+ .confirmation__circle_4r9p5 {
23
23
  fill: transparent;
24
24
  stroke: var(--color-light-graphic-tertiary);
25
25
  stroke-width: 2px;
@@ -1,3 +1,4 @@
1
1
  export * from "./countdown/index";
2
2
  export * from "./sign-confirmation/index";
3
3
  export * from "./countdown-loader/index";
4
+ export * from "./overlimit/index";
@@ -10,3 +10,5 @@ import '@alfalab/core-components-loader/dist/esm';
10
10
  import './code-input/component.js';
11
11
  import './code-input/utils.js';
12
12
  export { SignConfirmation } from './sign-confirmation/component.js';
13
+ import '@alfalab/icons-glyph';
14
+ export { Overlimit } from './overlimit/component.js';
@@ -0,0 +1,12 @@
1
+ import { MouseEvent, FC } from 'react';
2
+ type OverlimitProps = {
3
+ duration?: number;
4
+ buttonRetryText: string;
5
+ hasFatalError: boolean;
6
+ title: string;
7
+ text: string;
8
+ onOverlimitCountdownFinished: () => void;
9
+ onOverlimitRepeatSms: (event: MouseEvent) => void;
10
+ };
11
+ declare const Overlimit: FC<OverlimitProps>;
12
+ export { OverlimitProps, Overlimit };
@@ -0,0 +1,65 @@
1
+ import React, { useRef, useState, useCallback, useEffect } from 'react';
2
+ import 'classnames';
3
+ import { Button } from '@alfalab/core-components-button/dist/esm';
4
+ import '@alfalab/utils';
5
+ import '@alfalab/hooks';
6
+ import { CountdownLoader } from '../countdown-loader/component.js';
7
+ import { formatMsAsMinutes } from '../countdown/component.js';
8
+ import { CrossCircleMIcon } from '@alfalab/icons-glyph';
9
+
10
+ var styles = {"component":"confirmation__component_3dv1y","title":"confirmation__title_3dv1y","description":"confirmation__description_3dv1y","countdown":"confirmation__countdown_3dv1y","loader":"confirmation__loader_3dv1y","timePassed":"confirmation__timePassed_3dv1y","getCodeButton":"confirmation__getCodeButton_3dv1y","alertIcon":"confirmation__alertIcon_3dv1y"};
11
+ require('./index.css')
12
+
13
+ var Overlimit = function (_a) {
14
+ var _b = _a.duration, duration = _b === void 0 ? 60000 : _b, buttonRetryText = _a.buttonRetryText, hasFatalError = _a.hasFatalError, onOverlimitRepeatSms = _a.onOverlimitRepeatSms, onOverlimitCountdownFinished = _a.onOverlimitCountdownFinished, text = _a.text, title = _a.title;
15
+ var timerId = useRef(0);
16
+ var start = useRef(0);
17
+ var _c = useState(false), isBlockingOver = _c[0], setIsBlockingOver = _c[1];
18
+ var _d = useState(0), timePassed = _d[0], setTimePassed = _d[1];
19
+ var stopTimer = useCallback(function () {
20
+ window.clearInterval(timerId.current);
21
+ }, []);
22
+ var updateProgress = useCallback(function () {
23
+ var passed = Date.now() - start.current;
24
+ if (passed >= duration) {
25
+ setIsBlockingOver(true);
26
+ if (onOverlimitCountdownFinished) {
27
+ onOverlimitCountdownFinished();
28
+ }
29
+ stopTimer();
30
+ }
31
+ else {
32
+ setTimePassed(passed);
33
+ }
34
+ }, [duration, onOverlimitCountdownFinished, stopTimer]);
35
+ var startTimer = useCallback(function () {
36
+ start.current = Date.now();
37
+ updateProgress();
38
+ timerId.current = window.setInterval(updateProgress, 50);
39
+ }, [updateProgress]);
40
+ var handleRepeatSmsButtonClick = useCallback(function (event) {
41
+ setIsBlockingOver(false);
42
+ if (onOverlimitRepeatSms) {
43
+ onOverlimitRepeatSms(event);
44
+ }
45
+ startTimer();
46
+ }, [onOverlimitRepeatSms, startTimer]);
47
+ useEffect(function () {
48
+ startTimer();
49
+ return function () {
50
+ stopTimer();
51
+ };
52
+ }, [startTimer, stopTimer]);
53
+ var progress = timePassed / duration;
54
+ return (React.createElement("div", { className: styles.component },
55
+ hasFatalError && (React.createElement("div", { className: styles.alertIcon },
56
+ React.createElement(CrossCircleMIcon, { "data-test-id": 'alert-icon', width: 64, height: 64 }))),
57
+ React.createElement("span", { className: styles.title }, title),
58
+ React.createElement("div", { className: styles.description },
59
+ React.createElement("div", null, text),
60
+ isBlockingOver ? (React.createElement(Button, { size: 'xs', view: 'secondary', onClick: handleRepeatSmsButtonClick, className: styles.getCodeButton }, buttonRetryText)) : (React.createElement("div", { className: styles.countdown },
61
+ React.createElement(CountdownLoader, { progress: progress, className: styles.loader }),
62
+ React.createElement("div", { className: styles.timePassed }, formatMsAsMinutes(duration - timePassed)))))));
63
+ };
64
+
65
+ export { Overlimit };
@@ -0,0 +1,90 @@
1
+ /* hash: 3dv1y */
2
+ :root {
3
+ --color-static-status-red: #d91d0b;
4
+ }
5
+ :root {
6
+ --color-light-text-primary: #0b1f35;
7
+ --color-light-text-secondary: #546272;
8
+ }
9
+ :root {
10
+
11
+ /* Hard */
12
+
13
+ /* Up */
14
+
15
+ /* Hard up */
16
+ }
17
+ :root {
18
+ --gap-2xs: 4px;
19
+ --gap-xs: 8px;
20
+ --gap-xl: 24px;
21
+ --gap-2xl: 32px;
22
+ --gap-3xl: 40px;
23
+ }
24
+ :root {
25
+ --font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
26
+ sans-serif;
27
+ }
28
+ :root {
29
+ /* title */
30
+ --confirmation-title-font-size: 22px;
31
+ --confirmation-title-line-height: 26px;
32
+ --confirmation-title-font-weight: 700;
33
+ --confirmation-title-font-family: var(--font-family-system);
34
+ --confirmation-title-color: var(--color-light-text-primary);
35
+ --confirmation-title-font-feature-settings: normal;
36
+
37
+ /* text */
38
+ --confirmation-text-font-size: 16px;
39
+ --confirmation-text-line-height: 24px;
40
+ --confirmation-text-font-weight: 400;
41
+ --confirmation-text-font-family: var(--font-family-system);
42
+ --confirmation-text-color: var(--color-light-text-secondary);
43
+
44
+ /* error */
45
+
46
+ /* input */
47
+ }
48
+ .confirmation__component_3dv1y {
49
+ display: flex;
50
+ flex-direction: column;
51
+ align-items: center;
52
+ }
53
+ .confirmation__title_3dv1y {
54
+ font-size: var(--confirmation-title-font-size);
55
+ line-height: var(--confirmation-title-line-height);
56
+ font-weight: var(--confirmation-title-font-weight);
57
+ font-family: var(--confirmation-title-font-family);
58
+ color: var(--confirmation-title-color);
59
+ font-feature-settings: var(--confirmation-title-font-feature-settings);
60
+
61
+ margin-bottom: var(--gap-3xl);
62
+ }
63
+ .confirmation__description_3dv1y {
64
+ font-size: var(--confirmation-text-font-size);
65
+ line-height: var(--confirmation-text-line-height);
66
+ font-weight: var(--confirmation-text-font-weight);
67
+ font-family: var(--confirmation-text-font-family);
68
+ color: var(--confirmation-text-color);
69
+ }
70
+ .confirmation__countdown_3dv1y {
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: center;
74
+ margin-top: var(--gap-2xs);
75
+ }
76
+ .confirmation__loader_3dv1y {
77
+ margin-right: var(--gap-xs);
78
+ }
79
+ .confirmation__timePassed_3dv1y {
80
+ display: flex;
81
+ min-width: 3em;
82
+ }
83
+ .confirmation__getCodeButton_3dv1y {
84
+ margin-top: var(--gap-2xl);
85
+ }
86
+ .confirmation__alertIcon_3dv1y {
87
+ text-align: center;
88
+ margin-bottom: var(--gap-xl);
89
+ color: var(--color-static-status-red);
90
+ }
@@ -0,0 +1 @@
1
+ export * from "./component";
@@ -0,0 +1,9 @@
1
+ import 'react';
2
+ import 'classnames';
3
+ import '@alfalab/core-components-button/dist/esm';
4
+ import '@alfalab/utils';
5
+ import '@alfalab/hooks';
6
+ import '../countdown-loader/component.js';
7
+ import '../countdown/component.js';
8
+ import '@alfalab/icons-glyph';
9
+ export { Overlimit } from './component.js';
@@ -10,7 +10,7 @@ import { Loader } from '@alfalab/core-components-loader/dist/esm';
10
10
  import { CodeInput } from '../code-input/component.js';
11
11
  import '../code-input/utils.js';
12
12
 
13
- var styles = {"component":"confirmation__component_155am","countdown":"confirmation__countdown_155am","hidden":"confirmation__hidden_155am","header":"confirmation__header_155am","inputContainer":"confirmation__inputContainer_155am","smsComeLinkWrap":"confirmation__smsComeLinkWrap_155am","smsComeLink":"confirmation__smsComeLink_155am","error":"confirmation__error_155am","loaderWrap":"confirmation__loaderWrap_155am","loaderText":"confirmation__loaderText_155am","center":"confirmation__center_155am","codeInput":"confirmation__codeInput_155am"};
13
+ var styles = {"component":"confirmation__component_1nv3s","countdown":"confirmation__countdown_1nv3s","hidden":"confirmation__hidden_1nv3s","header":"confirmation__header_1nv3s","inputContainer":"confirmation__inputContainer_1nv3s","smsComeLinkWrap":"confirmation__smsComeLinkWrap_1nv3s","smsComeLink":"confirmation__smsComeLink_1nv3s","error":"confirmation__error_1nv3s","loaderWrap":"confirmation__loaderWrap_1nv3s","loaderText":"confirmation__loaderText_1nv3s","center":"confirmation__center_1nv3s","codeInput":"confirmation__codeInput_1nv3s"};
14
14
  require('./index.css')
15
15
 
16
16
  var SignConfirmation = function (_a) {
@@ -1,4 +1,4 @@
1
- /* hash: 155am */
1
+ /* hash: 1nv3s */
2
2
  :root {
3
3
  --color-light-text-negative: #d91d0b;
4
4
  --color-light-text-primary: #0b1f35;
@@ -43,20 +43,20 @@
43
43
 
44
44
  /* input */
45
45
  }
46
- .confirmation__component_155am {
46
+ .confirmation__component_1nv3s {
47
47
  display: flex;
48
48
  flex-direction: column;
49
49
  }
50
- .confirmation__countdown_155am {
50
+ .confirmation__countdown_1nv3s {
51
51
  max-height: 300px;
52
52
  overflow: hidden;
53
53
  transition: max-height 0.15s ease;
54
54
  }
55
- .confirmation__hidden_155am {
55
+ .confirmation__hidden_1nv3s {
56
56
  opacity: 0;
57
57
  max-height: 0;
58
58
  }
59
- .confirmation__header_155am {
59
+ .confirmation__header_1nv3s {
60
60
  font-size: var(--confirmation-title-font-size);
61
61
  line-height: var(--confirmation-title-line-height);
62
62
  font-weight: var(--confirmation-title-font-weight);
@@ -67,19 +67,19 @@
67
67
  margin-bottom: var(--gap-3xl);
68
68
  color: var(--confirmation-title-color);
69
69
  }
70
- .confirmation__inputContainer_155am {
70
+ .confirmation__inputContainer_1nv3s {
71
71
  display: flex;
72
72
  flex-direction: column;
73
73
  }
74
- .confirmation__smsComeLinkWrap_155am {
74
+ .confirmation__smsComeLinkWrap_1nv3s {
75
75
  margin-top: var(--gap-l);
76
76
  }
77
- .confirmation__smsComeLink_155am {
77
+ .confirmation__smsComeLink_1nv3s {
78
78
  font-size: 14px;
79
79
  line-height: 20px;
80
80
  font-weight: 400;
81
81
  }
82
- .confirmation__error_155am {
82
+ .confirmation__error_1nv3s {
83
83
  font-size: 14px;
84
84
  line-height: 20px;
85
85
  font-weight: 400;
@@ -87,12 +87,12 @@
87
87
  margin-top: var(--gap-xs);
88
88
  color: var(--confirmation-error-color);
89
89
  }
90
- .confirmation__loaderWrap_155am {
90
+ .confirmation__loaderWrap_1nv3s {
91
91
  display: flex;
92
92
  align-items: center;
93
93
  margin: var(--gap-3xl) 0 var(--gap-xs);
94
94
  }
95
- .confirmation__loaderText_155am {
95
+ .confirmation__loaderText_1nv3s {
96
96
  font-size: var(--confirmation-text-font-size);
97
97
  line-height: var(--confirmation-text-line-height);
98
98
  font-weight: var(--confirmation-text-font-weight);
@@ -102,7 +102,7 @@
102
102
  margin-left: var(--gap-s);
103
103
  color: var(--confirmation-text-color);
104
104
  }
105
- .confirmation__center_155am .confirmation__codeInput_155am,
106
- .confirmation__center_155am .confirmation__loaderWrap_155am {
105
+ .confirmation__center_1nv3s .confirmation__codeInput_1nv3s,
106
+ .confirmation__center_1nv3s .confirmation__loaderWrap_1nv3s {
107
107
  justify-content: center;
108
108
  }
@@ -1,4 +1,4 @@
1
- /* hash: omrsm */
1
+ /* hash: 4oaka */
2
2
  :root {
3
3
  --color-light-text-primary: #0b1f35;
4
4
  --color-light-text-secondary: #546272;
@@ -41,18 +41,18 @@
41
41
 
42
42
  /* input */
43
43
  }
44
- .confirmation__component_omrsm {
44
+ .confirmation__component_4oaka {
45
45
  display: flex;
46
46
  flex-direction: column;
47
47
  width: 100%;
48
48
  font-family: var(--confirmation-font-family);
49
49
  }
50
- .confirmation__error_omrsm {
50
+ .confirmation__error_4oaka {
51
51
  display: flex;
52
52
  flex-direction: column;
53
53
  align-items: flex-start;
54
54
  }
55
- .confirmation__errorHeader_omrsm {
55
+ .confirmation__errorHeader_4oaka {
56
56
  font-size: var(--confirmation-title-font-size);
57
57
  line-height: var(--confirmation-title-line-height);
58
58
  font-weight: var(--confirmation-title-font-weight);
@@ -63,7 +63,7 @@
63
63
  margin-bottom: var(--gap-2xl);
64
64
  color: var(--confirmation-title-color);
65
65
  }
66
- .confirmation__errorText_omrsm {
66
+ .confirmation__errorText_4oaka {
67
67
  font-size: var(--confirmation-text-font-size);
68
68
  line-height: var(--confirmation-text-line-height);
69
69
  font-weight: var(--confirmation-text-font-weight);
@@ -73,12 +73,12 @@
73
73
  margin-bottom: var(--gap-2xl);
74
74
  color: var(--confirmation-text-color);
75
75
  }
76
- .confirmation__phoneHintWrap_omrsm {
76
+ .confirmation__phoneHintWrap_4oaka {
77
77
  display: flex;
78
78
  flex-direction: column;
79
79
  align-items: flex-start;
80
80
  }
81
- .confirmation__phoneHintText_omrsm {
81
+ .confirmation__phoneHintText_4oaka {
82
82
  font-size: var(--confirmation-text-font-size);
83
83
  line-height: var(--confirmation-text-line-height);
84
84
  font-weight: var(--confirmation-text-font-weight);
@@ -88,7 +88,7 @@
88
88
  margin-bottom: var(--gap-xl);
89
89
  color: var(--confirmation-text-color);
90
90
  }
91
- .confirmation__phonesWrap_omrsm {
91
+ .confirmation__phonesWrap_4oaka {
92
92
  font-size: var(--confirmation-text-font-size);
93
93
  line-height: var(--confirmation-text-line-height);
94
94
  font-weight: var(--confirmation-text-font-weight);
@@ -99,21 +99,21 @@
99
99
  flex-direction: column;
100
100
  margin-bottom: var(--gap-4xl);
101
101
  }
102
- .confirmation__phoneWrap_omrsm {
102
+ .confirmation__phoneWrap_4oaka {
103
103
  margin-bottom: var(--gap-xs)
104
104
  }
105
- .confirmation__phoneWrap_omrsm:last-child {
105
+ .confirmation__phoneWrap_4oaka:last-child {
106
106
  margin-bottom: 0;
107
107
  }
108
- .confirmation__phoneDescription_omrsm {
108
+ .confirmation__phoneDescription_4oaka {
109
109
  color: var(--confirmation-text-color);
110
110
  }
111
- .confirmation__component_omrsm.confirmation__center_omrsm {
111
+ .confirmation__component_4oaka.confirmation__center_4oaka {
112
112
  text-align: center;
113
113
  }
114
- .confirmation__center_omrsm .confirmation__phoneHintWrap_omrsm {
114
+ .confirmation__center_4oaka .confirmation__phoneHintWrap_4oaka {
115
115
  align-items: center;
116
116
  }
117
- .confirmation__center_omrsm .confirmation__error_omrsm {
117
+ .confirmation__center_4oaka .confirmation__error_4oaka {
118
118
  align-items: center;
119
119
  }
package/dist/esm/index.js CHANGED
@@ -10,4 +10,6 @@ import '@alfalab/core-components-loader/dist/esm';
10
10
  import './components/code-input/component.js';
11
11
  import './components/code-input/utils.js';
12
12
  export { SignConfirmation } from './components/sign-confirmation/component.js';
13
+ import '@alfalab/icons-glyph';
14
+ export { Overlimit } from './components/overlimit/component.js';
13
15
  export { Confirmation } from './component.js';
package/dist/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: omrsm */
1
+ /* hash: 4oaka */
2
2
  :root {
3
3
  --color-light-text-primary: #0b1f35;
4
4
  --color-light-text-secondary: #546272;
@@ -41,18 +41,18 @@
41
41
 
42
42
  /* input */
43
43
  }
44
- .confirmation__component_omrsm {
44
+ .confirmation__component_4oaka {
45
45
  display: flex;
46
46
  flex-direction: column;
47
47
  width: 100%;
48
48
  font-family: var(--confirmation-font-family);
49
49
  }
50
- .confirmation__error_omrsm {
50
+ .confirmation__error_4oaka {
51
51
  display: flex;
52
52
  flex-direction: column;
53
53
  align-items: flex-start;
54
54
  }
55
- .confirmation__errorHeader_omrsm {
55
+ .confirmation__errorHeader_4oaka {
56
56
  font-size: var(--confirmation-title-font-size);
57
57
  line-height: var(--confirmation-title-line-height);
58
58
  font-weight: var(--confirmation-title-font-weight);
@@ -63,7 +63,7 @@
63
63
  margin-bottom: var(--gap-2xl);
64
64
  color: var(--confirmation-title-color);
65
65
  }
66
- .confirmation__errorText_omrsm {
66
+ .confirmation__errorText_4oaka {
67
67
  font-size: var(--confirmation-text-font-size);
68
68
  line-height: var(--confirmation-text-line-height);
69
69
  font-weight: var(--confirmation-text-font-weight);
@@ -73,12 +73,12 @@
73
73
  margin-bottom: var(--gap-2xl);
74
74
  color: var(--confirmation-text-color);
75
75
  }
76
- .confirmation__phoneHintWrap_omrsm {
76
+ .confirmation__phoneHintWrap_4oaka {
77
77
  display: flex;
78
78
  flex-direction: column;
79
79
  align-items: flex-start;
80
80
  }
81
- .confirmation__phoneHintText_omrsm {
81
+ .confirmation__phoneHintText_4oaka {
82
82
  font-size: var(--confirmation-text-font-size);
83
83
  line-height: var(--confirmation-text-line-height);
84
84
  font-weight: var(--confirmation-text-font-weight);
@@ -88,7 +88,7 @@
88
88
  margin-bottom: var(--gap-xl);
89
89
  color: var(--confirmation-text-color);
90
90
  }
91
- .confirmation__phonesWrap_omrsm {
91
+ .confirmation__phonesWrap_4oaka {
92
92
  font-size: var(--confirmation-text-font-size);
93
93
  line-height: var(--confirmation-text-line-height);
94
94
  font-weight: var(--confirmation-text-font-weight);
@@ -99,21 +99,21 @@
99
99
  flex-direction: column;
100
100
  margin-bottom: var(--gap-4xl);
101
101
  }
102
- .confirmation__phoneWrap_omrsm {
102
+ .confirmation__phoneWrap_4oaka {
103
103
  margin-bottom: var(--gap-xs)
104
104
  }
105
- .confirmation__phoneWrap_omrsm:last-child {
105
+ .confirmation__phoneWrap_4oaka:last-child {
106
106
  margin-bottom: 0;
107
107
  }
108
- .confirmation__phoneDescription_omrsm {
108
+ .confirmation__phoneDescription_4oaka {
109
109
  color: var(--confirmation-text-color);
110
110
  }
111
- .confirmation__component_omrsm.confirmation__center_omrsm {
111
+ .confirmation__component_4oaka.confirmation__center_4oaka {
112
112
  text-align: center;
113
113
  }
114
- .confirmation__center_omrsm .confirmation__phoneHintWrap_omrsm {
114
+ .confirmation__center_4oaka .confirmation__phoneHintWrap_4oaka {
115
115
  align-items: center;
116
116
  }
117
- .confirmation__center_omrsm .confirmation__error_omrsm {
117
+ .confirmation__center_4oaka .confirmation__error_4oaka {
118
118
  align-items: center;
119
119
  }
package/dist/index.js CHANGED
@@ -14,6 +14,8 @@ require('@alfalab/core-components-loader');
14
14
  require('./components/code-input/component.js');
15
15
  require('./components/code-input/utils.js');
16
16
  var components_signConfirmation_component = require('./components/sign-confirmation/component.js');
17
+ require('@alfalab/icons-glyph');
18
+ var components_overlimit_component = require('./components/overlimit/component.js');
17
19
  var component = require('./component.js');
18
20
 
19
21
 
@@ -22,4 +24,5 @@ exports.CountdownLoader = components_countdownLoader_component.CountdownLoader;
22
24
  exports.Countdown = components_countdown_component.Countdown;
23
25
  exports.formatMsAsMinutes = components_countdown_component.formatMsAsMinutes;
24
26
  exports.SignConfirmation = components_signConfirmation_component.SignConfirmation;
27
+ exports.Overlimit = components_overlimit_component.Overlimit;
25
28
  exports.Confirmation = component.Confirmation;
@@ -19,6 +19,14 @@ type ConfirmationProps = {
19
19
  * Состояние ошибки подписания
20
20
  */
21
21
  error?: boolean;
22
+ /**
23
+ * Состояние ошибки лимитов - превышено кол-во попыток ввода или запросов кода
24
+ */
25
+ errorOverlimit?: boolean;
26
+ /**
27
+ * Состояние критической ошибки лимитов - превышены все лимиты и попытки, пользователя блокируют
28
+ */
29
+ errorOverlimitIsFatal?: boolean;
22
30
  /**
23
31
  * Текст ошибки подписания
24
32
  */
@@ -61,6 +69,18 @@ type ConfirmationProps = {
61
69
  * Заголовок экрана подписания
62
70
  */
63
71
  signTitle?: string | React.ReactNode;
72
+ /**
73
+ * Заголовок экрана ошибки лимитов
74
+ */
75
+ overlimitTitle?: string;
76
+ /**
77
+ * Текстовое описание блокировки формы при превышении лимитов
78
+ */
79
+ overlimitText?: string;
80
+ /**
81
+ * Длительно блокировки при превышении лимитов, в милисекундах
82
+ */
83
+ overlimitCountdownDuration?: number;
64
84
  /**
65
85
  * Заголовок экрана блокирующей ошибки
66
86
  */
@@ -118,10 +138,18 @@ type ConfirmationProps = {
118
138
  * Обработчик события нажатия на кнопку "Запросить код"
119
139
  */
120
140
  onSmsRetryClick: () => void;
141
+ /**
142
+ * Обработчик события нажатия на кнопку "Запросить код" в блоке превышение лимитов
143
+ */
144
+ onOverlimitSmsRetryClick?: () => void;
121
145
  /**
122
146
  * Обработчик события завершения обратного отсчета для повторного запроса сообщения
123
147
  */
124
148
  onCountdownFinished?: () => void;
149
+ /**
150
+ * Обработчик события завершения обратного отсчета для блокировки формы
151
+ */
152
+ onOverlimitCountdownFinished?: () => void;
125
153
  /**
126
154
  * Обработчик события нажатия на ссылку "не приходит сообщение?"
127
155
  */
@@ -10,20 +10,28 @@ import '@alfalab/core-components-loader/dist/modern';
10
10
  import './components/code-input/utils.js';
11
11
  import './components/code-input/component.js';
12
12
  import { SignConfirmation } from './components/sign-confirmation/component.js';
13
+ import '@alfalab/icons-glyph';
14
+ import { Overlimit } from './components/overlimit/component.js';
13
15
 
14
- var styles = {"component":"confirmation__component_omrsm","error":"confirmation__error_omrsm","errorHeader":"confirmation__errorHeader_omrsm","errorText":"confirmation__errorText_omrsm","phoneHintWrap":"confirmation__phoneHintWrap_omrsm","phoneHintText":"confirmation__phoneHintText_omrsm","phonesWrap":"confirmation__phonesWrap_omrsm","phoneWrap":"confirmation__phoneWrap_omrsm","phoneDescription":"confirmation__phoneDescription_omrsm","center":"confirmation__center_omrsm"};
16
+ var styles = {"component":"confirmation__component_4oaka","error":"confirmation__error_4oaka","errorHeader":"confirmation__errorHeader_4oaka","errorText":"confirmation__errorText_4oaka","phoneHintWrap":"confirmation__phoneHintWrap_4oaka","phoneHintText":"confirmation__phoneHintText_4oaka","phonesWrap":"confirmation__phonesWrap_4oaka","phoneWrap":"confirmation__phoneWrap_4oaka","phoneDescription":"confirmation__phoneDescription_4oaka","center":"confirmation__center_4oaka"};
15
17
  require('./index.css')
16
18
 
17
- const Confirmation = forwardRef(({ additionalContent, className, countdownDuration = 60000, dataTestId, errorIsFatal, errorTitle = 'Превышено количество попыток ввода кода', error = false, errorText, hasPhoneMask = true, hasSmsCountdown = true, phone, requiredCharAmount = 5, signTitle = 'Введите код из\xa0сообщения', code, codeSending = false, codeChecking = false, codeCheckingText = 'Проверка кода', codeSendingText = 'Отправляем код', buttonErrorText = 'Понятно', buttonReturnText = 'Вернуться назад', buttonRetryText = 'Запросить новый код', alignContent = 'left', noAttemptsLeftMessage, countdownContent, onInputFinished, onSmsRetryClick, onActionWithFatalError, onCountdownFinished, onInputChange, onSmsHintLinkClick, }, ref) => {
19
+ const Confirmation = forwardRef(({ additionalContent, className, countdownDuration = 60000, dataTestId, errorIsFatal, errorTitle = 'Превышено количество попыток ввода кода', error = false, errorOverlimit = false, errorOverlimitIsFatal = false, errorText, hasPhoneMask = true, hasSmsCountdown = true, phone, requiredCharAmount = 5, signTitle = 'Введите код из\xa0сообщения', overlimitTitle = 'Превышено количество\n попыток ввода кода', overlimitText = 'Повторное подтверждение кодом из SMS\n будет возможно через', overlimitCountdownDuration, code, codeSending = false, codeChecking = false, codeCheckingText = 'Проверка кода', codeSendingText = 'Отправляем код', buttonErrorText = 'Понятно', buttonReturnText = 'Вернуться назад', buttonRetryText = 'Запросить новый код', alignContent = 'left', noAttemptsLeftMessage, countdownContent, onInputFinished, onSmsRetryClick, onOverlimitSmsRetryClick, onActionWithFatalError, onCountdownFinished, onOverlimitCountdownFinished, onInputChange, onSmsHintLinkClick, }, ref) => {
18
20
  const [showHint, setShowHint] = useState(false);
19
- const shouldShowError = errorIsFatal && Boolean(errorText);
20
- const shouldShowSignComponent = !showHint && !shouldShowError;
21
- const shouldShowHint = showHint && !shouldShowError;
21
+ const shouldShowFatalError = errorIsFatal && Boolean(errorText);
22
+ const shouldShowOverlimitError = !errorIsFatal && !showHint && errorOverlimit;
23
+ const shouldShowSignComponent = !showHint && !shouldShowFatalError && !shouldShowOverlimitError;
24
+ const shouldShowHint = showHint && !shouldShowFatalError && !shouldShowOverlimitError;
22
25
  const nonFatalError = errorIsFatal ? '' : errorText;
23
26
  const inputRef = useRef(null);
24
27
  const handleSmsRetryClick = useCallback(() => {
25
28
  onSmsRetryClick();
26
29
  }, [onSmsRetryClick]);
30
+ const handleOverlimitSmsRetryClick = useCallback(() => {
31
+ if (onOverlimitSmsRetryClick) {
32
+ onOverlimitSmsRetryClick();
33
+ }
34
+ }, [onOverlimitSmsRetryClick]);
27
35
  const handleSmsRetryFromHintClick = useCallback(() => {
28
36
  setShowHint(false);
29
37
  if (!noAttemptsLeftMessage) {
@@ -35,6 +43,11 @@ const Confirmation = forwardRef(({ additionalContent, className, countdownDurati
35
43
  onCountdownFinished();
36
44
  }
37
45
  }, [onCountdownFinished]);
46
+ const handleOverlimitCountdownFinished = useCallback(() => {
47
+ if (onOverlimitCountdownFinished) {
48
+ onOverlimitCountdownFinished();
49
+ }
50
+ }, [onOverlimitCountdownFinished]);
38
51
  const handleSmsHintLinkClick = useCallback(() => {
39
52
  setShowHint(true);
40
53
  if (onSmsHintLinkClick) {
@@ -56,7 +69,8 @@ const Confirmation = forwardRef(({ additionalContent, className, countdownDurati
56
69
  }, []);
57
70
  return (React.createElement("div", { className: cn(styles.component, styles[alignContent], className), ref: ref, "data-test-id": dataTestId },
58
71
  shouldShowSignComponent && (React.createElement(SignConfirmation, { codeChecking: codeChecking, codeSending: codeSending, smsHintVisible: !codeChecking, additionalContent: additionalContent, requiredCharAmount: requiredCharAmount, hasSmsCountdown: hasSmsCountdown, countdownDuration: countdownDuration, phone: phone, code: code, hasPhoneMask: hasPhoneMask, errorText: nonFatalError || '', error: error, title: signTitle, buttonRetryText: buttonRetryText, inputRef: inputRef, codeCheckingText: codeCheckingText, codeSendingText: codeSendingText, alignContent: alignContent, noAttemptsLeftMessage: noAttemptsLeftMessage, countdownContent: countdownContent, onInputFinished: onInputFinished, onInputChange: onInputChange, onSmsRetryClick: handleSmsRetryClick, onCountdownFinished: handleCountdownFinished, onSmsHintLinkClick: handleSmsHintLinkClick })),
59
- shouldShowError && (React.createElement("div", { className: styles.error },
72
+ shouldShowOverlimitError && (React.createElement(Overlimit, { duration: overlimitCountdownDuration, title: overlimitTitle, text: overlimitText, hasFatalError: errorOverlimitIsFatal, buttonRetryText: buttonRetryText, onOverlimitRepeatSms: handleOverlimitSmsRetryClick, onOverlimitCountdownFinished: handleOverlimitCountdownFinished })),
73
+ shouldShowFatalError && (React.createElement("div", { className: styles.error },
60
74
  React.createElement("span", { className: styles.errorHeader }, errorTitle),
61
75
  React.createElement("span", { className: styles.errorText }, errorText),
62
76
  React.createElement(Button, { size: 'xs', view: 'secondary', onClick: handleErrorSmsRetryClick }, buttonErrorText))),
@@ -3,7 +3,7 @@ import cn from 'classnames';
3
3
  import { usePrevious } from '@alfalab/hooks';
4
4
  import { mergeArrays } from './utils.js';
5
5
 
6
- var styles = {"input":"confirmation__input_1sabf","hasError":"confirmation__hasError_1sabf","center":"confirmation__center_1sabf","disabled":"confirmation__disabled_1sabf","shake":"confirmation__shake_1sabf"};
6
+ var styles = {"component":"confirmation__component_b1i9a","input":"confirmation__input_b1i9a","hasError":"confirmation__hasError_b1i9a","center":"confirmation__center_b1i9a","disabled":"confirmation__disabled_b1i9a","shake":"confirmation__shake_b1i9a"};
7
7
  require('./index.css')
8
8
 
9
9
  const Input = ({ index, slotsCount, error, processing, value, alignContent, handleChange, handleInputKeyDown, setRef, focus, }) => {