@alfalab/core-components-confirmation 9.0.4 → 10.0.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 (233) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/component.d.ts +4 -164
  3. package/dist/component.js +113 -101
  4. package/dist/components/countdown-loader/component.d.ts +1 -1
  5. package/dist/components/countdown-loader/component.js +1 -1
  6. package/dist/components/countdown-loader/index.css +2 -2
  7. package/dist/components/index.d.ts +1 -3
  8. package/dist/components/index.js +15 -14
  9. package/dist/components/screens/fatal-error/component.d.ts +3 -0
  10. package/dist/components/screens/fatal-error/component.js +25 -0
  11. package/dist/components/screens/fatal-error/index.css +61 -0
  12. package/dist/components/{code-input → screens/fatal-error}/index.d.ts +0 -0
  13. package/dist/components/screens/fatal-error/index.js +13 -0
  14. package/dist/components/screens/hint/component.d.ts +3 -0
  15. package/dist/components/screens/hint/component.js +45 -0
  16. package/dist/components/screens/hint/index.css +103 -0
  17. package/dist/components/{countdown → screens/hint}/index.d.ts +0 -0
  18. package/dist/components/screens/hint/index.js +15 -0
  19. package/dist/components/screens/index.d.ts +4 -0
  20. package/dist/components/screens/index.js +26 -0
  21. package/dist/components/screens/initial/component.d.ts +3 -0
  22. package/dist/components/screens/initial/component.js +95 -0
  23. package/dist/components/screens/initial/countdown-section.d.ts +0 -0
  24. package/dist/components/screens/initial/countdown-section.js +15 -0
  25. package/dist/components/screens/initial/index.css +98 -0
  26. package/dist/components/{overlimit → screens/initial}/index.d.ts +0 -0
  27. package/dist/components/screens/initial/index.js +19 -0
  28. package/dist/components/screens/temp-block/component.d.ts +3 -0
  29. package/dist/components/screens/temp-block/component.js +36 -0
  30. package/dist/components/{overlimit → screens/temp-block}/index.css +9 -31
  31. package/dist/components/{sign-confirmation → screens/temp-block}/index.d.ts +0 -0
  32. package/dist/components/screens/temp-block/index.js +13 -0
  33. package/dist/context.d.ts +4 -0
  34. package/dist/context.js +27 -0
  35. package/dist/countdown-section-2edac0a0.d.ts +9 -0
  36. package/dist/countdown-section-2edac0a0.js +41 -0
  37. package/dist/cssm/component.d.ts +4 -164
  38. package/dist/cssm/component.js +115 -103
  39. package/dist/cssm/components/countdown-loader/component.d.ts +1 -1
  40. package/dist/cssm/components/index.d.ts +1 -3
  41. package/dist/cssm/components/index.js +19 -18
  42. package/dist/cssm/components/screens/fatal-error/component.d.ts +3 -0
  43. package/dist/cssm/components/screens/fatal-error/component.js +24 -0
  44. package/dist/cssm/components/{code-input → screens/fatal-error}/index.d.ts +0 -0
  45. package/dist/cssm/components/screens/fatal-error/index.js +14 -0
  46. package/dist/cssm/components/screens/fatal-error/index.module.css +60 -0
  47. package/dist/cssm/components/screens/hint/component.d.ts +3 -0
  48. package/dist/cssm/components/screens/hint/component.js +44 -0
  49. package/dist/cssm/components/{countdown → screens/hint}/index.d.ts +0 -0
  50. package/dist/cssm/components/screens/hint/index.js +16 -0
  51. package/dist/cssm/components/screens/hint/index.module.css +102 -0
  52. package/dist/cssm/components/screens/index.d.ts +4 -0
  53. package/dist/cssm/components/screens/index.js +31 -0
  54. package/dist/cssm/components/screens/initial/component.d.ts +3 -0
  55. package/dist/cssm/components/screens/initial/component.js +97 -0
  56. package/dist/cssm/components/screens/initial/countdown-section.d.ts +9 -0
  57. package/dist/cssm/components/screens/initial/countdown-section.js +41 -0
  58. package/dist/cssm/components/{overlimit → screens/initial}/index.d.ts +0 -0
  59. package/dist/cssm/components/screens/initial/index.js +20 -0
  60. package/dist/cssm/components/{sign-confirmation → screens/initial}/index.module.css +40 -50
  61. package/dist/cssm/components/screens/temp-block/component.d.ts +3 -0
  62. package/dist/cssm/components/screens/temp-block/component.js +36 -0
  63. package/dist/cssm/components/{sign-confirmation → screens/temp-block}/index.d.ts +0 -0
  64. package/dist/cssm/components/screens/temp-block/index.js +15 -0
  65. package/dist/cssm/components/{overlimit → screens/temp-block}/index.module.css +6 -28
  66. package/dist/cssm/context.d.ts +4 -0
  67. package/dist/cssm/context.js +27 -0
  68. package/dist/cssm/index.d.ts +3 -0
  69. package/dist/cssm/index.js +29 -20
  70. package/dist/cssm/index.module.css +5 -77
  71. package/dist/cssm/types.d.ts +130 -0
  72. package/dist/cssm/types.js +23 -0
  73. package/dist/cssm/utils.d.ts +30 -0
  74. package/dist/cssm/utils.js +84 -0
  75. package/dist/esm/component.d.ts +4 -164
  76. package/dist/esm/component.js +114 -102
  77. package/dist/esm/components/countdown-loader/component.d.ts +1 -1
  78. package/dist/esm/components/countdown-loader/component.js +1 -1
  79. package/dist/esm/components/countdown-loader/index.css +2 -2
  80. package/dist/esm/components/index.d.ts +1 -3
  81. package/dist/esm/components/index.js +11 -10
  82. package/dist/esm/components/screens/fatal-error/component.d.ts +3 -0
  83. package/dist/esm/components/screens/fatal-error/component.js +17 -0
  84. package/dist/esm/components/screens/fatal-error/index.css +61 -0
  85. package/dist/esm/components/{code-input → screens/fatal-error}/index.d.ts +0 -0
  86. package/dist/esm/components/screens/fatal-error/index.js +5 -0
  87. package/dist/esm/components/screens/hint/component.d.ts +3 -0
  88. package/dist/esm/components/screens/hint/component.js +36 -0
  89. package/dist/esm/components/screens/hint/index.css +103 -0
  90. package/dist/esm/components/{countdown → screens/hint}/index.d.ts +0 -0
  91. package/dist/esm/components/screens/hint/index.js +7 -0
  92. package/dist/esm/components/screens/index.d.ts +4 -0
  93. package/dist/esm/components/screens/index.js +15 -0
  94. package/dist/esm/components/screens/initial/component.d.ts +3 -0
  95. package/dist/esm/components/screens/initial/component.js +86 -0
  96. package/dist/esm/components/screens/initial/countdown-section.d.ts +0 -0
  97. package/dist/esm/components/screens/initial/countdown-section.js +7 -0
  98. package/dist/esm/components/screens/initial/index.css +98 -0
  99. package/dist/esm/components/{overlimit → screens/initial}/index.d.ts +0 -0
  100. package/dist/esm/components/screens/initial/index.js +11 -0
  101. package/dist/esm/components/screens/temp-block/component.d.ts +3 -0
  102. package/dist/esm/components/screens/temp-block/component.js +28 -0
  103. package/dist/{modern/components/overlimit → esm/components/screens/temp-block}/index.css +9 -31
  104. package/dist/esm/components/{sign-confirmation → screens/temp-block}/index.d.ts +0 -0
  105. package/dist/esm/components/screens/temp-block/index.js +5 -0
  106. package/dist/esm/context.d.ts +4 -0
  107. package/dist/esm/context.js +23 -0
  108. package/dist/esm/countdown-section-ddb744a6.d.ts +9 -0
  109. package/dist/esm/countdown-section-ddb744a6.js +33 -0
  110. package/dist/esm/index.css +7 -79
  111. package/dist/esm/index.d.ts +3 -0
  112. package/dist/esm/index.js +13 -11
  113. package/dist/esm/types.d.ts +130 -0
  114. package/dist/esm/types.js +19 -0
  115. package/dist/esm/utils.d.ts +30 -0
  116. package/dist/esm/utils.js +76 -0
  117. package/dist/index.css +7 -79
  118. package/dist/index.d.ts +3 -0
  119. package/dist/index.js +25 -16
  120. package/dist/modern/component.d.ts +4 -164
  121. package/dist/modern/component.js +75 -102
  122. package/dist/modern/components/countdown-loader/component.d.ts +1 -1
  123. package/dist/modern/components/countdown-loader/component.js +1 -1
  124. package/dist/modern/components/countdown-loader/index.css +2 -2
  125. package/dist/modern/components/index.d.ts +1 -3
  126. package/dist/modern/components/index.js +11 -10
  127. package/dist/modern/components/screens/fatal-error/component.d.ts +3 -0
  128. package/dist/modern/components/screens/fatal-error/component.js +17 -0
  129. package/dist/modern/components/screens/fatal-error/index.css +61 -0
  130. package/dist/modern/components/{code-input → screens/fatal-error}/index.d.ts +0 -0
  131. package/dist/modern/components/screens/fatal-error/index.js +5 -0
  132. package/dist/modern/components/screens/hint/component.d.ts +3 -0
  133. package/dist/modern/components/screens/hint/component.js +36 -0
  134. package/dist/modern/components/screens/hint/index.css +103 -0
  135. package/dist/modern/components/{countdown → screens/hint}/index.d.ts +0 -0
  136. package/dist/modern/components/screens/hint/index.js +7 -0
  137. package/dist/modern/components/screens/index.d.ts +4 -0
  138. package/dist/modern/components/screens/index.js +15 -0
  139. package/dist/modern/components/screens/initial/component.d.ts +3 -0
  140. package/dist/modern/components/screens/initial/component.js +86 -0
  141. package/dist/modern/components/screens/initial/countdown-section.d.ts +0 -0
  142. package/dist/modern/components/screens/initial/countdown-section.js +7 -0
  143. package/dist/modern/components/screens/initial/index.css +98 -0
  144. package/dist/modern/components/{overlimit → screens/initial}/index.d.ts +0 -0
  145. package/dist/modern/components/screens/initial/index.js +11 -0
  146. package/dist/modern/components/screens/temp-block/component.d.ts +3 -0
  147. package/dist/modern/components/screens/temp-block/component.js +28 -0
  148. package/dist/{esm/components/overlimit → modern/components/screens/temp-block}/index.css +9 -31
  149. package/dist/modern/components/{sign-confirmation → screens/temp-block}/index.d.ts +0 -0
  150. package/dist/modern/components/screens/temp-block/index.js +5 -0
  151. package/dist/modern/context.d.ts +4 -0
  152. package/dist/modern/context.js +23 -0
  153. package/dist/modern/countdown-section-91f055c8.d.ts +9 -0
  154. package/dist/modern/countdown-section-91f055c8.js +32 -0
  155. package/dist/modern/index.css +7 -79
  156. package/dist/modern/index.d.ts +3 -0
  157. package/dist/modern/index.js +12 -10
  158. package/dist/modern/types.d.ts +130 -0
  159. package/dist/modern/types.js +19 -0
  160. package/dist/modern/utils.d.ts +30 -0
  161. package/dist/modern/utils.js +74 -0
  162. package/dist/types.d.ts +130 -0
  163. package/dist/types.js +23 -0
  164. package/dist/utils.d.ts +30 -0
  165. package/dist/utils.js +84 -0
  166. package/package.json +5 -4
  167. package/dist/components/code-input/component.d.ts +0 -16
  168. package/dist/components/code-input/component.js +0 -160
  169. package/dist/components/code-input/index.css +0 -99
  170. package/dist/components/code-input/index.js +0 -13
  171. package/dist/components/code-input/utils.d.ts +0 -10
  172. package/dist/components/code-input/utils.js +0 -21
  173. package/dist/components/countdown/component.d.ts +0 -23
  174. package/dist/components/countdown/component.js +0 -117
  175. package/dist/components/countdown/index.css +0 -85
  176. package/dist/components/countdown/index.js +0 -16
  177. package/dist/components/overlimit/component.d.ts +0 -12
  178. package/dist/components/overlimit/component.js +0 -73
  179. package/dist/components/overlimit/index.js +0 -17
  180. package/dist/components/sign-confirmation/component.d.ts +0 -37
  181. package/dist/components/sign-confirmation/component.js +0 -62
  182. package/dist/components/sign-confirmation/index.css +0 -108
  183. package/dist/components/sign-confirmation/index.js +0 -20
  184. package/dist/cssm/components/code-input/component.d.ts +0 -16
  185. package/dist/cssm/components/code-input/component.js +0 -159
  186. package/dist/cssm/components/code-input/index.js +0 -14
  187. package/dist/cssm/components/code-input/index.module.css +0 -98
  188. package/dist/cssm/components/code-input/utils.d.ts +0 -10
  189. package/dist/cssm/components/code-input/utils.js +0 -21
  190. package/dist/cssm/components/countdown/component.d.ts +0 -23
  191. package/dist/cssm/components/countdown/component.js +0 -117
  192. package/dist/cssm/components/countdown/index.js +0 -18
  193. package/dist/cssm/components/countdown/index.module.css +0 -84
  194. package/dist/cssm/components/overlimit/component.d.ts +0 -12
  195. package/dist/cssm/components/overlimit/component.js +0 -74
  196. package/dist/cssm/components/overlimit/index.js +0 -20
  197. package/dist/cssm/components/sign-confirmation/component.d.ts +0 -37
  198. package/dist/cssm/components/sign-confirmation/component.js +0 -64
  199. package/dist/cssm/components/sign-confirmation/index.js +0 -24
  200. package/dist/esm/components/code-input/component.d.ts +0 -16
  201. package/dist/esm/components/code-input/component.js +0 -151
  202. package/dist/esm/components/code-input/index.css +0 -99
  203. package/dist/esm/components/code-input/index.js +0 -5
  204. package/dist/esm/components/code-input/utils.d.ts +0 -10
  205. package/dist/esm/components/code-input/utils.js +0 -17
  206. package/dist/esm/components/countdown/component.d.ts +0 -23
  207. package/dist/esm/components/countdown/component.js +0 -107
  208. package/dist/esm/components/countdown/index.css +0 -85
  209. package/dist/esm/components/countdown/index.js +0 -7
  210. package/dist/esm/components/overlimit/component.d.ts +0 -12
  211. package/dist/esm/components/overlimit/component.js +0 -65
  212. package/dist/esm/components/overlimit/index.js +0 -9
  213. package/dist/esm/components/sign-confirmation/component.d.ts +0 -37
  214. package/dist/esm/components/sign-confirmation/component.js +0 -53
  215. package/dist/esm/components/sign-confirmation/index.css +0 -108
  216. package/dist/esm/components/sign-confirmation/index.js +0 -12
  217. package/dist/modern/components/code-input/component.d.ts +0 -16
  218. package/dist/modern/components/code-input/component.js +0 -123
  219. package/dist/modern/components/code-input/index.css +0 -99
  220. package/dist/modern/components/code-input/index.js +0 -5
  221. package/dist/modern/components/code-input/utils.d.ts +0 -10
  222. package/dist/modern/components/code-input/utils.js +0 -16
  223. package/dist/modern/components/countdown/component.d.ts +0 -23
  224. package/dist/modern/components/countdown/component.js +0 -102
  225. package/dist/modern/components/countdown/index.css +0 -85
  226. package/dist/modern/components/countdown/index.js +0 -7
  227. package/dist/modern/components/overlimit/component.d.ts +0 -12
  228. package/dist/modern/components/overlimit/component.js +0 -64
  229. package/dist/modern/components/overlimit/index.js +0 -9
  230. package/dist/modern/components/sign-confirmation/component.d.ts +0 -37
  231. package/dist/modern/components/sign-confirmation/component.js +0 -51
  232. package/dist/modern/components/sign-confirmation/index.css +0 -108
  233. package/dist/modern/components/sign-confirmation/index.js +0 -12
