@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
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [8.3.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-confirmation@8.2.2...@alfalab/core-components-confirmation@8.3.0) (2021-09-27)
7
+
8
+
9
+ ### Features
10
+
11
+ * **confirmation:** design update, new type of error "overlimit" and blocking input ([#841](https://github.com/alfa-laboratory/core-components/issues/841)) ([1ea5d31](https://github.com/alfa-laboratory/core-components/commit/1ea5d3117552f7cc9fcd78092edf634d9020b693))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [8.2.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-confirmation@8.2.1...@alfalab/core-components-confirmation@8.2.2) (2021-09-14)
7
18
 
8
19
 
@@ -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
  */
package/dist/component.js CHANGED
@@ -14,26 +14,34 @@ 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
 
18
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
21
 
20
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
23
  var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
22
24
 
23
- 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"};
25
+ 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"};
24
26
  require('./index.css')
25
27
 
26
28
  var Confirmation = React.forwardRef(function (_a, ref) {
27
- 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;
28
- var _s = React.useState(false), showHint = _s[0], setShowHint = _s[1];
29
- var shouldShowError = errorIsFatal && Boolean(errorText);
30
- var shouldShowSignComponent = !showHint && !shouldShowError;
31
- var shouldShowHint = showHint && !shouldShowError;
29
+ 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;
30
+ var _w = React.useState(false), showHint = _w[0], setShowHint = _w[1];
31
+ var shouldShowFatalError = errorIsFatal && Boolean(errorText);
32
+ var shouldShowOverlimitError = !errorIsFatal && !showHint && errorOverlimit;
33
+ var shouldShowSignComponent = !showHint && !shouldShowFatalError && !shouldShowOverlimitError;
34
+ var shouldShowHint = showHint && !shouldShowFatalError && !shouldShowOverlimitError;
32
35
  var nonFatalError = errorIsFatal ? '' : errorText;
33
36
  var inputRef = React.useRef(null);
34
37
  var handleSmsRetryClick = React.useCallback(function () {
35
38
  onSmsRetryClick();
36
39
  }, [onSmsRetryClick]);
40
+ var handleOverlimitSmsRetryClick = React.useCallback(function () {
41
+ if (onOverlimitSmsRetryClick) {
42
+ onOverlimitSmsRetryClick();
43
+ }
44
+ }, [onOverlimitSmsRetryClick]);
37
45
  var handleSmsRetryFromHintClick = React.useCallback(function () {
38
46
  setShowHint(false);
39
47
  if (!noAttemptsLeftMessage) {
@@ -45,6 +53,11 @@ var Confirmation = React.forwardRef(function (_a, ref) {
45
53
  onCountdownFinished();
46
54
  }
47
55
  }, [onCountdownFinished]);
56
+ var handleOverlimitCountdownFinished = React.useCallback(function () {
57
+ if (onOverlimitCountdownFinished) {
58
+ onOverlimitCountdownFinished();
59
+ }
60
+ }, [onOverlimitCountdownFinished]);
48
61
  var handleSmsHintLinkClick = React.useCallback(function () {
49
62
  setShowHint(true);
50
63
  if (onSmsHintLinkClick) {
@@ -66,7 +79,8 @@ var Confirmation = React.forwardRef(function (_a, ref) {
66
79
  }, []);
67
80
  return (React__default['default'].createElement("div", { className: cn__default['default'](styles.component, styles[alignContent], className), ref: ref, "data-test-id": dataTestId },
68
81
  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 })),
69
- shouldShowError && (React__default['default'].createElement("div", { className: styles.error },
82
+ shouldShowOverlimitError && (React__default['default'].createElement(components_overlimit_component.Overlimit, { duration: overlimitCountdownDuration, title: overlimitTitle, text: overlimitText, hasFatalError: errorOverlimitIsFatal, buttonRetryText: buttonRetryText, onOverlimitRepeatSms: handleOverlimitSmsRetryClick, onOverlimitCountdownFinished: handleOverlimitCountdownFinished })),
83
+ shouldShowFatalError && (React__default['default'].createElement("div", { className: styles.error },
70
84
  React__default['default'].createElement("span", { className: styles.errorHeader }, errorTitle),
71
85
  React__default['default'].createElement("span", { className: styles.errorText }, errorText),
72
86
  React__default['default'].createElement(coreComponentsButton.Button, { size: 'xs', view: 'secondary', onClick: handleErrorSmsRetryClick }, buttonErrorText))),
@@ -35,7 +35,7 @@ function __spreadArrays() {
35
35
  return r;
36
36
  }
37
37
 
38
- var styles = {"input":"confirmation__input_1sabf","hasError":"confirmation__hasError_1sabf","center":"confirmation__center_1sabf","disabled":"confirmation__disabled_1sabf","shake":"confirmation__shake_1sabf"};
38
+ 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"};
39
39
  require('./index.css')
40
40
 
41
41
  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
  }
@@ -14,7 +14,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
14
14
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
15
15
  var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
16
16
 
17
- 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"};
17
+ 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"};
18
18
  require('./index.css')
19
19
 
20
20
  /**
@@ -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
  }
@@ -8,7 +8,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
10
 
11
- var styles = {"circle":"confirmation__circle_1hhpc"};
11
+ var styles = {"circle":"confirmation__circle_4r9p5"};
12
12
  require('./index.css')
13
13
 
14
14
  var SIZE = 16;
@@ -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";
@@ -14,6 +14,8 @@ require('@alfalab/core-components-loader');
14
14
  require('./code-input/component.js');
15
15
  require('./code-input/utils.js');
16
16
  var components_signConfirmation_component = require('./sign-confirmation/component.js');
17
+ require('@alfalab/icons-glyph');
18
+ var components_overlimit_component = require('./overlimit/component.js');
17
19
 
18
20
 
19
21
 
@@ -21,3 +23,4 @@ exports.CountdownLoader = components_countdownLoader_component.CountdownLoader;
21
23
  exports.Countdown = components_countdown_component.Countdown;
22
24
  exports.formatMsAsMinutes = components_countdown_component.formatMsAsMinutes;
23
25
  exports.SignConfirmation = components_signConfirmation_component.SignConfirmation;
26
+ 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,73 @@
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');
8
+ require('@alfalab/utils');
9
+ require('@alfalab/hooks');
10
+ var components_countdownLoader_component = require('../countdown-loader/component.js');
11
+ var components_countdown_component = require('../countdown/component.js');
12
+ var iconsGlyph = require('@alfalab/icons-glyph');
13
+
14
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+
16
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
17
+
18
+ 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"};
19
+ require('./index.css')
20
+
21
+ var Overlimit = function (_a) {
22
+ 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;
23
+ var timerId = React.useRef(0);
24
+ var start = React.useRef(0);
25
+ var _c = React.useState(false), isBlockingOver = _c[0], setIsBlockingOver = _c[1];
26
+ var _d = React.useState(0), timePassed = _d[0], setTimePassed = _d[1];
27
+ var stopTimer = React.useCallback(function () {
28
+ window.clearInterval(timerId.current);
29
+ }, []);
30
+ var updateProgress = React.useCallback(function () {
31
+ var passed = Date.now() - start.current;
32
+ if (passed >= duration) {
33
+ setIsBlockingOver(true);
34
+ if (onOverlimitCountdownFinished) {
35
+ onOverlimitCountdownFinished();
36
+ }
37
+ stopTimer();
38
+ }
39
+ else {
40
+ setTimePassed(passed);
41
+ }
42
+ }, [duration, onOverlimitCountdownFinished, stopTimer]);
43
+ var startTimer = React.useCallback(function () {
44
+ start.current = Date.now();
45
+ updateProgress();
46
+ timerId.current = window.setInterval(updateProgress, 50);
47
+ }, [updateProgress]);
48
+ var handleRepeatSmsButtonClick = React.useCallback(function (event) {
49
+ setIsBlockingOver(false);
50
+ if (onOverlimitRepeatSms) {
51
+ onOverlimitRepeatSms(event);
52
+ }
53
+ startTimer();
54
+ }, [onOverlimitRepeatSms, startTimer]);
55
+ React.useEffect(function () {
56
+ startTimer();
57
+ return function () {
58
+ stopTimer();
59
+ };
60
+ }, [startTimer, stopTimer]);
61
+ var progress = timePassed / duration;
62
+ return (React__default['default'].createElement("div", { className: styles.component },
63
+ hasFatalError && (React__default['default'].createElement("div", { className: styles.alertIcon },
64
+ React__default['default'].createElement(iconsGlyph.CrossCircleMIcon, { "data-test-id": 'alert-icon', width: 64, height: 64 }))),
65
+ React__default['default'].createElement("span", { className: styles.title }, title),
66
+ React__default['default'].createElement("div", { className: styles.description },
67
+ React__default['default'].createElement("div", null, text),
68
+ isBlockingOver ? (React__default['default'].createElement(coreComponentsButton.Button, { size: 'xs', view: 'secondary', onClick: handleRepeatSmsButtonClick, className: styles.getCodeButton }, buttonRetryText)) : (React__default['default'].createElement("div", { className: styles.countdown },
69
+ React__default['default'].createElement(components_countdownLoader_component.CountdownLoader, { progress: progress, className: styles.loader }),
70
+ React__default['default'].createElement("div", { className: styles.timePassed }, components_countdown_component.formatMsAsMinutes(duration - timePassed)))))));
71
+ };
72
+
73
+ exports.Overlimit = 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,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('react');
6
+ require('classnames');
7
+ require('@alfalab/core-components-button');
8
+ require('@alfalab/utils');
9
+ require('@alfalab/hooks');
10
+ require('../countdown-loader/component.js');
11
+ require('../countdown/component.js');
12
+ require('@alfalab/icons-glyph');
13
+ var components_overlimit_component = require('./component.js');
14
+
15
+
16
+
17
+ exports.Overlimit = components_overlimit_component.Overlimit;
@@ -19,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
19
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
20
  var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
21
21
 
22
- 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"};
22
+ 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"};
23
23
  require('./index.css')
24
24
 
25
25
  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
  }