@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
@@ -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
  */
@@ -18,6 +18,9 @@ require('./components/code-input/utils.js');
18
18
  require('./components/code-input/index.module.css');
19
19
  require('./components/sign-confirmation/index.module.css');
20
20
  var components_signConfirmation_component = require('./components/sign-confirmation/component.js');
21
+ require('@alfalab/icons-glyph');
22
+ require('./components/overlimit/index.module.css');
23
+ var components_overlimit_component = require('./components/overlimit/component.js');
21
24
  var styles = require('./index.module.css');
22
25
 
23
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -27,16 +30,22 @@ var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
27
30
  var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
28
31
 
29
32
  var Confirmation = React.forwardRef(function (_a, ref) {
30
- var additionalContent = _a.additionalContent, className = _a.className, _b = _a.countdownDuration, countdownDuration = _b === void 0 ? 60000 : _b, dataTestId = _a.dataTestId, errorIsFatal = _a.errorIsFatal, _c = _a.errorTitle, errorTitle = _c === void 0 ? 'Превышено количество попыток ввода кода' : _c, _d = _a.error, error = _d === void 0 ? false : _d, errorText = _a.errorText, _e = _a.hasPhoneMask, hasPhoneMask = _e === void 0 ? true : _e, _f = _a.hasSmsCountdown, hasSmsCountdown = _f === void 0 ? true : _f, phone = _a.phone, _g = _a.requiredCharAmount, requiredCharAmount = _g === void 0 ? 5 : _g, _h = _a.signTitle, signTitle = _h === void 0 ? 'Введите код из\xa0сообщения' : _h, code = _a.code, _j = _a.codeSending, codeSending = _j === void 0 ? false : _j, _k = _a.codeChecking, codeChecking = _k === void 0 ? false : _k, _l = _a.codeCheckingText, codeCheckingText = _l === void 0 ? 'Проверка кода' : _l, _m = _a.codeSendingText, codeSendingText = _m === void 0 ? 'Отправляем код' : _m, _o = _a.buttonErrorText, buttonErrorText = _o === void 0 ? 'Понятно' : _o, _p = _a.buttonReturnText, buttonReturnText = _p === void 0 ? 'Вернуться назад' : _p, _q = _a.buttonRetryText, buttonRetryText = _q === void 0 ? 'Запросить новый код' : _q, _r = _a.alignContent, alignContent = _r === void 0 ? 'left' : _r, noAttemptsLeftMessage = _a.noAttemptsLeftMessage, countdownContent = _a.countdownContent, onInputFinished = _a.onInputFinished, onSmsRetryClick = _a.onSmsRetryClick, onActionWithFatalError = _a.onActionWithFatalError, onCountdownFinished = _a.onCountdownFinished, onInputChange = _a.onInputChange, onSmsHintLinkClick = _a.onSmsHintLinkClick;
31
- var _s = React.useState(false), showHint = _s[0], setShowHint = _s[1];
32
- var shouldShowError = errorIsFatal && Boolean(errorText);
33
- var shouldShowSignComponent = !showHint && !shouldShowError;
34
- var shouldShowHint = showHint && !shouldShowError;
33
+ var additionalContent = _a.additionalContent, className = _a.className, _b = _a.countdownDuration, countdownDuration = _b === void 0 ? 60000 : _b, dataTestId = _a.dataTestId, errorIsFatal = _a.errorIsFatal, _c = _a.errorTitle, errorTitle = _c === void 0 ? 'Превышено количество попыток ввода кода' : _c, _d = _a.error, error = _d === void 0 ? false : _d, _e = _a.errorOverlimit, errorOverlimit = _e === void 0 ? false : _e, _f = _a.errorOverlimitIsFatal, errorOverlimitIsFatal = _f === void 0 ? false : _f, errorText = _a.errorText, _g = _a.hasPhoneMask, hasPhoneMask = _g === void 0 ? true : _g, _h = _a.hasSmsCountdown, hasSmsCountdown = _h === void 0 ? true : _h, phone = _a.phone, _j = _a.requiredCharAmount, requiredCharAmount = _j === void 0 ? 5 : _j, _k = _a.signTitle, signTitle = _k === void 0 ? 'Введите код из\xa0сообщения' : _k, _l = _a.overlimitTitle, overlimitTitle = _l === void 0 ? 'Превышено количество\n попыток ввода кода' : _l, _m = _a.overlimitText, overlimitText = _m === void 0 ? 'Повторное подтверждение кодом из SMS\n будет возможно через' : _m, overlimitCountdownDuration = _a.overlimitCountdownDuration, code = _a.code, _o = _a.codeSending, codeSending = _o === void 0 ? false : _o, _p = _a.codeChecking, codeChecking = _p === void 0 ? false : _p, _q = _a.codeCheckingText, codeCheckingText = _q === void 0 ? 'Проверка кода' : _q, _r = _a.codeSendingText, codeSendingText = _r === void 0 ? 'Отправляем код' : _r, _s = _a.buttonErrorText, buttonErrorText = _s === void 0 ? 'Понятно' : _s, _t = _a.buttonReturnText, buttonReturnText = _t === void 0 ? 'Вернуться назад' : _t, _u = _a.buttonRetryText, buttonRetryText = _u === void 0 ? 'Запросить новый код' : _u, _v = _a.alignContent, alignContent = _v === void 0 ? 'left' : _v, noAttemptsLeftMessage = _a.noAttemptsLeftMessage, countdownContent = _a.countdownContent, onInputFinished = _a.onInputFinished, onSmsRetryClick = _a.onSmsRetryClick, onOverlimitSmsRetryClick = _a.onOverlimitSmsRetryClick, onActionWithFatalError = _a.onActionWithFatalError, onCountdownFinished = _a.onCountdownFinished, onOverlimitCountdownFinished = _a.onOverlimitCountdownFinished, onInputChange = _a.onInputChange, onSmsHintLinkClick = _a.onSmsHintLinkClick;
34
+ var _w = React.useState(false), showHint = _w[0], setShowHint = _w[1];
35
+ var shouldShowFatalError = errorIsFatal && Boolean(errorText);
36
+ var shouldShowOverlimitError = !errorIsFatal && !showHint && errorOverlimit;
37
+ var shouldShowSignComponent = !showHint && !shouldShowFatalError && !shouldShowOverlimitError;
38
+ var shouldShowHint = showHint && !shouldShowFatalError && !shouldShowOverlimitError;
35
39
  var nonFatalError = errorIsFatal ? '' : errorText;
36
40
  var inputRef = React.useRef(null);
37
41
  var handleSmsRetryClick = React.useCallback(function () {
38
42
  onSmsRetryClick();
39
43
  }, [onSmsRetryClick]);
44
+ var handleOverlimitSmsRetryClick = React.useCallback(function () {
45
+ if (onOverlimitSmsRetryClick) {
46
+ onOverlimitSmsRetryClick();
47
+ }
48
+ }, [onOverlimitSmsRetryClick]);
40
49
  var handleSmsRetryFromHintClick = React.useCallback(function () {
41
50
  setShowHint(false);
42
51
  if (!noAttemptsLeftMessage) {
@@ -48,6 +57,11 @@ var Confirmation = React.forwardRef(function (_a, ref) {
48
57
  onCountdownFinished();
49
58
  }
50
59
  }, [onCountdownFinished]);
60
+ var handleOverlimitCountdownFinished = React.useCallback(function () {
61
+ if (onOverlimitCountdownFinished) {
62
+ onOverlimitCountdownFinished();
63
+ }
64
+ }, [onOverlimitCountdownFinished]);
51
65
  var handleSmsHintLinkClick = React.useCallback(function () {
52
66
  setShowHint(true);
53
67
  if (onSmsHintLinkClick) {
@@ -69,7 +83,8 @@ var Confirmation = React.forwardRef(function (_a, ref) {
69
83
  }, []);
70
84
  return (React__default['default'].createElement("div", { className: cn__default['default'](styles__default['default'].component, styles__default['default'][alignContent], className), ref: ref, "data-test-id": dataTestId },
71
85
  shouldShowSignComponent && (React__default['default'].createElement(components_signConfirmation_component.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 })),
72
- shouldShowError && (React__default['default'].createElement("div", { className: styles__default['default'].error },
86
+ shouldShowOverlimitError && (React__default['default'].createElement(components_overlimit_component.Overlimit, { duration: overlimitCountdownDuration, title: overlimitTitle, text: overlimitText, hasFatalError: errorOverlimitIsFatal, buttonRetryText: buttonRetryText, onOverlimitRepeatSms: handleOverlimitSmsRetryClick, onOverlimitCountdownFinished: handleOverlimitCountdownFinished })),
87
+ shouldShowFatalError && (React__default['default'].createElement("div", { className: styles__default['default'].error },
73
88
  React__default['default'].createElement("span", { className: styles__default['default'].errorHeader }, errorTitle),
74
89
  React__default['default'].createElement("span", { className: styles__default['default'].errorText }, errorText),
75
90
  React__default['default'].createElement(coreComponentsButton.Button, { size: 'xs', view: 'secondary', onClick: handleErrorSmsRetryClick }, buttonErrorText))),
@@ -40,6 +40,9 @@
40
40
  --confirmation-input-bg-color: var(--color-light-bg-secondary);
41
41
  --confirmation-input-error-bg-color: var(--color-light-bg-negative-muted);
42
42
  }
43
+ .component {
44
+ display: flex;
45
+ }
43
46
  .input {
44
47
  flex-shrink: 0;
45
48
  width: 36px;
@@ -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";
@@ -18,6 +18,9 @@ require('./code-input/utils.js');
18
18
  require('./code-input/index.module.css');
19
19
  require('./sign-confirmation/index.module.css');
20
20
  var components_signConfirmation_component = require('./sign-confirmation/component.js');
21
+ require('@alfalab/icons-glyph');
22
+ require('./overlimit/index.module.css');
23
+ var components_overlimit_component = require('./overlimit/component.js');
21
24
 
22
25
 
23
26
 
@@ -25,3 +28,4 @@ exports.CountdownLoader = components_countdownLoader_component.CountdownLoader;
25
28
  exports.Countdown = components_countdown_component.Countdown;
26
29
  exports.formatMsAsMinutes = components_countdown_component.formatMsAsMinutes;
27
30
  exports.SignConfirmation = components_signConfirmation_component.SignConfirmation;
31
+ exports.Overlimit = components_overlimit_component.Overlimit;
@@ -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,74 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ require('classnames');
7
+ var coreComponentsButton = require('@alfalab/core-components-button/dist/cssm');
8
+ require('@alfalab/utils');
9
+ require('@alfalab/hooks');
10
+ require('../countdown-loader/index.module.css');
11
+ var components_countdownLoader_component = require('../countdown-loader/component.js');
12
+ require('../countdown/index.module.css');
13
+ var components_countdown_component = require('../countdown/component.js');
14
+ var iconsGlyph = require('@alfalab/icons-glyph');
15
+ var styles = require('./index.module.css');
16
+
17
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
+
19
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
+ var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
21
+
22
+ var Overlimit = function (_a) {
23
+ 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;
24
+ var timerId = React.useRef(0);
25
+ var start = React.useRef(0);
26
+ var _c = React.useState(false), isBlockingOver = _c[0], setIsBlockingOver = _c[1];
27
+ var _d = React.useState(0), timePassed = _d[0], setTimePassed = _d[1];
28
+ var stopTimer = React.useCallback(function () {
29
+ window.clearInterval(timerId.current);
30
+ }, []);
31
+ var updateProgress = React.useCallback(function () {
32
+ var passed = Date.now() - start.current;
33
+ if (passed >= duration) {
34
+ setIsBlockingOver(true);
35
+ if (onOverlimitCountdownFinished) {
36
+ onOverlimitCountdownFinished();
37
+ }
38
+ stopTimer();
39
+ }
40
+ else {
41
+ setTimePassed(passed);
42
+ }
43
+ }, [duration, onOverlimitCountdownFinished, stopTimer]);
44
+ var startTimer = React.useCallback(function () {
45
+ start.current = Date.now();
46
+ updateProgress();
47
+ timerId.current = window.setInterval(updateProgress, 50);
48
+ }, [updateProgress]);
49
+ var handleRepeatSmsButtonClick = React.useCallback(function (event) {
50
+ setIsBlockingOver(false);
51
+ if (onOverlimitRepeatSms) {
52
+ onOverlimitRepeatSms(event);
53
+ }
54
+ startTimer();
55
+ }, [onOverlimitRepeatSms, startTimer]);
56
+ React.useEffect(function () {
57
+ startTimer();
58
+ return function () {
59
+ stopTimer();
60
+ };
61
+ }, [startTimer, stopTimer]);
62
+ var progress = timePassed / duration;
63
+ return (React__default['default'].createElement("div", { className: styles__default['default'].component },
64
+ hasFatalError && (React__default['default'].createElement("div", { className: styles__default['default'].alertIcon },
65
+ React__default['default'].createElement(iconsGlyph.CrossCircleMIcon, { "data-test-id": 'alert-icon', width: 64, height: 64 }))),
66
+ React__default['default'].createElement("span", { className: styles__default['default'].title }, title),
67
+ React__default['default'].createElement("div", { className: styles__default['default'].description },
68
+ React__default['default'].createElement("div", null, text),
69
+ isBlockingOver ? (React__default['default'].createElement(coreComponentsButton.Button, { size: 'xs', view: 'secondary', onClick: handleRepeatSmsButtonClick, className: styles__default['default'].getCodeButton }, buttonRetryText)) : (React__default['default'].createElement("div", { className: styles__default['default'].countdown },
70
+ React__default['default'].createElement(components_countdownLoader_component.CountdownLoader, { progress: progress, className: styles__default['default'].loader }),
71
+ React__default['default'].createElement("div", { className: styles__default['default'].timePassed }, components_countdown_component.formatMsAsMinutes(duration - timePassed)))))));
72
+ };
73
+
74
+ exports.Overlimit = Overlimit;
@@ -0,0 +1 @@
1
+ export * from "./component";
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('react');
6
+ require('classnames');
7
+ require('@alfalab/core-components-button/dist/cssm');
8
+ require('@alfalab/utils');
9
+ require('@alfalab/hooks');
10
+ require('../countdown-loader/index.module.css');
11
+ require('../countdown-loader/component.js');
12
+ require('../countdown/index.module.css');
13
+ require('../countdown/component.js');
14
+ require('@alfalab/icons-glyph');
15
+ require('./index.module.css');
16
+ var components_overlimit_component = require('./component.js');
17
+
18
+
19
+
20
+ exports.Overlimit = components_overlimit_component.Overlimit;
@@ -0,0 +1,89 @@
1
+ :root {
2
+ --color-static-status-red: #d91d0b;
3
+ }
4
+ :root {
5
+ --color-light-text-primary: #0b1f35;
6
+ --color-light-text-secondary: #546272;
7
+ }
8
+ :root {
9
+
10
+ /* Hard */
11
+
12
+ /* Up */
13
+
14
+ /* Hard up */
15
+ }
16
+ :root {
17
+ --gap-2xs: 4px;
18
+ --gap-xs: 8px;
19
+ --gap-xl: 24px;
20
+ --gap-2xl: 32px;
21
+ --gap-3xl: 40px;
22
+ }
23
+ :root {
24
+ --font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
25
+ sans-serif;
26
+ }
27
+ :root {
28
+ /* title */
29
+ --confirmation-title-font-size: 22px;
30
+ --confirmation-title-line-height: 26px;
31
+ --confirmation-title-font-weight: 700;
32
+ --confirmation-title-font-family: var(--font-family-system);
33
+ --confirmation-title-color: var(--color-light-text-primary);
34
+ --confirmation-title-font-feature-settings: normal;
35
+
36
+ /* text */
37
+ --confirmation-text-font-size: 16px;
38
+ --confirmation-text-line-height: 24px;
39
+ --confirmation-text-font-weight: 400;
40
+ --confirmation-text-font-family: var(--font-family-system);
41
+ --confirmation-text-color: var(--color-light-text-secondary);
42
+
43
+ /* error */
44
+
45
+ /* input */
46
+ }
47
+ .component {
48
+ display: flex;
49
+ flex-direction: column;
50
+ align-items: center;
51
+ }
52
+ .title {
53
+ font-size: var(--confirmation-title-font-size);
54
+ line-height: var(--confirmation-title-line-height);
55
+ font-weight: var(--confirmation-title-font-weight);
56
+ font-family: var(--confirmation-title-font-family);
57
+ color: var(--confirmation-title-color);
58
+ font-feature-settings: var(--confirmation-title-font-feature-settings);
59
+
60
+ margin-bottom: var(--gap-3xl);
61
+ }
62
+ .description {
63
+ font-size: var(--confirmation-text-font-size);
64
+ line-height: var(--confirmation-text-line-height);
65
+ font-weight: var(--confirmation-text-font-weight);
66
+ font-family: var(--confirmation-text-font-family);
67
+ color: var(--confirmation-text-color);
68
+ }
69
+ .countdown {
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ margin-top: var(--gap-2xs);
74
+ }
75
+ .loader {
76
+ margin-right: var(--gap-xs);
77
+ }
78
+ .timePassed {
79
+ display: flex;
80
+ min-width: 3em;
81
+ }
82
+ .getCodeButton {
83
+ margin-top: var(--gap-2xl);
84
+ }
85
+ .alertIcon {
86
+ text-align: center;
87
+ margin-bottom: var(--gap-xl);
88
+ color: var(--color-static-status-red);
89
+ }
@@ -18,6 +18,9 @@ require('./components/code-input/utils.js');
18
18
  require('./components/code-input/index.module.css');
19
19
  require('./components/sign-confirmation/index.module.css');
20
20
  var components_signConfirmation_component = require('./components/sign-confirmation/component.js');
21
+ require('@alfalab/icons-glyph');
22
+ require('./components/overlimit/index.module.css');
23
+ var components_overlimit_component = require('./components/overlimit/component.js');
21
24
  require('./index.module.css');
22
25
  var component = require('./component.js');
23
26
 
@@ -27,4 +30,5 @@ exports.CountdownLoader = components_countdownLoader_component.CountdownLoader;
27
30
  exports.Countdown = components_countdown_component.Countdown;
28
31
  exports.formatMsAsMinutes = components_countdown_component.formatMsAsMinutes;
29
32
  exports.SignConfirmation = components_signConfirmation_component.SignConfirmation;
33
+ exports.Overlimit = components_overlimit_component.Overlimit;
30
34
  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,21 +10,29 @@ 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
  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
19
  var Confirmation = forwardRef(function (_a, ref) {
18
- var additionalContent = _a.additionalContent, className = _a.className, _b = _a.countdownDuration, countdownDuration = _b === void 0 ? 60000 : _b, dataTestId = _a.dataTestId, errorIsFatal = _a.errorIsFatal, _c = _a.errorTitle, errorTitle = _c === void 0 ? 'Превышено количество попыток ввода кода' : _c, _d = _a.error, error = _d === void 0 ? false : _d, errorText = _a.errorText, _e = _a.hasPhoneMask, hasPhoneMask = _e === void 0 ? true : _e, _f = _a.hasSmsCountdown, hasSmsCountdown = _f === void 0 ? true : _f, phone = _a.phone, _g = _a.requiredCharAmount, requiredCharAmount = _g === void 0 ? 5 : _g, _h = _a.signTitle, signTitle = _h === void 0 ? 'Введите код из\xa0сообщения' : _h, code = _a.code, _j = _a.codeSending, codeSending = _j === void 0 ? false : _j, _k = _a.codeChecking, codeChecking = _k === void 0 ? false : _k, _l = _a.codeCheckingText, codeCheckingText = _l === void 0 ? 'Проверка кода' : _l, _m = _a.codeSendingText, codeSendingText = _m === void 0 ? 'Отправляем код' : _m, _o = _a.buttonErrorText, buttonErrorText = _o === void 0 ? 'Понятно' : _o, _p = _a.buttonReturnText, buttonReturnText = _p === void 0 ? 'Вернуться назад' : _p, _q = _a.buttonRetryText, buttonRetryText = _q === void 0 ? 'Запросить новый код' : _q, _r = _a.alignContent, alignContent = _r === void 0 ? 'left' : _r, noAttemptsLeftMessage = _a.noAttemptsLeftMessage, countdownContent = _a.countdownContent, onInputFinished = _a.onInputFinished, onSmsRetryClick = _a.onSmsRetryClick, onActionWithFatalError = _a.onActionWithFatalError, onCountdownFinished = _a.onCountdownFinished, onInputChange = _a.onInputChange, onSmsHintLinkClick = _a.onSmsHintLinkClick;
19
- var _s = useState(false), showHint = _s[0], setShowHint = _s[1];
20
- var shouldShowError = errorIsFatal && Boolean(errorText);
21
- var shouldShowSignComponent = !showHint && !shouldShowError;
22
- var shouldShowHint = showHint && !shouldShowError;
20
+ var additionalContent = _a.additionalContent, className = _a.className, _b = _a.countdownDuration, countdownDuration = _b === void 0 ? 60000 : _b, dataTestId = _a.dataTestId, errorIsFatal = _a.errorIsFatal, _c = _a.errorTitle, errorTitle = _c === void 0 ? 'Превышено количество попыток ввода кода' : _c, _d = _a.error, error = _d === void 0 ? false : _d, _e = _a.errorOverlimit, errorOverlimit = _e === void 0 ? false : _e, _f = _a.errorOverlimitIsFatal, errorOverlimitIsFatal = _f === void 0 ? false : _f, errorText = _a.errorText, _g = _a.hasPhoneMask, hasPhoneMask = _g === void 0 ? true : _g, _h = _a.hasSmsCountdown, hasSmsCountdown = _h === void 0 ? true : _h, phone = _a.phone, _j = _a.requiredCharAmount, requiredCharAmount = _j === void 0 ? 5 : _j, _k = _a.signTitle, signTitle = _k === void 0 ? 'Введите код из\xa0сообщения' : _k, _l = _a.overlimitTitle, overlimitTitle = _l === void 0 ? 'Превышено количество\n попыток ввода кода' : _l, _m = _a.overlimitText, overlimitText = _m === void 0 ? 'Повторное подтверждение кодом из SMS\n будет возможно через' : _m, overlimitCountdownDuration = _a.overlimitCountdownDuration, code = _a.code, _o = _a.codeSending, codeSending = _o === void 0 ? false : _o, _p = _a.codeChecking, codeChecking = _p === void 0 ? false : _p, _q = _a.codeCheckingText, codeCheckingText = _q === void 0 ? 'Проверка кода' : _q, _r = _a.codeSendingText, codeSendingText = _r === void 0 ? 'Отправляем код' : _r, _s = _a.buttonErrorText, buttonErrorText = _s === void 0 ? 'Понятно' : _s, _t = _a.buttonReturnText, buttonReturnText = _t === void 0 ? 'Вернуться назад' : _t, _u = _a.buttonRetryText, buttonRetryText = _u === void 0 ? 'Запросить новый код' : _u, _v = _a.alignContent, alignContent = _v === void 0 ? 'left' : _v, noAttemptsLeftMessage = _a.noAttemptsLeftMessage, countdownContent = _a.countdownContent, onInputFinished = _a.onInputFinished, onSmsRetryClick = _a.onSmsRetryClick, onOverlimitSmsRetryClick = _a.onOverlimitSmsRetryClick, onActionWithFatalError = _a.onActionWithFatalError, onCountdownFinished = _a.onCountdownFinished, onOverlimitCountdownFinished = _a.onOverlimitCountdownFinished, onInputChange = _a.onInputChange, onSmsHintLinkClick = _a.onSmsHintLinkClick;
21
+ var _w = useState(false), showHint = _w[0], setShowHint = _w[1];
22
+ var shouldShowFatalError = errorIsFatal && Boolean(errorText);
23
+ var shouldShowOverlimitError = !errorIsFatal && !showHint && errorOverlimit;
24
+ var shouldShowSignComponent = !showHint && !shouldShowFatalError && !shouldShowOverlimitError;
25
+ var shouldShowHint = showHint && !shouldShowFatalError && !shouldShowOverlimitError;
23
26
  var nonFatalError = errorIsFatal ? '' : errorText;
24
27
  var inputRef = useRef(null);
25
28
  var handleSmsRetryClick = useCallback(function () {
26
29
  onSmsRetryClick();
27
30
  }, [onSmsRetryClick]);
31
+ var handleOverlimitSmsRetryClick = useCallback(function () {
32
+ if (onOverlimitSmsRetryClick) {
33
+ onOverlimitSmsRetryClick();
34
+ }
35
+ }, [onOverlimitSmsRetryClick]);
28
36
  var handleSmsRetryFromHintClick = useCallback(function () {
29
37
  setShowHint(false);
30
38
  if (!noAttemptsLeftMessage) {
@@ -36,6 +44,11 @@ var Confirmation = forwardRef(function (_a, ref) {
36
44
  onCountdownFinished();
37
45
  }
38
46
  }, [onCountdownFinished]);
47
+ var handleOverlimitCountdownFinished = useCallback(function () {
48
+ if (onOverlimitCountdownFinished) {
49
+ onOverlimitCountdownFinished();
50
+ }
51
+ }, [onOverlimitCountdownFinished]);
39
52
  var handleSmsHintLinkClick = useCallback(function () {
40
53
  setShowHint(true);
41
54
  if (onSmsHintLinkClick) {
@@ -57,7 +70,8 @@ var Confirmation = forwardRef(function (_a, ref) {
57
70
  }, []);
58
71
  return (React.createElement("div", { className: cn(styles.component, styles[alignContent], className), ref: ref, "data-test-id": dataTestId },
59
72
  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 })),
60
- shouldShowError && (React.createElement("div", { className: styles.error },
73
+ shouldShowOverlimitError && (React.createElement(Overlimit, { duration: overlimitCountdownDuration, title: overlimitTitle, text: overlimitText, hasFatalError: errorOverlimitIsFatal, buttonRetryText: buttonRetryText, onOverlimitRepeatSms: handleOverlimitSmsRetryClick, onOverlimitCountdownFinished: handleOverlimitCountdownFinished })),
74
+ shouldShowFatalError && (React.createElement("div", { className: styles.error },
61
75
  React.createElement("span", { className: styles.errorHeader }, errorTitle),
62
76
  React.createElement("span", { className: styles.errorText }, errorText),
63
77
  React.createElement(Button, { size: 'xs', view: 'secondary', onClick: handleErrorSmsRetryClick }, buttonErrorText))),
@@ -26,7 +26,7 @@ function __spreadArrays() {
26
26
  return r;
27
27
  }
28
28
 
29
- var styles = {"input":"confirmation__input_1sabf","hasError":"confirmation__hasError_1sabf","center":"confirmation__center_1sabf","disabled":"confirmation__disabled_1sabf","shake":"confirmation__shake_1sabf"};
29
+ 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"};
30
30
  require('./index.css')
31
31
 
32
32
  var Input = function (_a) {
@@ -1,4 +1,4 @@
1
- /* hash: 1sabf */
1
+ /* hash: b1i9a */
2
2
  :root {
3
3
  --color-light-bg-negative-muted: #feebea;
4
4
  --color-light-bg-secondary: #f3f4f5;
@@ -41,7 +41,10 @@
41
41
  --confirmation-input-bg-color: var(--color-light-bg-secondary);
42
42
  --confirmation-input-error-bg-color: var(--color-light-bg-negative-muted);
43
43
  }
44
- .confirmation__input_1sabf {
44
+ .confirmation__component_b1i9a {
45
+ display: flex;
46
+ }
47
+ .confirmation__input_b1i9a {
45
48
  flex-shrink: 0;
46
49
  width: 36px;
47
50
  height: 48px;
@@ -58,19 +61,19 @@
58
61
  font-weight: var(--confirmation-input-font-weight);
59
62
  font-family: var(--confirmation-input-font-family)
60
63
  }
61
- .confirmation__input_1sabf.confirmation__hasError_1sabf {
64
+ .confirmation__input_b1i9a.confirmation__hasError_b1i9a {
62
65
  color: var(--confirmation-error-color);
63
66
  caret-color: var(--confirmation-input-text-color);
64
67
  background-color: var(--confirmation-input-error-bg-color);
65
68
  }
66
- .confirmation__input_1sabf.confirmation__center_1sabf {
69
+ .confirmation__input_b1i9a.confirmation__center_b1i9a {
67
70
  margin: 0 var(--gap-2xs);
68
71
  }
69
- .confirmation__input_1sabf.confirmation__disabled_1sabf {
72
+ .confirmation__input_b1i9a.confirmation__disabled_b1i9a {
70
73
  color: var(--color-light-text-tertiary);
71
74
  opacity: 1;
72
75
  }
73
- @keyframes confirmation__shake_1sabf {
76
+ @keyframes confirmation__shake_b1i9a {
74
77
  0% {
75
78
  transform: translateX(0);
76
79
  }
@@ -87,6 +90,6 @@
87
90
  transform: translateX(0);
88
91
  }
89
92
  }
90
- .confirmation__shake_1sabf {
91
- animation: confirmation__shake_1sabf 0.15s linear 0s 3;
93
+ .confirmation__shake_b1i9a {
94
+ animation: confirmation__shake_b1i9a 0.15s linear 0s 3;
92
95
  }
@@ -5,7 +5,7 @@ import { phoneNumber } from '@alfalab/utils';
5
5
  import { usePrevious } from '@alfalab/hooks';
6
6
  import { CountdownLoader } from '../countdown-loader/component.js';
7
7
 
8
- var styles = {"component":"confirmation__component_ofova","hasError":"confirmation__hasError_ofova","getCodeButton":"confirmation__getCodeButton_ofova","info":"confirmation__info_ofova","customContent":"confirmation__customContent_ofova","loaderWrap":"confirmation__loaderWrap_ofova","loader":"confirmation__loader_ofova","center":"confirmation__center_ofova","timePassed":"confirmation__timePassed_ofova","noAttemptsLeftMessage":"confirmation__noAttemptsLeftMessage_ofova"};
8
+ var styles = {"component":"confirmation__component_6ndzw","hasError":"confirmation__hasError_6ndzw","getCodeButton":"confirmation__getCodeButton_6ndzw","info":"confirmation__info_6ndzw","customContent":"confirmation__customContent_6ndzw","loaderWrap":"confirmation__loaderWrap_6ndzw","loader":"confirmation__loader_6ndzw","center":"confirmation__center_6ndzw","timePassed":"confirmation__timePassed_6ndzw","noAttemptsLeftMessage":"confirmation__noAttemptsLeftMessage_6ndzw"};
9
9
  require('./index.css')
10
10
 
11
11
  /**
@@ -1,4 +1,4 @@
1
- /* hash: ofova */
1
+ /* hash: 6ndzw */
2
2
  :root {
3
3
  --color-light-text-secondary: #546272;
4
4
  }
@@ -34,7 +34,7 @@
34
34
 
35
35
  /* input */
36
36
  }
37
- .confirmation__component_ofova {
37
+ .confirmation__component_6ndzw {
38
38
  font-size: var(--confirmation-text-font-size);
39
39
  line-height: var(--confirmation-text-line-height);
40
40
  font-weight: var(--confirmation-text-font-weight);
@@ -47,39 +47,39 @@
47
47
  margin-top: var(--gap-3xl);
48
48
  color: var(--confirmation-text-color);
49
49
  }
50
- .confirmation__hasError_ofova .confirmation__getCodeButton_ofova {
50
+ .confirmation__hasError_6ndzw .confirmation__getCodeButton_6ndzw {
51
51
  margin-top: 0;
52
52
  }
53
- .confirmation__hasError_ofova .confirmation__info_ofova {
53
+ .confirmation__hasError_6ndzw .confirmation__info_6ndzw {
54
54
  margin-top: 0;
55
55
  }
56
- .confirmation__hasError_ofova .confirmation__customContent_ofova {
56
+ .confirmation__hasError_6ndzw .confirmation__customContent_6ndzw {
57
57
  margin-bottom: var(--gap-2xl);
58
58
  }
59
- .confirmation__info_ofova {
59
+ .confirmation__info_6ndzw {
60
60
  margin: var(--gap-2xs) 0;
61
61
  }
62
- .confirmation__loaderWrap_ofova {
62
+ .confirmation__loaderWrap_6ndzw {
63
63
  display: flex;
64
64
  align-items: center;
65
65
  margin-bottom: var(--gap-xs);
66
66
  }
67
- .confirmation__loader_ofova {
67
+ .confirmation__loader_6ndzw {
68
68
  margin-right: var(--gap-xs);
69
69
  }
70
- .confirmation__center_ofova {
70
+ .confirmation__center_6ndzw {
71
71
  align-items: center
72
72
  }
73
- .confirmation__center_ofova .confirmation__loaderWrap_ofova {
73
+ .confirmation__center_6ndzw .confirmation__loaderWrap_6ndzw {
74
74
  justify-content: center;
75
75
  }
76
- .confirmation__timePassed_ofova {
76
+ .confirmation__timePassed_6ndzw {
77
77
  display: flex;
78
78
  min-width: 3em;
79
79
  }
80
- .confirmation__getCodeButton_ofova {
80
+ .confirmation__getCodeButton_6ndzw {
81
81
  margin-top: var(--gap-2xl);
82
82
  }
83
- .confirmation__noAttemptsLeftMessage_ofova {
83
+ .confirmation__noAttemptsLeftMessage_6ndzw {
84
84
  margin: var(--gap-2xs) 0 var(--gap-xs);
85
85
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- var styles = {"circle":"confirmation__circle_1hhpc"};
3
+ var styles = {"circle":"confirmation__circle_4r9p5"};
4
4
  require('./index.css')
5
5
 
6
6
  var SIZE = 16;