@@ -0,0 +1,103 @@
1
+ /* hash: 36cl4 */
2
+ :root {
3
+ --color-light-text-primary: #0b1f35;
4
+ --color-light-text-secondary: #546272;
5
+ }
6
+ :root {
7
+
8
+ /* Hard */
9
+
10
+ /* Up */
11
+
12
+ /* Hard up */
13
+ }
14
+ :root {
15
+ --gap-xs: 8px;
16
+ --gap-xl: 24px;
17
+ --gap-2xl: 32px;
18
+ }
19
+ :root {
20
+ --font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
21
+ sans-serif;
22
+ }
23
+ :root {
24
+ /* title */
25
+ --confirmation-title-font-size: 22px;
26
+ --confirmation-title-line-height: 26px;
27
+ --confirmation-title-font-weight: 700;
28
+ --confirmation-title-font-family: var(--font-family-system);
29
+ --confirmation-title-color: var(--color-light-text-primary);
30
+ --confirmation-title-font-feature-settings: normal;
31
+
32
+ /* text */
33
+ --confirmation-text-font-size: 16px;
34
+ --confirmation-text-line-height: 24px;
35
+ --confirmation-text-font-weight: 400;
36
+ --confirmation-text-font-family: var(--font-family-system);
37
+ --confirmation-text-color: var(--color-light-text-secondary);
38
+
39
+ /* error */
40
+
41
+ /* input */
42
+ }
43
+ .confirmation__center_1td1k .confirmation__phoneHintWrap_1td1k {
44
+ align-items: center;
45
+ }
46
+ .confirmation__center_1td1k .confirmation__hintWrap_1td1k {
47
+ align-items: center;
48
+ }
49
+ .confirmation__hintWrap_1td1k {
50
+ display: flex;
51
+ flex-direction: column;
52
+ align-items: flex-start;
53
+ }
54
+ .confirmation__title_1td1k {
55
+ margin: 0;
56
+ margin-bottom: var(--gap-xl);
57
+ font-size: var(--confirmation-title-font-size);
58
+ line-height: var(--confirmation-title-line-height);
59
+ font-weight: var(--confirmation-title-font-weight);
60
+ font-family: var(--confirmation-title-font-family);
61
+ color: var(--confirmation-title-color);
62
+ font-feature-settings: var(--confirmation-title-font-feature-settings);
63
+ }
64
+ .confirmation__text_1td1k {
65
+ font-size: var(--confirmation-text-font-size);
66
+ line-height: var(--confirmation-text-line-height);
67
+ font-weight: var(--confirmation-text-font-weight);
68
+ font-family: var(--confirmation-text-font-family);
69
+ color: var(--confirmation-text-color);
70
+
71
+ margin-bottom: var(--gap-xl);
72
+ }
73
+ .confirmation__phonesWrap_1td1k {
74
+ font-size: var(--confirmation-text-font-size);
75
+ line-height: var(--confirmation-text-line-height);
76
+ font-weight: var(--confirmation-text-font-weight);
77
+ font-family: var(--confirmation-text-font-family);
78
+ color: var(--confirmation-text-color);
79
+
80
+ display: flex;
81
+ flex-direction: column;
82
+ margin-bottom: var(--gap-xl);
83
+ }
84
+ .confirmation__phoneWrap_1td1k {
85
+ margin-bottom: var(--gap-xs)
86
+ }
87
+ .confirmation__phoneWrap_1td1k:last-child {
88
+ margin-bottom: 0;
89
+ }
90
+ .confirmation__phoneLink_1td1k {
91
+ font-size: 16px;
92
+ line-height: 24px;
93
+ font-weight: 500
94
+ }
95
+ .confirmation__phoneLink_1td1k > span {
96
+ border-bottom: none;
97
+ }
98
+ .confirmation__phoneDescription_1td1k {
99
+ color: var(--confirmation-text-color);
100
+ }
101
+ .confirmation__hintButton_1td1k {
102
+ margin-top: var(--gap-2xl);
103
+ }
@@ -0,0 +1,7 @@
1
+ import 'react';
2
+ import 'classnames';
3
+ import '../../../utils.js';
4
+ import '../../../context.js';
5
+ import '@alfalab/core-components-link/dist/esm';
6
+ import '@alfalab/core-components-button/dist/esm';
7
+ export { Hint } from './component.js';
@@ -0,0 +1,4 @@
1
+ export * from "./initial/index";
2
+ export * from "./hint/index";
3
+ export * from "./fatal-error/index";
4
+ export * from "./temp-block/index";
@@ -0,0 +1,15 @@
1
+ import 'react';
2
+ import 'classnames';
3
+ import '@alfalab/hooks';
4
+ import '../../utils.js';
5
+ import '../../context.js';
6
+ import '@alfalab/core-components-code-input/dist/esm';
7
+ import '@alfalab/core-components-link/dist/esm';
8
+ import '../../countdown-section-ddb744a6.js';
9
+ import '@alfalab/core-components-loader/dist/esm';
10
+ import '@alfalab/core-components-button/dist/esm';
11
+ export { Initial } from './initial/component.js';
12
+ export { Hint } from './hint/component.js';
13
+ export { FatalError } from './fatal-error/component.js';
14
+ import '../countdown-loader/component.js';
15
+ export { TempBlock } from './temp-block/component.js';
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Initial: () => JSX.Element;
3
+ export { Initial };
@@ -0,0 +1,86 @@
1
+ import React, { useContext, useRef, useState, useCallback, useEffect, useLayoutEffect } from 'react';
2
+ import cn from 'classnames';
3
+ import { usePrevious } from '@alfalab/hooks';
4
+ import '../../../utils.js';
5
+ import { ConfirmationContext } from '../../../context.js';
6
+ import { CodeInput } from '@alfalab/core-components-code-input/dist/esm';
7
+ import { Link } from '@alfalab/core-components-link/dist/esm';
8
+ import { s as styles, C as CountdownSection } from '../../../countdown-section-ddb744a6.js';
9
+ import '@alfalab/core-components-loader/dist/esm';
10
+ import '@alfalab/core-components-button/dist/esm';
11
+
12
+ var CODE_SEND_HINT_VISIBLE_DURATION = 2000;
13
+ var Initial = function () {
14
+ var _a = useContext(ConfirmationContext), state = _a.state, alignContent = _a.alignContent, texts = _a.texts, requiredCharAmount = _a.requiredCharAmount, timeLeft = _a.timeLeft, phone = _a.phone, onChangeState = _a.onChangeState, onInputFinished = _a.onInputFinished, onChangeScreen = _a.onChangeScreen, onSmsRetryClick = _a.onSmsRetryClick;
15
+ var prevState = usePrevious(state);
16
+ var inputRef = useRef(null);
17
+ var _b = useState(false), codeSendHintVisible = _b[0], setCodeSendHintVisible = _b[1];
18
+ var timerId = useRef(0);
19
+ var handleInputComplete = function (code) {
20
+ onInputFinished(code);
21
+ };
22
+ var handleSmsHintLinkClick = function () {
23
+ onChangeScreen('HINT');
24
+ };
25
+ var handleInputChange = function () {
26
+ if (state === 'CODE_ERROR') {
27
+ onChangeState('INITIAL');
28
+ }
29
+ };
30
+ var handleSmsRetryClick = function () {
31
+ if (inputRef.current) {
32
+ inputRef.current.reset();
33
+ }
34
+ onSmsRetryClick();
35
+ };
36
+ var clearTimer = useCallback(function () {
37
+ window.clearTimeout(timerId.current);
38
+ }, []);
39
+ useEffect(function () {
40
+ if (inputRef.current) {
41
+ inputRef.current.focus();
42
+ }
43
+ return function () {
44
+ clearTimer();
45
+ };
46
+ }, [clearTimer]);
47
+ useEffect(function () {
48
+ if (!inputRef.current) {
49
+ return;
50
+ }
51
+ if (state === 'CODE_ERROR' && prevState !== 'CODE_ERROR') {
52
+ inputRef.current.focus(requiredCharAmount - 1);
53
+ }
54
+ if (prevState === 'CODE_SENDING' && state !== 'CODE_SENDING') {
55
+ inputRef.current.focus();
56
+ }
57
+ }, [prevState, state, requiredCharAmount]);
58
+ useLayoutEffect(function () {
59
+ if (prevState === 'CODE_SENDING' && state !== 'CODE_SENDING') {
60
+ setCodeSendHintVisible(true);
61
+ clearTimer();
62
+ timerId.current = window.setTimeout(function () {
63
+ setCodeSendHintVisible(false);
64
+ }, CODE_SEND_HINT_VISIBLE_DURATION);
65
+ }
66
+ }, [prevState, state, clearTimer]);
67
+ var getCodeInputError = function () {
68
+ if (state === 'CODE_ERROR') {
69
+ return texts.codeError || true;
70
+ }
71
+ return false;
72
+ };
73
+ var processing = ['CODE_CHECKING', 'CODE_SENDING'].includes(state);
74
+ var timePassed = timeLeft === 0;
75
+ return (React.createElement("div", { className: cn(styles.component, styles[alignContent]) },
76
+ React.createElement("h3", { className: styles.header }, texts.title),
77
+ phone && React.createElement("div", { className: styles.phone },
78
+ "\u041A\u043E\u0434 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u043D\u0430 ",
79
+ phone),
80
+ React.createElement("div", { className: styles.inputContainer },
81
+ React.createElement(CodeInput, { disabled: processing, error: getCodeInputError(), ref: inputRef, fields: requiredCharAmount, className: styles.codeInput, onComplete: handleInputComplete, onChange: handleInputChange })),
82
+ React.createElement(CountdownSection, { processing: processing, timePassed: timePassed, codeSendHintVisible: codeSendHintVisible, handleSmsRetryClick: handleSmsRetryClick }),
83
+ React.createElement(Link, { onClick: handleSmsHintLinkClick, className: styles.smsComeLink, view: 'secondary', pseudo: true }, texts.linkToHint)));
84
+ };
85
+
86
+ export { Initial };
@@ -0,0 +1,7 @@
1
+ import 'react';
2
+ import 'classnames';
3
+ import '../../../utils.js';
4
+ import '../../../context.js';
5
+ export { C as CountdownSection } from '../../../countdown-section-ddb744a6.js';
6
+ import '@alfalab/core-components-loader/dist/esm';
7
+ import '@alfalab/core-components-button/dist/esm';
@@ -0,0 +1,98 @@
1
+ /* hash: 135il */
2
+ :root {
3
+ --color-light-text-primary: #0b1f35;
4
+ }
5
+ :root {
6
+
7
+ /* Hard */
8
+
9
+ /* Up */
10
+
11
+ /* Hard up */
12
+ }
13
+ :root {
14
+ --gap-2xs: 4px;
15
+ --gap-m: 16px;
16
+ --gap-xl: 24px;
17
+ --gap-2xl: 32px;
18
+ --gap-2xs-neg: -4px;
19
+ }
20
+ :root {
21
+ --font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
22
+ sans-serif;
23
+ }
24
+ :root {
25
+ /* title */
26
+ --confirmation-title-font-size: 22px;
27
+ --confirmation-title-line-height: 26px;
28
+ --confirmation-title-font-weight: 700;
29
+ --confirmation-title-font-family: var(--font-family-system);
30
+ --confirmation-title-color: var(--color-light-text-primary);
31
+ --confirmation-title-font-feature-settings: normal;
32
+
33
+ /* text */
34
+
35
+ /* error */
36
+
37
+ /* input */
38
+ }
39
+ .confirmation__component_ntnxq {
40
+ display: flex;
41
+ flex-direction: column;
42
+ }
43
+ .confirmation__header_ntnxq {
44
+ margin: 0;
45
+ margin-bottom: var(--gap-xl);
46
+ font-size: var(--confirmation-title-font-size);
47
+ line-height: var(--confirmation-title-line-height);
48
+ font-weight: var(--confirmation-title-font-weight);
49
+ font-family: var(--confirmation-title-font-family);
50
+ color: var(--confirmation-title-color);
51
+ font-feature-settings: var(--confirmation-title-font-feature-settings);
52
+ }
53
+ .confirmation__phone_ntnxq {
54
+ margin-bottom: var(--gap-2xl);
55
+ color: var(--color-light-text-primary);
56
+ }
57
+ .confirmation__inputContainer_ntnxq {
58
+ display: flex;
59
+ flex-direction: column;
60
+ margin-bottom: var(--gap-2xl);
61
+ }
62
+ .confirmation__compact_ntnxq {
63
+ margin-bottom: var(--gap-xl);
64
+ }
65
+ .confirmation__loaderWrap_ntnxq {
66
+ display: flex;
67
+ align-items: center;
68
+ }
69
+ .confirmation__center_ntnxq {
70
+ align-items: center;
71
+ text-align: center
72
+ }
73
+ .confirmation__center_ntnxq .confirmation__codeInput_ntnxq,
74
+ .confirmation__center_ntnxq .confirmation__loaderWrap_ntnxq {
75
+ justify-content: center;
76
+ }
77
+ .confirmation__smsComeLink_ntnxq {
78
+ font-size: 14px;
79
+ line-height: 20px;
80
+ font-weight: 400;
81
+ }
82
+ .confirmation__countdownContainer_ntnxq {
83
+ margin-bottom: var(--gap-xl);
84
+ }
85
+ .confirmation__getCodeButton_ntnxq {
86
+ position: relative;
87
+ top: var(--gap-2xs-neg);
88
+ margin-bottom: var(--gap-m);
89
+ }
90
+ .confirmation__countdown_ntnxq {
91
+ display: flex;
92
+ }
93
+ .confirmation__countdownTimer_ntnxq {
94
+ display: flex;
95
+ justify-content: flex-start;
96
+ min-width: 45px;
97
+ margin-left: var(--gap-2xs);
98
+ }
@@ -0,0 +1,11 @@
1
+ import 'react';
2
+ import 'classnames';
3
+ import '@alfalab/hooks';
4
+ import '../../../utils.js';
5
+ import '../../../context.js';
6
+ import '@alfalab/core-components-code-input/dist/esm';
7
+ import '@alfalab/core-components-link/dist/esm';
8
+ import '../../../countdown-section-ddb744a6.js';
9
+ import '@alfalab/core-components-loader/dist/esm';
10
+ import '@alfalab/core-components-button/dist/esm';
11
+ export { Initial } from './component.js';
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const TempBlock: () => JSX.Element;
3
+ export { TempBlock };
@@ -0,0 +1,28 @@
1
+ import React, { useContext, useEffect, Fragment } from 'react';
2
+ import { useCountdown, formatMsAsMinutes } from '../../../utils.js';
3
+ import { ConfirmationContext } from '../../../context.js';
4
+ import { CountdownLoader } from '../../countdown-loader/component.js';
5
+
6
+ var styles = {"header":"confirmation__header_1qqfu","description":"confirmation__description_1qqfu","countdownWrap":"confirmation__countdownWrap_1qqfu","loader":"confirmation__loader_1qqfu"};
7
+ require('./index.css')
8
+
9
+ var TempBlock = function () {
10
+ var _a = useContext(ConfirmationContext), texts = _a.texts, tempBlockDuration = _a.tempBlockDuration, onChangeScreen = _a.onChangeScreen, onTempBlockFinished = _a.onTempBlockFinished;
11
+ var _b = useCountdown(tempBlockDuration), timeLeft = _b[0], startTimer = _b[1];
12
+ useEffect(function () {
13
+ startTimer();
14
+ }, [startTimer]);
15
+ useEffect(function () {
16
+ if (timeLeft === 0 && onTempBlockFinished) {
17
+ onTempBlockFinished();
18
+ }
19
+ }, [timeLeft, onChangeScreen, onTempBlockFinished]);
20
+ return (React.createElement(Fragment, null,
21
+ React.createElement("h3", { className: styles.header }, texts.tempBlockTitle),
22
+ React.createElement("div", { className: styles.description }, texts.tempBlockDescription),
23
+ React.createElement("div", { className: styles.countdownWrap },
24
+ React.createElement(CountdownLoader, { progress: 1 - timeLeft / tempBlockDuration, className: styles.loader }),
25
+ formatMsAsMinutes(timeLeft))));
26
+ };
27
+
28
+ export { TempBlock };
@@ -1,7 +1,4 @@
1
- /* hash: 17mjd */
2
- :root {
3
- --color-static-status-red: #d91d0b;
4
- }
1
+ /* hash: 1bdwf */
5
2
  :root {
6
3
  --color-light-text-primary: #0b1f35;
7
4
  --color-light-text-secondary: #546272;
@@ -15,11 +12,9 @@
15
12
  /* Hard up */
16
13
  }
