@alfalab/core-components-confirmation 9.0.7 → 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.
- package/CHANGELOG.md +35 -0
- package/dist/component.d.ts +4 -164
- package/dist/component.js +113 -101
- package/dist/components/countdown-loader/component.d.ts +1 -1
- package/dist/components/countdown-loader/component.js +1 -1
- package/dist/components/countdown-loader/index.css +2 -2
- package/dist/components/index.d.ts +1 -3
- package/dist/components/index.js +15 -14
- package/dist/components/screens/fatal-error/component.d.ts +3 -0
- package/dist/components/screens/fatal-error/component.js +25 -0
- package/dist/components/screens/fatal-error/index.css +61 -0
- package/dist/components/{code-input → screens/fatal-error}/index.d.ts +0 -0
- package/dist/components/screens/fatal-error/index.js +13 -0
- package/dist/components/screens/hint/component.d.ts +3 -0
- package/dist/components/screens/hint/component.js +45 -0
- package/dist/components/screens/hint/index.css +103 -0
- package/dist/components/{countdown → screens/hint}/index.d.ts +0 -0
- package/dist/components/screens/hint/index.js +15 -0
- package/dist/components/screens/index.d.ts +4 -0
- package/dist/components/screens/index.js +26 -0
- package/dist/components/screens/initial/component.d.ts +3 -0
- package/dist/components/screens/initial/component.js +95 -0
- package/dist/components/screens/initial/countdown-section.d.ts +0 -0
- package/dist/components/screens/initial/countdown-section.js +15 -0
- package/dist/components/screens/initial/index.css +98 -0
- package/dist/components/{overlimit → screens/initial}/index.d.ts +0 -0
- package/dist/components/screens/initial/index.js +19 -0
- package/dist/components/screens/temp-block/component.d.ts +3 -0
- package/dist/components/screens/temp-block/component.js +36 -0
- package/dist/components/{overlimit → screens/temp-block}/index.css +9 -31
- package/dist/components/{sign-confirmation → screens/temp-block}/index.d.ts +0 -0
- package/dist/components/screens/temp-block/index.js +13 -0
- package/dist/context.d.ts +4 -0
- package/dist/context.js +27 -0
- package/dist/countdown-section-2edac0a0.d.ts +9 -0
- package/dist/countdown-section-2edac0a0.js +41 -0
- package/dist/cssm/component.d.ts +4 -164
- package/dist/cssm/component.js +115 -103
- package/dist/cssm/components/countdown-loader/component.d.ts +1 -1
- package/dist/cssm/components/index.d.ts +1 -3
- package/dist/cssm/components/index.js +19 -18
- package/dist/cssm/components/screens/fatal-error/component.d.ts +3 -0
- package/dist/cssm/components/screens/fatal-error/component.js +24 -0
- package/dist/cssm/components/{code-input → screens/fatal-error}/index.d.ts +0 -0
- package/dist/cssm/components/screens/fatal-error/index.js +14 -0
- package/dist/cssm/components/screens/fatal-error/index.module.css +60 -0
- package/dist/cssm/components/screens/hint/component.d.ts +3 -0
- package/dist/cssm/components/screens/hint/component.js +44 -0
- package/dist/cssm/components/{countdown → screens/hint}/index.d.ts +0 -0
- package/dist/cssm/components/screens/hint/index.js +16 -0
- package/dist/cssm/components/screens/hint/index.module.css +102 -0
- package/dist/cssm/components/screens/index.d.ts +4 -0
- package/dist/cssm/components/screens/index.js +31 -0
- package/dist/cssm/components/screens/initial/component.d.ts +3 -0
- package/dist/cssm/components/screens/initial/component.js +97 -0
- package/dist/cssm/components/screens/initial/countdown-section.d.ts +9 -0
- package/dist/cssm/components/screens/initial/countdown-section.js +41 -0
- package/dist/cssm/components/{overlimit → screens/initial}/index.d.ts +0 -0
- package/dist/cssm/components/screens/initial/index.js +20 -0
- package/dist/cssm/components/{sign-confirmation → screens/initial}/index.module.css +40 -50
- package/dist/cssm/components/screens/temp-block/component.d.ts +3 -0
- package/dist/cssm/components/screens/temp-block/component.js +36 -0
- package/dist/cssm/components/{sign-confirmation → screens/temp-block}/index.d.ts +0 -0
- package/dist/cssm/components/screens/temp-block/index.js +15 -0
- package/dist/cssm/components/{overlimit → screens/temp-block}/index.module.css +6 -28
- package/dist/cssm/context.d.ts +4 -0
- package/dist/cssm/context.js +27 -0
- package/dist/cssm/index.d.ts +3 -0
- package/dist/cssm/index.js +29 -20
- package/dist/cssm/index.module.css +5 -77
- package/dist/cssm/types.d.ts +130 -0
- package/dist/cssm/types.js +23 -0
- package/dist/cssm/utils.d.ts +30 -0
- package/dist/cssm/utils.js +84 -0
- package/dist/esm/component.d.ts +4 -164
- package/dist/esm/component.js +114 -102
- package/dist/esm/components/countdown-loader/component.d.ts +1 -1
- package/dist/esm/components/countdown-loader/component.js +1 -1
- package/dist/esm/components/countdown-loader/index.css +2 -2
- package/dist/esm/components/index.d.ts +1 -3
- package/dist/esm/components/index.js +11 -10
- package/dist/esm/components/screens/fatal-error/component.d.ts +3 -0
- package/dist/esm/components/screens/fatal-error/component.js +17 -0
- package/dist/esm/components/screens/fatal-error/index.css +61 -0
- package/dist/esm/components/{code-input → screens/fatal-error}/index.d.ts +0 -0
- package/dist/esm/components/screens/fatal-error/index.js +5 -0
- package/dist/esm/components/screens/hint/component.d.ts +3 -0
- package/dist/esm/components/screens/hint/component.js +36 -0
- package/dist/esm/components/screens/hint/index.css +103 -0
- package/dist/esm/components/{countdown → screens/hint}/index.d.ts +0 -0
- package/dist/esm/components/screens/hint/index.js +7 -0
- package/dist/esm/components/screens/index.d.ts +4 -0
- package/dist/esm/components/screens/index.js +15 -0
- package/dist/esm/components/screens/initial/component.d.ts +3 -0
- package/dist/esm/components/screens/initial/component.js +86 -0
- package/dist/esm/components/screens/initial/countdown-section.d.ts +0 -0
- package/dist/esm/components/screens/initial/countdown-section.js +7 -0
- package/dist/esm/components/screens/initial/index.css +98 -0
- package/dist/esm/components/{overlimit → screens/initial}/index.d.ts +0 -0
- package/dist/esm/components/screens/initial/index.js +11 -0
- package/dist/esm/components/screens/temp-block/component.d.ts +3 -0
- package/dist/esm/components/screens/temp-block/component.js +28 -0
- package/dist/{modern/components/overlimit → esm/components/screens/temp-block}/index.css +9 -31
- package/dist/esm/components/{sign-confirmation → screens/temp-block}/index.d.ts +0 -0
- package/dist/esm/components/screens/temp-block/index.js +5 -0
- package/dist/esm/context.d.ts +4 -0
- package/dist/esm/context.js +23 -0
- package/dist/esm/countdown-section-ddb744a6.d.ts +9 -0
- package/dist/esm/countdown-section-ddb744a6.js +33 -0
- package/dist/esm/index.css +7 -79
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +13 -11
- package/dist/esm/types.d.ts +130 -0
- package/dist/esm/types.js +19 -0
- package/dist/esm/utils.d.ts +30 -0
- package/dist/esm/utils.js +76 -0
- package/dist/index.css +7 -79
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25 -16
- package/dist/modern/component.d.ts +4 -164
- package/dist/modern/component.js +75 -102
- package/dist/modern/components/countdown-loader/component.d.ts +1 -1
- package/dist/modern/components/countdown-loader/component.js +1 -1
- package/dist/modern/components/countdown-loader/index.css +2 -2
- package/dist/modern/components/index.d.ts +1 -3
- package/dist/modern/components/index.js +11 -10
- package/dist/modern/components/screens/fatal-error/component.d.ts +3 -0
- package/dist/modern/components/screens/fatal-error/component.js +17 -0
- package/dist/modern/components/screens/fatal-error/index.css +61 -0
- package/dist/modern/components/{code-input → screens/fatal-error}/index.d.ts +0 -0
- package/dist/modern/components/screens/fatal-error/index.js +5 -0
- package/dist/modern/components/screens/hint/component.d.ts +3 -0
- package/dist/modern/components/screens/hint/component.js +36 -0
- package/dist/modern/components/screens/hint/index.css +103 -0
- package/dist/modern/components/{countdown → screens/hint}/index.d.ts +0 -0
- package/dist/modern/components/screens/hint/index.js +7 -0
- package/dist/modern/components/screens/index.d.ts +4 -0
- package/dist/modern/components/screens/index.js +15 -0
- package/dist/modern/components/screens/initial/component.d.ts +3 -0
- package/dist/modern/components/screens/initial/component.js +86 -0
- package/dist/modern/components/screens/initial/countdown-section.d.ts +0 -0
- package/dist/modern/components/screens/initial/countdown-section.js +7 -0
- package/dist/modern/components/screens/initial/index.css +98 -0
- package/dist/modern/components/{overlimit → screens/initial}/index.d.ts +0 -0
- package/dist/modern/components/screens/initial/index.js +11 -0
- package/dist/modern/components/screens/temp-block/component.d.ts +3 -0
- package/dist/modern/components/screens/temp-block/component.js +28 -0
- package/dist/{esm/components/overlimit → modern/components/screens/temp-block}/index.css +9 -31
- package/dist/modern/components/{sign-confirmation → screens/temp-block}/index.d.ts +0 -0
- package/dist/modern/components/screens/temp-block/index.js +5 -0
- package/dist/modern/context.d.ts +4 -0
- package/dist/modern/context.js +23 -0
- package/dist/modern/countdown-section-91f055c8.d.ts +9 -0
- package/dist/modern/countdown-section-91f055c8.js +32 -0
- package/dist/modern/index.css +7 -79
- package/dist/modern/index.d.ts +3 -0
- package/dist/modern/index.js +12 -10
- package/dist/modern/types.d.ts +130 -0
- package/dist/modern/types.js +19 -0
- package/dist/modern/utils.d.ts +30 -0
- package/dist/modern/utils.js +74 -0
- package/dist/types.d.ts +130 -0
- package/dist/types.js +23 -0
- package/dist/utils.d.ts +30 -0
- package/dist/utils.js +84 -0
- package/package.json +3 -2
- package/dist/components/code-input/component.d.ts +0 -16
- package/dist/components/code-input/component.js +0 -160
- package/dist/components/code-input/index.css +0 -99
- package/dist/components/code-input/index.js +0 -13
- package/dist/components/code-input/utils.d.ts +0 -10
- package/dist/components/code-input/utils.js +0 -21
- package/dist/components/countdown/component.d.ts +0 -23
- package/dist/components/countdown/component.js +0 -117
- package/dist/components/countdown/index.css +0 -85
- package/dist/components/countdown/index.js +0 -16
- package/dist/components/overlimit/component.d.ts +0 -12
- package/dist/components/overlimit/component.js +0 -73
- package/dist/components/overlimit/index.js +0 -17
- package/dist/components/sign-confirmation/component.d.ts +0 -37
- package/dist/components/sign-confirmation/component.js +0 -62
- package/dist/components/sign-confirmation/index.css +0 -108
- package/dist/components/sign-confirmation/index.js +0 -20
- package/dist/cssm/components/code-input/component.d.ts +0 -16
- package/dist/cssm/components/code-input/component.js +0 -159
- package/dist/cssm/components/code-input/index.js +0 -14
- package/dist/cssm/components/code-input/index.module.css +0 -98
- package/dist/cssm/components/code-input/utils.d.ts +0 -10
- package/dist/cssm/components/code-input/utils.js +0 -21
- package/dist/cssm/components/countdown/component.d.ts +0 -23
- package/dist/cssm/components/countdown/component.js +0 -117
- package/dist/cssm/components/countdown/index.js +0 -18
- package/dist/cssm/components/countdown/index.module.css +0 -84
- package/dist/cssm/components/overlimit/component.d.ts +0 -12
- package/dist/cssm/components/overlimit/component.js +0 -74
- package/dist/cssm/components/overlimit/index.js +0 -20
- package/dist/cssm/components/sign-confirmation/component.d.ts +0 -37
- package/dist/cssm/components/sign-confirmation/component.js +0 -64
- package/dist/cssm/components/sign-confirmation/index.js +0 -24
- package/dist/esm/components/code-input/component.d.ts +0 -16
- package/dist/esm/components/code-input/component.js +0 -151
- package/dist/esm/components/code-input/index.css +0 -99
- package/dist/esm/components/code-input/index.js +0 -5
- package/dist/esm/components/code-input/utils.d.ts +0 -10
- package/dist/esm/components/code-input/utils.js +0 -17
- package/dist/esm/components/countdown/component.d.ts +0 -23
- package/dist/esm/components/countdown/component.js +0 -107
- package/dist/esm/components/countdown/index.css +0 -85
- package/dist/esm/components/countdown/index.js +0 -7
- package/dist/esm/components/overlimit/component.d.ts +0 -12
- package/dist/esm/components/overlimit/component.js +0 -65
- package/dist/esm/components/overlimit/index.js +0 -9
- package/dist/esm/components/sign-confirmation/component.d.ts +0 -37
- package/dist/esm/components/sign-confirmation/component.js +0 -53
- package/dist/esm/components/sign-confirmation/index.css +0 -108
- package/dist/esm/components/sign-confirmation/index.js +0 -12
- package/dist/modern/components/code-input/component.d.ts +0 -16
- package/dist/modern/components/code-input/component.js +0 -123
- package/dist/modern/components/code-input/index.css +0 -99
- package/dist/modern/components/code-input/index.js +0 -5
- package/dist/modern/components/code-input/utils.d.ts +0 -10
- package/dist/modern/components/code-input/utils.js +0 -16
- package/dist/modern/components/countdown/component.d.ts +0 -23
- package/dist/modern/components/countdown/component.js +0 -102
- package/dist/modern/components/countdown/index.css +0 -85
- package/dist/modern/components/countdown/index.js +0 -7
- package/dist/modern/components/overlimit/component.d.ts +0 -12
- package/dist/modern/components/overlimit/component.js +0 -64
- package/dist/modern/components/overlimit/index.js +0 -9
- package/dist/modern/components/sign-confirmation/component.d.ts +0 -37
- package/dist/modern/components/sign-confirmation/component.js +0 -51
- package/dist/modern/components/sign-confirmation/index.css +0 -108
- package/dist/modern/components/sign-confirmation/index.js +0 -12
package/dist/modern/component.js
CHANGED
|
@@ -1,113 +1,86 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
3
|
+
import { usePrevious } from '@alfalab/hooks';
|
|
4
|
+
import { ONE_MINUTE, ONE_DAY, useCountdown } from './utils.js';
|
|
5
|
+
import { ConfirmationContext } from './context.js';
|
|
6
|
+
import { 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 '
|
|
11
|
-
import './components/
|
|
12
|
-
import {
|
|
13
|
-
import '
|
|
14
|
-
import
|
|
11
|
+
import '@alfalab/core-components-button/dist/modern';
|
|
12
|
+
import { Initial } from './components/screens/initial/component.js';
|
|
13
|
+
import { Hint } from './components/screens/hint/component.js';
|
|
14
|
+
import { FatalError } from './components/screens/fatal-error/component.js';
|
|
15
|
+
import './components/countdown-loader/component.js';
|
|
16
|
+
import { TempBlock } from './components/screens/temp-block/component.js';
|
|
15
17
|
|
|
16
|
-
var styles = {"component":"
|
|
18
|
+
var styles = {"component":"confirmation__component_1lhb7","center":"confirmation__center_1lhb7"};
|
|
17
19
|
require('./index.css')
|
|
18
20
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!noAttemptsLeftMessage) {
|
|
38
|
-
onSmsRetryClick();
|
|
39
|
-
}
|
|
40
|
-
}, [onSmsRetryClick, noAttemptsLeftMessage]);
|
|
41
|
-
const handleCountdownFinished = useCallback(() => {
|
|
42
|
-
if (onCountdownFinished) {
|
|
43
|
-
onCountdownFinished();
|
|
44
|
-
}
|
|
45
|
-
}, [onCountdownFinished]);
|
|
46
|
-
const handleOverlimitCountdownFinished = useCallback(() => {
|
|
47
|
-
if (onOverlimitCountdownFinished) {
|
|
48
|
-
onOverlimitCountdownFinished();
|
|
49
|
-
}
|
|
50
|
-
}, [onOverlimitCountdownFinished]);
|
|
51
|
-
const handleSmsHintLinkClick = useCallback(() => {
|
|
52
|
-
setShowHint(true);
|
|
53
|
-
if (onSmsHintLinkClick) {
|
|
54
|
-
onSmsHintLinkClick();
|
|
55
|
-
}
|
|
56
|
-
}, [onSmsHintLinkClick]);
|
|
57
|
-
const handleErrorSmsRetryClick = useCallback(() => {
|
|
58
|
-
if (onActionWithFatalError) {
|
|
59
|
-
onActionWithFatalError();
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
onSmsRetryClick();
|
|
21
|
+
const confirmationScreens = {
|
|
22
|
+
INITIAL: Initial,
|
|
23
|
+
HINT: Hint,
|
|
24
|
+
FATAL_ERROR: FatalError,
|
|
25
|
+
TEMP_BLOCK: TempBlock,
|
|
26
|
+
};
|
|
27
|
+
const Confirmation = ({ state, screen, alignContent = 'left', children, requiredCharAmount = 5, countdownDuration = ONE_MINUTE, tempBlockDuration = ONE_DAY, phone, blockSmsRetry, dataTestId, className, getScreensMap, onInputFinished, onChangeState, onSmsRetryClick, onChangeScreen, onFatalErrorOkButtonClick, onTempBlockFinished, ...restProps }) => {
|
|
28
|
+
const [timeLeft, startTimer, stopTimer] = useCountdown(countdownDuration);
|
|
29
|
+
const prevState = usePrevious(state);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
startTimer();
|
|
32
|
+
}, [startTimer]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
/**
|
|
35
|
+
* Перезапускаем таймер после повторного запроса кода
|
|
36
|
+
*/
|
|
37
|
+
if (state === 'INITIAL' && prevState === 'CODE_SENDING') {
|
|
38
|
+
startTimer();
|
|
63
39
|
}
|
|
64
|
-
}, [
|
|
40
|
+
}, [state, prevState, startTimer]);
|
|
65
41
|
useEffect(() => {
|
|
66
|
-
|
|
67
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Останавливаем таймер, если новый экран/состояние не содержит таймер
|
|
44
|
+
*/
|
|
45
|
+
if (!['INITIAL', 'HINT'].includes(screen) || blockSmsRetry) {
|
|
46
|
+
stopTimer();
|
|
47
|
+
}
|
|
48
|
+
}, [state, screen, blockSmsRetry, stopTimer]);
|
|
49
|
+
const handleSmsRetry = () => {
|
|
50
|
+
onChangeState('CODE_SENDING');
|
|
51
|
+
onSmsRetryClick();
|
|
52
|
+
};
|
|
53
|
+
const handleInputFinished = (code) => {
|
|
54
|
+
onChangeState('CODE_CHECKING');
|
|
55
|
+
onInputFinished(code);
|
|
56
|
+
};
|
|
57
|
+
const handleFatalErrorOkButtonClick = () => {
|
|
58
|
+
if (onFatalErrorOkButtonClick) {
|
|
59
|
+
onFatalErrorOkButtonClick();
|
|
68
60
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
93
|
-
/**
|
|
94
|
-
* Для отображения в сторибуке
|
|
95
|
-
*/
|
|
96
|
-
Confirmation.defaultProps = {
|
|
97
|
-
countdownDuration: 60000,
|
|
98
|
-
errorTitle: 'Превышено количество попыток ввода кода',
|
|
99
|
-
hasPhoneMask: true,
|
|
100
|
-
hasSmsCountdown: true,
|
|
101
|
-
requiredCharAmount: 5,
|
|
102
|
-
signTitle: 'Введите код из\xa0сообщения',
|
|
103
|
-
codeSending: false,
|
|
104
|
-
codeChecking: false,
|
|
105
|
-
codeCheckingText: 'Проверка кода',
|
|
106
|
-
codeSendingText: 'Отправляем код',
|
|
107
|
-
buttonErrorText: 'Понятно',
|
|
108
|
-
buttonReturnText: 'Вернуться назад',
|
|
109
|
-
buttonRetryText: 'Запросить новый код',
|
|
110
|
-
alignContent: 'left',
|
|
61
|
+
};
|
|
62
|
+
const contextValue = {
|
|
63
|
+
alignContent,
|
|
64
|
+
texts: { ...defaultTexts, ...restProps.texts },
|
|
65
|
+
state,
|
|
66
|
+
screen,
|
|
67
|
+
requiredCharAmount,
|
|
68
|
+
countdownDuration,
|
|
69
|
+
timeLeft,
|
|
70
|
+
tempBlockDuration,
|
|
71
|
+
phone,
|
|
72
|
+
blockSmsRetry,
|
|
73
|
+
onTempBlockFinished,
|
|
74
|
+
onChangeState,
|
|
75
|
+
onChangeScreen,
|
|
76
|
+
onInputFinished: handleInputFinished,
|
|
77
|
+
onSmsRetryClick: handleSmsRetry,
|
|
78
|
+
onFatalErrorOkButtonClick: handleFatalErrorOkButtonClick,
|
|
79
|
+
};
|
|
80
|
+
const screensMap = getScreensMap ? getScreensMap(confirmationScreens) : confirmationScreens;
|
|
81
|
+
const CurrentScreen = screensMap[screen];
|
|
82
|
+
return (React.createElement(ConfirmationContext.Provider, { value: contextValue },
|
|
83
|
+
React.createElement("div", { className: cn(styles.component, styles[alignContent], className), "data-test-id": dataTestId }, CurrentScreen && React.createElement(CurrentScreen, null))));
|
|
111
84
|
};
|
|
112
85
|
|
|
113
86
|
export { Confirmation };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
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
|
-
.
|
|
22
|
+
.confirmation__circle_c2vwh {
|
|
23
23
|
fill: transparent;
|
|
24
24
|
stroke: var(--color-light-graphic-tertiary);
|
|
25
25
|
stroke-width: 2px;
|
|
@@ -1,14 +1,15 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
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
9
|
import '@alfalab/core-components-loader/dist/modern';
|
|
10
|
-
import '
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
export {
|
|
10
|
+
import '@alfalab/core-components-button/dist/modern';
|
|
11
|
+
export { Initial } from './screens/initial/component.js';
|
|
12
|
+
export { Hint } from './screens/hint/component.js';
|
|
13
|
+
export { FatalError } from './screens/fatal-error/component.js';
|
|
14
|
+
export { CountdownLoader } from './countdown-loader/component.js';
|
|
15
|
+
export { TempBlock } from './screens/temp-block/component.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { useContext, Fragment } from 'react';
|
|
2
|
+
import '../../../utils.js';
|
|
3
|
+
import { ConfirmationContext } from '../../../context.js';
|
|
4
|
+
import { Button } from '@alfalab/core-components-button/dist/modern';
|
|
5
|
+
|
|
6
|
+
var styles = {"header":"confirmation__header_g9o34","description":"confirmation__description_g9o34"};
|
|
7
|
+
require('./index.css')
|
|
8
|
+
|
|
9
|
+
const FatalError = () => {
|
|
10
|
+
const { texts, onFatalErrorOkButtonClick } = useContext(ConfirmationContext);
|
|
11
|
+
return (React.createElement(Fragment, null,
|
|
12
|
+
React.createElement("h3", { className: styles.header }, texts.fatalErrorTitle),
|
|
13
|
+
React.createElement("div", { className: styles.description }, texts.fatalErrorDescription),
|
|
14
|
+
React.createElement(Button, { size: 'xs', view: 'secondary', onClick: onFatalErrorOkButtonClick }, texts.fatalErrorButton)));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { FatalError };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* hash: 11nsd */
|
|
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-xl: 24px;
|
|
16
|
+
--gap-2xl: 32px;
|
|
17
|
+
}
|
|
18
|
+
:root {
|
|
19
|
+
--font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
|
|
20
|
+
sans-serif;
|
|
21
|
+
}
|
|
22
|
+
:root {
|
|
23
|
+
/* title */
|
|
24
|
+
--confirmation-title-font-size: 22px;
|
|
25
|
+
--confirmation-title-line-height: 26px;
|
|
26
|
+
--confirmation-title-font-weight: 700;
|
|
27
|
+
--confirmation-title-font-family: var(--font-family-system);
|
|
28
|
+
--confirmation-title-color: var(--color-light-text-primary);
|
|
29
|
+
--confirmation-title-font-feature-settings: normal;
|
|
30
|
+
|
|
31
|
+
/* text */
|
|
32
|
+
--confirmation-text-font-size: 16px;
|
|
33
|
+
--confirmation-text-line-height: 24px;
|
|
34
|
+
--confirmation-text-font-weight: 400;
|
|
35
|
+
--confirmation-text-font-family: var(--font-family-system);
|
|
36
|
+
--confirmation-text-color: var(--color-light-text-secondary);
|
|
37
|
+
|
|
38
|
+
/* error */
|
|
39
|
+
|
|
40
|
+
/* input */
|
|
41
|
+
}
|
|
42
|
+
.confirmation__header_g9o34 {
|
|
43
|
+
margin: 0;
|
|
44
|
+
margin-bottom: var(--gap-xl);
|
|
45
|
+
font-size: var(--confirmation-title-font-size);
|
|
46
|
+
line-height: var(--confirmation-title-line-height);
|
|
47
|
+
font-weight: var(--confirmation-title-font-weight);
|
|
48
|
+
font-family: var(--confirmation-title-font-family);
|
|
49
|
+
color: var(--confirmation-title-color);
|
|
50
|
+
font-feature-settings: var(--confirmation-title-font-feature-settings);
|
|
51
|
+
}
|
|
52
|
+
.confirmation__description_g9o34 {
|
|
53
|
+
font-size: var(--confirmation-text-font-size);
|
|
54
|
+
line-height: var(--confirmation-text-line-height);
|
|
55
|
+
font-weight: var(--confirmation-text-font-weight);
|
|
56
|
+
font-family: var(--confirmation-text-font-family);
|
|
57
|
+
color: var(--confirmation-text-color);
|
|
58
|
+
|
|
59
|
+
margin-bottom: var(--gap-2xl);
|
|
60
|
+
color: var(--color-light-text-primary);
|
|
61
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import '../../../utils.js';
|
|
4
|
+
import { ConfirmationContext } from '../../../context.js';
|
|
5
|
+
import { Link } from '@alfalab/core-components-link/dist/modern';
|
|
6
|
+
import { Button } from '@alfalab/core-components-button/dist/modern';
|
|
7
|
+
|
|
8
|
+
var styles = {"center":"confirmation__center_1td1k","phoneHintWrap":"confirmation__phoneHintWrap_1td1k","hintWrap":"confirmation__hintWrap_1td1k","title":"confirmation__title_1td1k","text":"confirmation__text_1td1k","phonesWrap":"confirmation__phonesWrap_1td1k","phoneWrap":"confirmation__phoneWrap_1td1k","phoneLink":"confirmation__phoneLink_1td1k","phoneDescription":"confirmation__phoneDescription_1td1k","hintButton":"confirmation__hintButton_1td1k"};
|
|
9
|
+
require('./index.css')
|
|
10
|
+
|
|
11
|
+
const Hint = () => {
|
|
12
|
+
const { alignContent, texts, onChangeScreen, onChangeState } = useContext(ConfirmationContext);
|
|
13
|
+
const handleReturnButtonClick = () => {
|
|
14
|
+
onChangeScreen('INITIAL');
|
|
15
|
+
onChangeState('INITIAL');
|
|
16
|
+
};
|
|
17
|
+
return (React.createElement("div", { className: cn(styles.component, styles[alignContent]) },
|
|
18
|
+
React.createElement("div", { className: styles.hintWrap },
|
|
19
|
+
React.createElement("h3", { className: styles.title }, "\u041D\u0435\u00A0\u043F\u0440\u0438\u0445\u043E\u0434\u0438\u0442 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435?"),
|
|
20
|
+
React.createElement("span", { className: styles.text }, "\u0415\u0441\u043B\u0438 \u0443\u00A0\u0432\u0430\u0441 \u0438\u0437\u043C\u0435\u043D\u0438\u043B\u0441\u044F \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430, \u043F\u043E\u0437\u0432\u043E\u043D\u0438\u0442\u0435 \u043D\u0430\u043C \u0438\u043B\u0438 \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."),
|
|
21
|
+
React.createElement("div", { className: styles.phonesWrap },
|
|
22
|
+
React.createElement("div", { className: styles.phoneWrap },
|
|
23
|
+
React.createElement(Link, { href: 'tel:+78002000000', className: styles.phoneLink }, "8 800 200-00-00"),
|
|
24
|
+
React.createElement("span", { className: styles.phoneDescription },
|
|
25
|
+
' ',
|
|
26
|
+
"\u2014\u00A0\u0434\u043B\u044F \u0437\u0432\u043E\u043D\u043A\u043E\u0432 \u043F\u043E\u00A0\u0420\u043E\u0441\u0441\u0438\u0438")),
|
|
27
|
+
React.createElement("div", { className: styles.phoneWrap },
|
|
28
|
+
React.createElement(Link, { href: 'tel:+74957888878', className: styles.phoneLink }, "+7 495 78-888-78"),
|
|
29
|
+
React.createElement("span", { className: styles.phoneDescription },
|
|
30
|
+
' ',
|
|
31
|
+
"\u2014\u00A0\u0432\u00A0\u041C\u043E\u0441\u043A\u0432\u0435 \u0438\u00A0\u0437\u0430\u00A0\u0433\u0440\u0430\u043D\u0438\u0446\u0435\u0439"))),
|
|
32
|
+
React.createElement("span", { className: styles.text }, "\u0415\u0441\u043B\u0438 \u043D\u043E\u043C\u0435\u0440 \u043D\u0435\u00A0\u043C\u0435\u043D\u044F\u043B\u0441\u044F, \u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u043F\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441 \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0438 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043C\u0438\u043D\u0443\u0442."),
|
|
33
|
+
React.createElement(Button, { size: 's', view: 'secondary', onClick: handleReturnButtonClick, className: styles.hintButton }, texts.hintButton))));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { Hint };
|
|
@@ -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
|
+
}
|
|
File without changes
|
|
@@ -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/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 './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,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/modern';
|
|
7
|
+
import { Link } from '@alfalab/core-components-link/dist/modern';
|
|
8
|
+
import { s as styles, C as CountdownSection } from '../../../countdown-section-91f055c8.js';
|
|
9
|
+
import '@alfalab/core-components-loader/dist/modern';
|
|
10
|
+
import '@alfalab/core-components-button/dist/modern';
|
|
11
|
+
|
|
12
|
+
const CODE_SEND_HINT_VISIBLE_DURATION = 2000;
|
|
13
|
+
const Initial = () => {
|
|
14
|
+
const { state, alignContent, texts, requiredCharAmount, timeLeft, phone, onChangeState, onInputFinished, onChangeScreen, onSmsRetryClick, } = useContext(ConfirmationContext);
|
|
15
|
+
const prevState = usePrevious(state);
|
|
16
|
+
const inputRef = useRef(null);
|
|
17
|
+
const [codeSendHintVisible, setCodeSendHintVisible] = useState(false);
|
|
18
|
+
const timerId = useRef(0);
|
|
19
|
+
const handleInputComplete = code => {
|
|
20
|
+
onInputFinished(code);
|
|
21
|
+
};
|
|
22
|
+
const handleSmsHintLinkClick = () => {
|
|
23
|
+
onChangeScreen('HINT');
|
|
24
|
+
};
|
|
25
|
+
const handleInputChange = () => {
|
|
26
|
+
if (state === 'CODE_ERROR') {
|
|
27
|
+
onChangeState('INITIAL');
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const handleSmsRetryClick = () => {
|
|
31
|
+
if (inputRef.current) {
|
|
32
|
+
inputRef.current.reset();
|
|
33
|
+
}
|
|
34
|
+
onSmsRetryClick();
|
|
35
|
+
};
|
|
36
|
+
const clearTimer = useCallback(() => {
|
|
37
|
+
window.clearTimeout(timerId.current);
|
|
38
|
+
}, []);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (inputRef.current) {
|
|
41
|
+
inputRef.current.focus();
|
|
42
|
+
}
|
|
43
|
+
return () => {
|
|
44
|
+
clearTimer();
|
|
45
|
+
};
|
|
46
|
+
}, [clearTimer]);
|
|
47
|
+
useEffect(() => {
|
|
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(() => {
|
|
59
|
+
if (prevState === 'CODE_SENDING' && state !== 'CODE_SENDING') {
|
|
60
|
+
setCodeSendHintVisible(true);
|
|
61
|
+
clearTimer();
|
|
62
|
+
timerId.current = window.setTimeout(() => {
|
|
63
|
+
setCodeSendHintVisible(false);
|
|
64
|
+
}, CODE_SEND_HINT_VISIBLE_DURATION);
|
|
65
|
+
}
|
|
66
|
+
}, [prevState, state, clearTimer]);
|
|
67
|
+
const getCodeInputError = () => {
|
|
68
|
+
if (state === 'CODE_ERROR') {
|
|
69
|
+
return texts.codeError || true;
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
};
|
|
73
|
+
const processing = ['CODE_CHECKING', 'CODE_SENDING'].includes(state);
|
|
74
|
+
const 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 };
|
|
File without changes
|
|
@@ -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-91f055c8.js';
|
|
6
|
+
import '@alfalab/core-components-loader/dist/modern';
|
|
7
|
+
import '@alfalab/core-components-button/dist/modern';
|