@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
package/CHANGELOG.md CHANGED
@@ -3,6 +3,65 @@
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
+ # [10.0.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-confirmation@9.0.7...@alfalab/core-components-confirmation@10.0.0) (2022-02-16)
7
+
8
+
9
+ ### Features
10
+
11
+ * **confirmation:** большое обновление компонента ([#958](https://github.com/alfa-laboratory/core-components/issues/958)) ([3e61e7e](https://github.com/alfa-laboratory/core-components/commit/3e61e7e6529662d8fb96acb2898a29fd9c1917ab))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * **confirmation:** Удалена пропса code
17
+
18
+ * feat(code-input): ref updates
19
+
20
+ * feat(confirmation): updates, fix tests
21
+
22
+ * feat(confirmation): initial
23
+
24
+ * feat(confirmation): updates
25
+
26
+ * feat(confirmation): update tests
27
+
28
+ * feat(confirmation): updates
29
+
30
+ * feat(confirmation): dont reset code, if error
31
+
32
+ * test(confirmation): update snapshot
33
+ * **confirmation:** Удалена пропса code
34
+
35
+ Co-authored-by: reme3d2y <AYatsenko@alfabank.ru>
36
+
37
+
38
+
39
+
40
+
41
+ ## [9.0.7](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-confirmation@9.0.6...@alfalab/core-components-confirmation@9.0.7) (2022-02-15)
42
+
43
+ **Note:** Version bump only for package @alfalab/core-components-confirmation
44
+
45
+
46
+
47
+
48
+
49
+ ## [9.0.6](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-confirmation@9.0.5...@alfalab/core-components-confirmation@9.0.6) (2022-02-09)
50
+
51
+ **Note:** Version bump only for package @alfalab/core-components-confirmation
52
+
53
+
54
+
55
+
56
+
57
+ ## [9.0.5](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-confirmation@9.0.4...@alfalab/core-components-confirmation@9.0.5) (2022-02-03)
58
+
59
+ **Note:** Version bump only for package @alfalab/core-components-confirmation
60
+
61
+
62
+
63
+
64
+
6
65
  ## [9.0.4](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-confirmation@9.0.3...@alfalab/core-components-confirmation@9.0.4) (2022-02-02)
7
66
 
8
67
  **Note:** Version bump only for package @alfalab/core-components-confirmation
@@ -1,164 +1,4 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- import { ReactNode } from "react";
4
- type ContentAlign = 'left' | 'center';
5
- type ConfirmationProps = {
6
- /**
7
- * Значение поля ввода
8
- */
9
- code: string;
10
- /**
11
- * Флаг состояния обработки введенного кода.
12
- */
13
- codeChecking?: boolean;
14
- /**
15
- * Флаг состояния отправки кода.
16
- */
17
- codeSending?: boolean;
18
- /**
19
- * Состояние ошибки подписания
20
- */
21
- error?: boolean;
22
- /**
23
- * Состояние ошибки лимитов - превышено кол-во попыток ввода или запросов кода
24
- */
25
- errorOverlimit?: boolean;
26
- /**
27
- * Состояние критической ошибки лимитов - превышены все лимиты и попытки, пользователя блокируют
28
- */
29
- errorOverlimitIsFatal?: boolean;
30
- /**
31
- * Текст ошибки подписания
32
- */
33
- errorText?: string;
34
- /**
35
- * Дополнительный контент
36
- */
37
- additionalContent?: ReactNode;
38
- /**
39
- * Флаг критичности ошибки подписания.
40
- * Если true - ошибка подписания рисуется на экране без поля ввода, но с кнопкой "Запросить код"
41
- * Если false - ошибка подписания рисуется под полем ввода кода
42
- */
43
- errorIsFatal?: boolean;
44
- /**
45
- * Дополнительный класс
46
- */
47
- className?: string;
48
- /**
49
- * Номер телефона, на который отправляется сообщение.
50
- */
51
- phone?: string;
52
- /**
53
- * Управление необходимостью маскировать номер телефона
54
- */
55
- hasPhoneMask?: boolean;
56
- /**
57
- * Количество символов, которое можно ввести в поле ввода подписания до того, как произойдет автоотправка
58
- */
59
- requiredCharAmount?: number;
60
- /**
61
- * Управление отображением таймера с кнопкой "Запросить код"
62
- */
63
- hasSmsCountdown?: boolean;
64
- /**
65
- * Длительность обратного отсчета на кнопке повторного запроса сообщения, в милисекундах
66
- */
67
- countdownDuration?: number;
68
- /**
69
- * Заголовок экрана подписания
70
- */
71
- signTitle?: string | React.ReactNode;
72
- /**
73
- * Заголовок экрана ошибки лимитов
74
- */
75
- overlimitTitle?: string;
76
- /**
77
- * Текстовое описание блокировки формы при превышении лимитов
78
- */
79
- overlimitText?: string;
80
- /**
81
- * Длительно блокировки при превышении лимитов, в милисекундах
82
- */
83
- overlimitCountdownDuration?: number;
84
- /**
85
- * Заголовок экрана блокирующей ошибки
86
- */
87
- errorTitle?: string;
88
- /**
89
- * Идентификатор для систем автоматизированного тестирования
90
- */
91
- dataTestId?: string;
92
- /**
93
- * Текст лоадера при проверке кода
94
- */
95
- codeCheckingText?: string;
96
- /**
97
- * Текст лоадера при отправке кода
98
- */
99
- codeSendingText?: string;
100
- /**
101
- * Текст кнопки при блокирующей ошибке
102
- */
103
- buttonErrorText?: string;
104
- /**
105
- * Текст кнопки "Вернуться назад" на экране помощи
106
- */
107
- buttonReturnText?: string;
108
- /**
109
- * Текст кнопки "Запросить новый код"
110
- */
111
- buttonRetryText?: string;
112
- /**
113
- * Позиционирование контента
114
- */
115
- alignContent?: ContentAlign;
116
- /**
117
- * Сообщение, если не осталось попыток ввода кода.
118
- * Кнопка повторной отправки смс при этом скрывается.
119
- */
120
- noAttemptsLeftMessage?: string;
121
- /**
122
- * Кастомный контент для компонента Countdown
123
- */
124
- countdownContent?: ReactNode;
125
- /**
126
- * Обработчик события завершения ввода кода подписания
127
- */
128
- onInputFinished: ({ code }: {
129
- code: string;
130
- }) => void;
131
- /**
132
- * Обработчик события изменения значения поля ввода кода подписания
133
- */
134
- onInputChange: ({ code }: {
135
- code: string;
136
- }) => void;
137
- /**
138
- * Обработчик события нажатия на кнопку "Запросить код"
139
- */
140
- onSmsRetryClick: () => void;
141
- /**
142
- * Обработчик события нажатия на кнопку "Запросить код" в блоке превышение лимитов
143
- */
144
- onOverlimitSmsRetryClick?: () => void;
145
- /**
146
- * Обработчик события завершения обратного отсчета для повторного запроса сообщения
147
- */
148
- onCountdownFinished?: () => void;
149
- /**
150
- * Обработчик события завершения обратного отсчета для блокировки формы
151
- */
152
- onOverlimitCountdownFinished?: () => void;
153
- /**
154
- * Обработчик события нажатия на ссылку "не приходит сообщение?"
155
- */
156
- onSmsHintLinkClick?: () => void;
157
- /**
158
- * Обработчик события нажатия на кнопку buttonErrorText (по дефолту "Понятно"), которая появляется при критической ошибке.
159
- * Если не передан, то вызывается onSmsRetryClick
160
- */
161
- onActionWithFatalError?: () => void;
162
- };
163
- declare const Confirmation: React.ForwardRefExoticComponent<ConfirmationProps & React.RefAttributes<HTMLDivElement>>;
164
- export { ContentAlign, ConfirmationProps, Confirmation };
1
+ import { FC } from 'react';
2
+ import { ConfirmationProps } from "./types";
3
+ declare const Confirmation: FC<ConfirmationProps>;
4
+ export { Confirmation };
package/dist/component.js CHANGED
@@ -4,120 +4,132 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var cn = require('classnames');
7
- var coreComponentsButton = require('@alfalab/core-components-button');
8
- var coreComponentsLink = require('@alfalab/core-components-link');
9
- require('@alfalab/utils');
10
- require('@alfalab/hooks');
11
- require('./components/countdown-loader/component.js');
12
- require('./components/countdown/component.js');
7
+ var hooks = require('@alfalab/hooks');
8
+ var utils = require('./utils.js');
9
+ var context = require('./context.js');
10
+ var types = require('./types.js');
11
+ require('@alfalab/core-components-code-input');
12
+ require('@alfalab/core-components-link');
13
+ require('./countdown-section-2edac0a0.js');
13
14
  require('@alfalab/core-components-loader');
14
- require('./components/code-input/component.js');
15
- require('./components/code-input/utils.js');
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');
15
+ require('@alfalab/core-components-button');
16
+ var components_screens_initial_component = require('./components/screens/initial/component.js');
17
+ var components_screens_hint_component = require('./components/screens/hint/component.js');
18
+ var components_screens_fatalError_component = require('./components/screens/fatal-error/component.js');
19
+ require('./components/countdown-loader/component.js');
20
+ var components_screens_tempBlock_component = require('./components/screens/temp-block/component.js');
19
21
 
20
22
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
23
 
22
24
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
25
  var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
24
26
 
25
- var styles = {"component":"confirmation__component_1g9r1","error":"confirmation__error_1g9r1","errorHeader":"confirmation__errorHeader_1g9r1","errorText":"confirmation__errorText_1g9r1","phoneHintWrap":"confirmation__phoneHintWrap_1g9r1","phoneHintText":"confirmation__phoneHintText_1g9r1","phonesWrap":"confirmation__phonesWrap_1g9r1","phoneWrap":"confirmation__phoneWrap_1g9r1","phoneDescription":"confirmation__phoneDescription_1g9r1","center":"confirmation__center_1g9r1"};
26
- require('./index.css')
27
+ /*! *****************************************************************************
28
+ Copyright (c) Microsoft Corporation.
27
29
 
28
- var Confirmation = React.forwardRef(function (_a, ref) {
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;
35
- var nonFatalError = errorIsFatal ? '' : errorText;
36
- var inputRef = React.useRef(null);
37
- var handleSmsRetryClick = React.useCallback(function () {
38
- onSmsRetryClick();
39
- }, [onSmsRetryClick]);
40
- var handleOverlimitSmsRetryClick = React.useCallback(function () {
41
- if (onOverlimitSmsRetryClick) {
42
- onOverlimitSmsRetryClick();
43
- }
44
- }, [onOverlimitSmsRetryClick]);
45
- var handleSmsRetryFromHintClick = React.useCallback(function () {
46
- setShowHint(false);
47
- if (!noAttemptsLeftMessage) {
48
- onSmsRetryClick();
49
- }
50
- }, [onSmsRetryClick, noAttemptsLeftMessage]);
51
- var handleCountdownFinished = React.useCallback(function () {
52
- if (onCountdownFinished) {
53
- onCountdownFinished();
54
- }
55
- }, [onCountdownFinished]);
56
- var handleOverlimitCountdownFinished = React.useCallback(function () {
57
- if (onOverlimitCountdownFinished) {
58
- onOverlimitCountdownFinished();
59
- }
60
- }, [onOverlimitCountdownFinished]);
61
- var handleSmsHintLinkClick = React.useCallback(function () {
62
- setShowHint(true);
63
- if (onSmsHintLinkClick) {
64
- onSmsHintLinkClick();
30
+ Permission to use, copy, modify, and/or distribute this software for any
31
+ purpose with or without fee is hereby granted.
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
34
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
35
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
36
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
37
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
38
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39
+ PERFORMANCE OF THIS SOFTWARE.
40
+ ***************************************************************************** */
41
+ var __assign = function () {
42
+ __assign = Object.assign || function __assign(t) {
43
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
44
+ s = arguments[i];
45
+ for (var p in s)
46
+ if (Object.prototype.hasOwnProperty.call(s, p))
47
+ t[p] = s[p];
65
48
  }
66
- }, [onSmsHintLinkClick]);
67
- var handleErrorSmsRetryClick = React.useCallback(function () {
68
- if (onActionWithFatalError) {
69
- onActionWithFatalError();
49
+ return t;
50
+ };
51
+ return __assign.apply(this, arguments);
52
+ };
53
+ function __rest(s, e) {
54
+ var t = {};
55
+ for (var p in s)
56
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
57
+ t[p] = s[p];
58
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
59
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
60
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
61
+ t[p[i]] = s[p[i]];
70
62
  }
71
- else {
72
- onSmsRetryClick();
63
+ return t;
64
+ }
65
+
66
+ var styles = {"component":"confirmation__component_1lhb7","center":"confirmation__center_1lhb7"};
67
+ require('./index.css')
68
+
69
+ var confirmationScreens = {
70
+ INITIAL: components_screens_initial_component.Initial,
71
+ HINT: components_screens_hint_component.Hint,
72
+ FATAL_ERROR: components_screens_fatalError_component.FatalError,
73
+ TEMP_BLOCK: components_screens_tempBlock_component.TempBlock,
74
+ };
75
+ var Confirmation = function (_a) {
76
+ var state = _a.state, screen = _a.screen, _b = _a.alignContent, alignContent = _b === void 0 ? 'left' : _b, children = _a.children, _c = _a.requiredCharAmount, requiredCharAmount = _c === void 0 ? 5 : _c, _d = _a.countdownDuration, countdownDuration = _d === void 0 ? utils.ONE_MINUTE : _d, _e = _a.tempBlockDuration, tempBlockDuration = _e === void 0 ? utils.ONE_DAY : _e, phone = _a.phone, blockSmsRetry = _a.blockSmsRetry, dataTestId = _a.dataTestId, className = _a.className, getScreensMap = _a.getScreensMap, onInputFinished = _a.onInputFinished, onChangeState = _a.onChangeState, onSmsRetryClick = _a.onSmsRetryClick, onChangeScreen = _a.onChangeScreen, onFatalErrorOkButtonClick = _a.onFatalErrorOkButtonClick, onTempBlockFinished = _a.onTempBlockFinished, restProps = __rest(_a, ["state", "screen", "alignContent", "children", "requiredCharAmount", "countdownDuration", "tempBlockDuration", "phone", "blockSmsRetry", "dataTestId", "className", "getScreensMap", "onInputFinished", "onChangeState", "onSmsRetryClick", "onChangeScreen", "onFatalErrorOkButtonClick", "onTempBlockFinished"]);
77
+ var _f = utils.useCountdown(countdownDuration), timeLeft = _f[0], startTimer = _f[1], stopTimer = _f[2];
78
+ var prevState = hooks.usePrevious(state);
79
+ React.useEffect(function () {
80
+ startTimer();
81
+ }, [startTimer]);
82
+ React.useEffect(function () {
83
+ /**
84
+ * Перезапускаем таймер после повторного запроса кода
85
+ */
86
+ if (state === 'INITIAL' && prevState === 'CODE_SENDING') {
87
+ startTimer();
73
88
  }
74
- }, [onActionWithFatalError, onSmsRetryClick]);
89
+ }, [state, prevState, startTimer]);
75
90
  React.useEffect(function () {
76
- if (inputRef.current) {
77
- inputRef.current.focus();
91
+ /**
92
+ * Останавливаем таймер, если новый экран/состояние не содержит таймер
93
+ */
94
+ if (!['INITIAL', 'HINT'].includes(screen) || blockSmsRetry) {
95
+ stopTimer();
96
+ }
97
+ }, [state, screen, blockSmsRetry, stopTimer]);
98
+ var handleSmsRetry = function () {
99
+ onChangeState('CODE_SENDING');
100
+ onSmsRetryClick();
101
+ };
102
+ var handleInputFinished = function (code) {
103
+ onChangeState('CODE_CHECKING');
104
+ onInputFinished(code);
105
+ };
106
+ var handleFatalErrorOkButtonClick = function () {
107
+ if (onFatalErrorOkButtonClick) {
108
+ onFatalErrorOkButtonClick();
78
109
  }
79
- }, []);
80
- return (React__default['default'].createElement("div", { className: cn__default['default'](styles.component, styles[alignContent], className), ref: ref, "data-test-id": dataTestId },
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 })),
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, role: 'alert' },
84
- React__default['default'].createElement("span", { className: styles.errorHeader }, errorTitle),
85
- React__default['default'].createElement("span", { className: styles.errorText }, errorText),
86
- React__default['default'].createElement(coreComponentsButton.Button, { size: 'xs', view: 'secondary', onClick: handleErrorSmsRetryClick }, buttonErrorText))),
87
- shouldShowHint && (React__default['default'].createElement("div", { className: styles.phoneHintWrap },
88
- React__default['default'].createElement("span", { className: styles.errorHeader }, "\u041D\u0435\u00A0\u043F\u0440\u0438\u0445\u043E\u0434\u0438\u0442 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435?"),
89
- React__default['default'].createElement("span", { className: styles.phoneHintText }, "\u0415\u0441\u043B\u0438 \u0443\u00A0\u0432\u0430\u0441 \u0441\u043C\u0435\u043D\u0438\u043B\u0441\u044F \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430, \u043F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u0432\u00A0\u043B\u044E\u0431\u043E\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435 \u0431\u0430\u043D\u043A\u0430."),
90
- React__default['default'].createElement("div", { className: styles.phonesWrap },
91
- React__default['default'].createElement("div", { className: styles.phoneWrap },
92
- React__default['default'].createElement(coreComponentsLink.Link, { className: styles.phoneLink, href: 'tel:+78002000000' }, "8 800 200-00-00"),
93
- React__default['default'].createElement("span", { className: styles.phoneDescription },
94
- ' ',
95
- "\u2014\u00A0\u0434\u043B\u044F \u0437\u0432\u043E\u043D\u043A\u043E\u0432 \u043F\u043E\u00A0\u0420\u043E\u0441\u0441\u0438\u0438")),
96
- React__default['default'].createElement("div", { className: styles.phoneWrap },
97
- React__default['default'].createElement(coreComponentsLink.Link, { className: styles.phoneLink, href: 'tel:+74957888878' }, "+7 495 788-88-78"),
98
- React__default['default'].createElement("span", { className: styles.phoneDescription },
99
- ' ',
100
- "\u2014\u00A0\u0432\u00A0\u041C\u043E\u0441\u043A\u0432\u0435 \u0438\u00A0\u0437\u0430\u00A0\u0433\u0440\u0430\u043D\u0438\u0446\u0435\u0439"))),
101
- React__default['default'].createElement(coreComponentsButton.Button, { className: styles.repeatButton, size: 'xs', view: 'secondary', onClick: handleSmsRetryFromHintClick }, buttonReturnText)))));
102
- });
103
- /**
104
- * Для отображения в сторибуке
105
- */
106
- Confirmation.defaultProps = {
107
- countdownDuration: 60000,
108
- errorTitle: 'Превышено количество попыток ввода кода',
109
- hasPhoneMask: true,
110
- hasSmsCountdown: true,
111
- requiredCharAmount: 5,
112
- signTitle: 'Введите код из\xa0сообщения',
113
- codeSending: false,
114
- codeChecking: false,
115
- codeCheckingText: 'Проверка кода',
116
- codeSendingText: 'Отправляем код',
117
- buttonErrorText: 'Понятно',
118
- buttonReturnText: 'Вернуться назад',
119
- buttonRetryText: 'Запросить новый код',
120
- alignContent: 'left',
110
+ };
111
+ var contextValue = {
112
+ alignContent: alignContent,
113
+ texts: __assign(__assign({}, types.defaultTexts), restProps.texts),
114
+ state: state,
115
+ screen: screen,
116
+ requiredCharAmount: requiredCharAmount,
117
+ countdownDuration: countdownDuration,
118
+ timeLeft: timeLeft,
119
+ tempBlockDuration: tempBlockDuration,
120
+ phone: phone,
121
+ blockSmsRetry: blockSmsRetry,
122
+ onTempBlockFinished: onTempBlockFinished,
123
+ onChangeState: onChangeState,
124
+ onChangeScreen: onChangeScreen,
125
+ onInputFinished: handleInputFinished,
126
+ onSmsRetryClick: handleSmsRetry,
127
+ onFatalErrorOkButtonClick: handleFatalErrorOkButtonClick,
128
+ };
129
+ var screensMap = getScreensMap ? getScreensMap(confirmationScreens) : confirmationScreens;
130
+ var CurrentScreen = screensMap[screen];
131
+ return (React__default['default'].createElement(context.ConfirmationContext.Provider, { value: contextValue },
132
+ React__default['default'].createElement("div", { className: cn__default['default'](styles.component, styles[alignContent], className), "data-test-id": dataTestId }, CurrentScreen && React__default['default'].createElement(CurrentScreen, null))));
121
133
  };