17
14
  :root {
18
- --gap-2xs: 4px;
19
15
  --gap-xs: 8px;
20
16
  --gap-xl: 24px;
21
17
  --gap-2xl: 32px;
22
- --gap-3xl: 40px;
23
18
  }
24
19
  :root {
25
20
  --font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
@@ -45,46 +40,29 @@
45
40
 
46
41
  /* input */
47
42
  }
48
- .confirmation__component_kdbob {
49
- display: flex;
50
- flex-direction: column;
51
- align-items: center;
52
- }
53
- .confirmation__title_kdbob {
43
+ .confirmation__header_1qqfu {
44
+ margin: 0;
45
+ margin-bottom: var(--gap-xl);
54
46
  font-size: var(--confirmation-title-font-size);
55
47
  line-height: var(--confirmation-title-line-height);
56
48
  font-weight: var(--confirmation-title-font-weight);
57
49
  font-family: var(--confirmation-title-font-family);
58
50
  color: var(--confirmation-title-color);
59
51
  font-feature-settings: var(--confirmation-title-font-feature-settings);
60
-
61
- margin-bottom: var(--gap-3xl);
62
52
  }
63
- .confirmation__description_kdbob {
53
+ .confirmation__description_1qqfu {
64
54
  font-size: var(--confirmation-text-font-size);
65
55
  line-height: var(--confirmation-text-line-height);
66
56
  font-weight: var(--confirmation-text-font-weight);
67
57
  font-family: var(--confirmation-text-font-family);
68
58
  color: var(--confirmation-text-color);
59
+
60
+ margin-bottom: var(--gap-2xl);
69
61
  }
70
- .confirmation__countdown_kdbob {
62
+ .confirmation__countdownWrap_1qqfu {
71
63
  display: flex;
72
64
  align-items: center;
73
- justify-content: center;
74
- margin-top: var(--gap-2xs);
75
65
  }
76
- .confirmation__loader_kdbob {
66
+ .confirmation__loader_1qqfu {
77
67
  margin-right: var(--gap-xs);
78
68
  }
79
- .confirmation__timePassed_kdbob {
80
- display: flex;
81
- min-width: 3em;
82
- }
83
- .confirmation__getCodeButton_kdbob {
84
- margin-top: var(--gap-2xl);
85
- }
86
- .confirmation__alertIcon_kdbob {
87
- text-align: center;
88
- margin-bottom: var(--gap-xl);
89
- color: var(--color-static-status-red);
90
- }
@@ -0,0 +1,5 @@
1
+ import 'react';
2
+ import '../../../utils.js';
3
+ import '../../../context.js';
4
+ import '../../countdown-loader/component.js';
5
+ export { TempBlock } from './component.js';
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TConfirmationContext } from "./types";
3
+ declare const ConfirmationContext: import("react").Context<TConfirmationContext>;
4
+ export { ConfirmationContext };
@@ -0,0 +1,23 @@
1
+ import { createContext } from 'react';
2
+ import { ONE_MINUTE, ONE_DAY } from './utils.js';
3
+
4
+ var mockFn = function () { return undefined; };
5
+ var ConfirmationContext = createContext({
6
+ alignContent: 'left',
7
+ texts: {},
8
+ state: 'INITIAL',
9
+ screen: 'INITIAL',
10
+ requiredCharAmount: 5,
11
+ countdownDuration: ONE_MINUTE,
12
+ timeLeft: ONE_MINUTE,
13
+ tempBlockDuration: ONE_DAY,
14
+ phone: '',
15
+ onTempBlockFinished: mockFn,
16
+ onInputFinished: mockFn,
17
+ onChangeState: mockFn,
18
+ onSmsRetryClick: mockFn,
19
+ onChangeScreen: mockFn,
20
+ onFatalErrorOkButtonClick: mockFn,
21
+ });
22
+
23
+ export { ConfirmationContext };
@@ -0,0 +1,9 @@
1
+ import { FC } from 'react';
2
+ type CountdownSectionProps = {
3
+ codeSendHintVisible: boolean;
4
+ timePassed: boolean;
5
+ processing: boolean;
6
+ handleSmsRetryClick: () => void;
7
+ };
8
+ declare const CountdownSection: FC<CountdownSectionProps>;
9
+ export { CountdownSection };
@@ -0,0 +1,33 @@
1
+ import React, { useContext } from 'react';
2
+ import cn from 'classnames';
3
+ import { formatMsAsMinutes } from './utils.js';
4
+ import { ConfirmationContext } from './context.js';
5
+ import { Loader } from '@alfalab/core-components-loader/dist/esm';
6
+ import { Button } from '@alfalab/core-components-button/dist/esm';
7
+
8
+ var styles = {"component":"confirmation__component_ntnxq","header":"confirmation__header_ntnxq","phone":"confirmation__phone_ntnxq","inputContainer":"confirmation__inputContainer_ntnxq","compact":"confirmation__compact_ntnxq","loaderWrap":"confirmation__loaderWrap_ntnxq","center":"confirmation__center_ntnxq","codeInput":"confirmation__codeInput_ntnxq","smsComeLink":"confirmation__smsComeLink_ntnxq","countdownContainer":"confirmation__countdownContainer_ntnxq","getCodeButton":"confirmation__getCodeButton_ntnxq","countdown":"confirmation__countdown_ntnxq","countdownTimer":"confirmation__countdownTimer_ntnxq"};
9
+ require('./components/screens/initial/index.css')
10
+
11
+ var CountdownSection = function (_a) {
12
+ var codeSendHintVisible = _a.codeSendHintVisible, timePassed = _a.timePassed, processing = _a.processing, handleSmsRetryClick = _a.handleSmsRetryClick;
13
+ var _b = useContext(ConfirmationContext), state = _b.state, texts = _b.texts, timeLeft = _b.timeLeft, blockSmsRetry = _b.blockSmsRetry;
14
+ if (codeSendHintVisible) {
15
+ return React.createElement("div", { className: styles.countdownContainer }, texts.codeSended);
16
+ }
17
+ if (processing) {
18
+ return (React.createElement("div", { className: cn(styles.loaderWrap, styles.countdownContainer) },
19
+ React.createElement(Loader, null),
20
+ React.createElement("span", { className: styles.loaderText }, state === 'CODE_CHECKING' ? texts.codeChecking : texts.codeSending)));
21
+ }
22
+ if (blockSmsRetry) {
23
+ return React.createElement("div", { className: styles.countdownContainer }, texts.noAttemptsLeft);
24
+ }
25
+ if (timePassed) {
26
+ return (React.createElement(Button, { size: 'xxs', view: 'secondary', onClick: handleSmsRetryClick, className: styles.getCodeButton }, texts.buttonRetry));
27
+ }
28
+ return (React.createElement("div", { className: cn(styles.countdown, styles.countdownContainer) },
29
+ texts.countdown,
30
+ React.createElement("div", { className: styles.countdownTimer }, formatMsAsMinutes(timeLeft))));
31
+ };
32
+
33
+ export { CountdownSection as C, styles as s };
@@ -1,6 +1,5 @@
1
- /* hash: zgqal */
1
+ /* hash: dh3od */
2
2
  :root {
3
- --color-light-text-primary: #0b1f35;
4
3
  --color-light-text-secondary: #546272;
5
4
  }
6
5
  :root {
@@ -11,24 +10,12 @@
11
10
 
12
11
  /* Hard up */
13
12
  }
14
- :root {
15
- --gap-xs: 8px;
16
- --gap-xl: 24px;
17
- --gap-2xl: 32px;
18
- --gap-4xl: 48px;
19
- }
20
13
  :root {
21
14
  --font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
22
15
  sans-serif;
23
16
  }
24
17
  :root {
25
18
  /* title */
26
- --confirmation-title-font-size: 22px;
27
- --confirmation-title-line-height: 26px;
28
- --confirmation-title-font-weight: 700;
29
- --confirmation-title-font-family: var(--font-family-system);
30
- --confirmation-title-color: var(--color-light-text-primary);
31
- --confirmation-title-font-feature-settings: normal;
32
19
 
33
20
  /* text */
34
21
  --confirmation-text-font-size: 16px;
@@ -41,54 +28,7 @@
41
28
 
42
29
  /* input */
43
30
  }
44
- .confirmation__component_1g9r1 {
45
- display: flex;
46
- flex-direction: column;
47
- width: 100%;
48
- font-family: var(--confirmation-font-family);
49
- }
50
- .confirmation__error_1g9r1 {
51
- display: flex;
52
- flex-direction: column;
53
- align-items: flex-start;
54
- }
55
- .confirmation__errorHeader_1g9r1 {
56
- font-size: var(--confirmation-title-font-size);
57
- line-height: var(--confirmation-title-line-height);
58
- font-weight: var(--confirmation-title-font-weight);
59
- font-family: var(--confirmation-title-font-family);
60
- color: var(--confirmation-title-color);
61
- font-feature-settings: var(--confirmation-title-font-feature-settings);
62
-
63
- margin-bottom: var(--gap-2xl);
64
- color: var(--confirmation-title-color);
65
- }
66
- .confirmation__errorText_1g9r1 {
67
- font-size: var(--confirmation-text-font-size);
68
- line-height: var(--confirmation-text-line-height);
69
- font-weight: var(--confirmation-text-font-weight);
70
- font-family: var(--confirmation-text-font-family);
71
- color: var(--confirmation-text-color);
72
-
73
- margin-bottom: var(--gap-2xl);
74
- color: var(--confirmation-text-color);
75
- }
76
- .confirmation__phoneHintWrap_1g9r1 {
77
- display: flex;
78
- flex-direction: column;
79
- align-items: flex-start;
80
- }
81
- .confirmation__phoneHintText_1g9r1 {
82
- font-size: var(--confirmation-text-font-size);
83
- line-height: var(--confirmation-text-line-height);
84
- font-weight: var(--confirmation-text-font-weight);
85
- font-family: var(--confirmation-text-font-family);
86
- color: var(--confirmation-text-color);
87
-
88
- margin-bottom: var(--gap-xl);
89
- color: var(--confirmation-text-color);
90
- }
91
- .confirmation__phonesWrap_1g9r1 {
31
+ .confirmation__component_1lhb7 {
92
32
  font-size: var(--confirmation-text-font-size);
93
33
  line-height: var(--confirmation-text-line-height);
94
34
  font-weight: var(--confirmation-text-font-weight);
@@ -97,23 +37,11 @@
97
37
 
98
38
  display: flex;
99
39
  flex-direction: column;
100
- margin-bottom: var(--gap-4xl);
101
- }
102
- .confirmation__phoneWrap_1g9r1 {
103
- margin-bottom: var(--gap-xs)
104
- }
105
- .confirmation__phoneWrap_1g9r1:last-child {
106
- margin-bottom: 0;
107
- }
108
- .confirmation__phoneDescription_1g9r1 {
109
- color: var(--confirmation-text-color);
40
+ width: 100%;
41
+ max-width: 400px;
42
+ margin: 0 auto;
110
43
  }
111
- .confirmation__component_1g9r1.confirmation__center_1g9r1 {
44
+ .confirmation__center_1lhb7 {
45
+ align-items: center;
112
46
  text-align: center;
113
47
  }
114
- .confirmation__center_1g9r1 .confirmation__phoneHintWrap_1g9r1 {
115
- align-items: center;
116
- }
117
- .confirmation__center_1g9r1 .confirmation__error_1g9r1 {
118
- align-items: center;
119
- }
@@ -1,2 +1,5 @@
1
1
  export * from "./component";
2
2
  export * from "./components/index";
3
+ export * from "./context";
4
+ export * from "./types";
5
+ export * from "./utils";