@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,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/modern';
7
+ import '@alfalab/core-components-link/dist/modern';
8
+ import '../../../countdown-section-91f055c8.js';
9
+ import '@alfalab/core-components-loader/dist/modern';
10
+ import '@alfalab/core-components-button/dist/modern';
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
+ const TempBlock = () => {
10
+ const { texts, tempBlockDuration, onChangeScreen, onTempBlockFinished } = useContext(ConfirmationContext);
11
+ const [timeLeft, startTimer] = useCountdown(tempBlockDuration);
12
+ useEffect(() => {
13
+ startTimer();
14
+ }, [startTimer]);
15
+ useEffect(() => {
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
+ const mockFn = () => undefined;
5
+ const 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,32 @@
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/modern';
6
+ import { Button } from '@alfalab/core-components-button/dist/modern';
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
+ const CountdownSection = ({ codeSendHintVisible, timePassed, processing, handleSmsRetryClick, }) => {
12
+ const { state, texts, timeLeft, blockSmsRetry } = useContext(ConfirmationContext);
13
+ if (codeSendHintVisible) {
14
+ return React.createElement("div", { className: styles.countdownContainer }, texts.codeSended);
15
+ }
16
+ if (processing) {
17
+ return (React.createElement("div", { className: cn(styles.loaderWrap, styles.countdownContainer) },
18
+ React.createElement(Loader, null),
19
+ React.createElement("span", { className: styles.loaderText }, state === 'CODE_CHECKING' ? texts.codeChecking : texts.codeSending)));
20
+ }
21
+ if (blockSmsRetry) {
22
+ return React.createElement("div", { className: styles.countdownContainer }, texts.noAttemptsLeft);
23
+ }
24
+ if (timePassed) {
25
+ return (React.createElement(Button, { size: 'xxs', view: 'secondary', onClick: handleSmsRetryClick, className: styles.getCodeButton }, texts.buttonRetry));
26
+ }
27
+ return (React.createElement("div", { className: cn(styles.countdown, styles.countdownContainer) },
28
+ texts.countdown,
29
+ React.createElement("div", { className: styles.countdownTimer }, formatMsAsMinutes(timeLeft))));
30
+ };
31
+
32
+ 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";
@@ -1,15 +1,17 @@
1
1
  import 'react';
2
2
  import 'classnames';
3
- import '@alfalab/core-components-button/dist/modern';
4
- import '@alfalab/core-components-link/dist/modern';
5
- import '@alfalab/utils';
6
3
  import '@alfalab/hooks';
7
- export { CountdownLoader } from './components/countdown-loader/component.js';
8
- export { Countdown, formatMsAsMinutes } from './components/countdown/component.js';
4
+ export { ONE_DAY, ONE_MINUTE, formatMsAsMinutes, useConfirmation, useCountdown } from './utils.js';
5
+ export { ConfirmationContext } from './context.js';
6
+ export { defaultTexts } from './types.js';
7
+ import '@alfalab/core-components-code-input/dist/modern';
8
+ import '@alfalab/core-components-link/dist/modern';
9
+ import './countdown-section-91f055c8.js';
9
10
  import '@alfalab/core-components-loader/dist/modern';
10
- import './components/code-input/utils.js';
11
- import './components/code-input/component.js';
12
- export { SignConfirmation } from './components/sign-confirmation/component.js';
13
- import '@alfalab/icons-glyph';
14
- export { Overlimit } from './components/overlimit/component.js';
11
+ import '@alfalab/core-components-button/dist/modern';
12
+ export { Initial } from './components/screens/initial/component.js';
13
+ export { Hint } from './components/screens/hint/component.js';
14
+ export { FatalError } from './components/screens/fatal-error/component.js';
15
+ export { CountdownLoader } from './components/countdown-loader/component.js';
16
+ export { TempBlock } from './components/screens/temp-block/component.js';
15
17
  export { Confirmation } from './component.js';
@@ -0,0 +1,130 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ type ConfirmationProps = {
3
+ /**
4
+ * Экран компонента
5
+ */
6
+ screen: ConfirmationScreen | string;
7
+ /**
8
+ * Состояние компонента
9
+ */
10
+ state: ConfirmationState | string;
11
+ /**
12
+ * Позиционирование контента
13
+ */
14
+ alignContent?: 'left' | 'center';
15
+ /**
16
+ * Объект с текстами
17
+ */
18
+ texts?: ConfirmationTexts;
19
+ /**
20
+ * Количество символов, которое можно ввести в поле ввода подписания до того, как произойдет автоотправка
21
+ */
22
+ requiredCharAmount?: number;
23
+ /**
24
+ * Длительность обратного отсчета на кнопке повторного запроса сообщения, в милисекундах
25
+ */
26
+ countdownDuration?: number;
27
+ /**
28
+ * Продолжительность блокировки формы (ms)
29
+ */
30
+ tempBlockDuration?: number;
31
+ /**
32
+ * Номер телефона, на который отправлен код
33
+ */
34
+ phone?: string;
35
+ /**
36
+ * Не осталось попыток ввода кода
37
+ */
38
+ blockSmsRetry?: boolean;
39
+ /**
40
+ * Идентификатор для систем автоматизированного тестирования
41
+ */
42
+ dataTestId?: string;
43
+ /**
44
+ * Сss класс для стилизации общей обёртки
45
+ */
46
+ className?: string;
47
+ /**
48
+ * Функция обновления состояния компонента
49
+ */
50
+ onChangeState: (state: ConfirmationState | string) => void;
51
+ /**
52
+ * Функция обновления состояния компонента
53
+ */
54
+ onChangeScreen: (state: ConfirmationScreen | string) => void;
55
+ /**
56
+ * Обработчик события завершения ввода кода подписания
57
+ */
58
+ onInputFinished: (code: string) => void;
59
+ /**
60
+ * Обработчик события нажатия на кнопку "Запросить код"
61
+ */
62
+ onSmsRetryClick: () => void;
63
+ /**
64
+ * Клик по кнопке "Понятно" на экране фатальной ошибки
65
+ */
66
+ onFatalErrorOkButtonClick?: () => void;
67
+ /**
68
+ * Временная блокировка формы закончилась
69
+ */
70
+ onTempBlockFinished?: () => void;
71
+ /**
72
+ * Возввращает объект, где ключ - название экрана (screen), значение - компонент для экрана
73
+ */
74
+ getScreensMap?: (defaulScreensMap: ScreensMap) => ScreensMap;
75
+ };
76
+ type TConfirmationContext = Required<Pick<ConfirmationProps, 'alignContent' | 'texts' | 'state' | 'screen' | 'requiredCharAmount' | 'onInputFinished' | 'countdownDuration' | 'onChangeState' | 'onSmsRetryClick' | 'onChangeScreen' | 'onFatalErrorOkButtonClick' | 'tempBlockDuration'>> & Pick<ConfirmationProps, 'phone' | 'blockSmsRetry' | 'onTempBlockFinished'> & {
77
+ timeLeft: number;
78
+ };
79
+ type ConfirmationTexts = {
80
+ /**
81
+ * Экран INITIAL
82
+ */
83
+ title?: ReactNode;
84
+ codeError?: string;
85
+ codeChecking?: string;
86
+ codeSending?: string;
87
+ codeSended?: string;
88
+ buttonRetry?: string;
89
+ linkToHint?: string;
90
+ noAttemptsLeft?: string;
91
+ countdown?: string;
92
+ /**
93
+ * Экран HINT
94
+ */
95
+ hintButton?: string;
96
+ /**
97
+ * Экран FATAL_ERROR
98
+ */
99
+ fatalErrorTitle?: ReactNode;
100
+ fatalErrorDescription?: ReactNode;
101
+ fatalErrorButton?: string;
102
+ /**
103
+ * Экран TEMP_BLOCK
104
+ */
105
+ tempBlockTitle?: ReactNode;
106
+ tempBlockDescription?: ReactNode;
107
+ };
108
+ type ConfirmationScreen = 'INITIAL' | 'HINT' | 'FATAL_ERROR' | 'TEMP_BLOCK';
109
+ type ConfirmationState = 'INITIAL' | 'CODE_CHECKING' | 'CODE_SENDING' | 'CODE_ERROR';
110
+ type ScreensMap = {
111
+ [key: string]: ComponentType;
112
+ };
113
+ declare const defaultTexts: {
114
+ title: string;
115
+ codeError: string;
116
+ codeChecking: string;
117
+ codeSending: string;
118
+ buttonRetry: string;
119
+ linkToHint: string;
120
+ hintButton: string;
121
+ noAttemptsLeft: string;
122
+ fatalErrorTitle: string;
123
+ fatalErrorDescription: string;
124
+ fatalErrorButton: string;
125
+ tempBlockTitle: string;
126
+ tempBlockDescription: string;
127
+ codeSended: string;
128
+ countdown: string;
129
+ };
130
+ export { ConfirmationProps, TConfirmationContext, ConfirmationTexts, ConfirmationScreen, ConfirmationState, ScreensMap, defaultTexts };
@@ -0,0 +1,19 @@
1
+ const defaultTexts = {
2
+ title: 'Введите код из\xa0сообщения',
3
+ codeError: 'Код введён неверно',
4
+ codeChecking: '',
5
+ codeSending: '',
6
+ buttonRetry: 'Запросить код повторно',
7
+ linkToHint: 'Не\xa0приходит сообщение?',
8
+ hintButton: 'Вернуться к\xa0вводу кода',
9
+ noAttemptsLeft: 'Не\xa0осталось попыток запроса кода',
10
+ fatalErrorTitle: 'Ввести код больше нельзя',
11
+ fatalErrorDescription: 'Вы\xa0ввели код неверно более 5\xa0раз. В\xa0целях безопасности мы\xa0ограничили дальнейший ввод.',
12
+ fatalErrorButton: 'Понятно',
13
+ tempBlockTitle: 'Превышено количество попыток запроса кода',
14
+ tempBlockDescription: 'Повторное подтверждение кодом будет возможно через 24\xa0часа',
15
+ codeSended: 'Код выслан',
16
+ countdown: 'Запросить повторно можно через',
17
+ };
18
+
19
+ export { defaultTexts };
@@ -0,0 +1,30 @@
1
+ /// <reference types="react" />
2
+ import { ConfirmationProps } from "./types";
3
+ /**
4
+ * Форматирование миллисекунд в hh:mm:ss.
5
+ *
6
+ * @param {Number} ms миллисекунды
7
+ * @returns {String} время в формате mm:ss
8
+ */
9
+ declare function formatMsAsMinutes(ms: number): string;
10
+ type UseCountdown = (countdownDuration: number, tick?: number) => [number, () => void, () => void];
11
+ /**
12
+ * Возвращает время, которое осталось до истечения таймера в ms
13
+ */
14
+ declare const useCountdown: UseCountdown;
15
+ declare const ONE_DAY: number;
16
+ declare const ONE_MINUTE: number;
17
+ type UseConfirmationParams = {
18
+ state?: ConfirmationProps['state'];
19
+ screen?: ConfirmationProps['screen'];
20
+ blockSmsRetry?: ConfirmationProps['blockSmsRetry'];
21
+ };
22
+ declare const useConfirmation: ({ state, screen, blockSmsRetry }?: UseConfirmationParams) => {
23
+ confirmationState: string;
24
+ confirmationScreen: string;
25
+ confirmationBlockSmsRetry: boolean;
26
+ setConfirmationState: import("react").Dispatch<import("react").SetStateAction<string>>;
27
+ setConfirmationScreen: import("react").Dispatch<import("react").SetStateAction<string>>;
28
+ setConfirmationBlockSmsRetry: import("react").Dispatch<import("react").SetStateAction<boolean>>;
29
+ };
30
+ export { formatMsAsMinutes, useCountdown, ONE_DAY, ONE_MINUTE, useConfirmation };