122
134
 
123
135
  exports.Confirmation = Confirmation;
@@ -1,7 +1,7 @@
1
1
  import { FC } from 'react';
2
2
  type Props = {
3
3
  progress: number;
4
- className: string;
4
+ className?: string;
5
5
  };
6
6
  declare const CountdownLoader: FC<Props>;
7
7
  export { CountdownLoader };
@@ -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_7tzf0"};
11
+ var styles = {"circle":"confirmation__circle_c2vwh"};
12
12
  require('./index.css')
13
13
 
14
14
  var SIZE = 16;
@@ -1,4 +1,4 @@
1
- /* hash: 683kb */
1
+ /* hash: 1j9l0 */
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_7tzf0 {
22
+ .confirmation__circle_c2vwh {
23
23
  fill: transparent;
24
24
  stroke: var(--color-light-graphic-tertiary);
25
25
  stroke-width: 2px;
@@ -1,4 +1,2 @@
1
- export * from "./countdown/index";
2
- export * from "./sign-confirmation/index";
1
+ export * from "./screens/index";
3
2
  export * from "./countdown-loader/index";
4
- export * from "./overlimit/index";
@@ -4,23 +4,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('react');
6
6
  require('classnames');
7
- require('@alfalab/core-components-button');
8
- require('@alfalab/core-components-link');
9
- require('@alfalab/utils');
10
7
  require('@alfalab/hooks');
11
- var components_countdownLoader_component = require('./countdown-loader/component.js');
12
- var components_countdown_component = require('./countdown/component.js');
8
+ require('../utils.js');
9
+ require('../context.js');
10
+ require('@alfalab/core-components-code-input');
11
+ require('@alfalab/core-components-link');
12
+ require('../countdown-section-2edac0a0.js');
13
13
  require('@alfalab/core-components-loader');
14
- require('./code-input/component.js');
15
- require('./code-input/utils.js');
16
- var components_signConfirmation_component = require('./sign-confirmation/component.js');
17
- require('@alfalab/icons-glyph');
18
- var components_overlimit_component = require('./overlimit/component.js');
14
+ require('@alfalab/core-components-button');
15
+ var components_screens_initial_component = require('./screens/initial/component.js');
16
+ var components_screens_hint_component = require('./screens/hint/component.js');
17
+ var components_screens_fatalError_component = require('./screens/fatal-error/component.js');
18
+ var components_countdownLoader_component = require('./countdown-loader/component.js');
19
+ var components_screens_tempBlock_component = require('./screens/temp-block/component.js');
19
20
 
20
21
 
21
22
 
23
+ exports.Initial = components_screens_initial_component.Initial;
24
+ exports.Hint = components_screens_hint_component.Hint;
25
+ exports.FatalError = components_screens_fatalError_component.FatalError;
22
26
  exports.CountdownLoader = components_countdownLoader_component.CountdownLoader;
23
- exports.Countdown = components_countdown_component.Countdown;
24
- exports.formatMsAsMinutes = components_countdown_component.formatMsAsMinutes;
25
- exports.SignConfirmation = components_signConfirmation_component.SignConfirmation;
26
- exports.Overlimit = components_overlimit_component.Overlimit;
27
+ exports.TempBlock = components_screens_tempBlock_component.TempBlock;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const FatalError: () => JSX.Element;
3
+ export { FatalError };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ require('../../../utils.js');
7
+ var context = require('../../../context.js');
8
+ var coreComponentsButton = require('@alfalab/core-components-button');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
+
14
+ var styles = {"header":"confirmation__header_g9o34","description":"confirmation__description_g9o34"};
15
+ require('./index.css')
16
+
17
+ var FatalError = function () {
18
+ var _a = React.useContext(context.ConfirmationContext), texts = _a.texts, onFatalErrorOkButtonClick = _a.onFatalErrorOkButtonClick;
19
+ return (React__default['default'].createElement(React.Fragment, null,
20
+ React__default['default'].createElement("h3", { className: styles.header }, texts.fatalErrorTitle),
21
+ React__default['default'].createElement("div", { className: styles.description }, texts.fatalErrorDescription),
22
+ React__default['default'].createElement(coreComponentsButton.Button, { size: 'xs', view: 'secondary', onClick: onFatalErrorOkButtonClick }, texts.fatalErrorButton)));
23
+ };
24
+
25
+ exports.FatalError = FatalError;