@alfalab/core-components-confirmation 9.0.7 → 10.1.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 +57 -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-4cb91876.d.ts +9 -0
- package/dist/countdown-section-4cb91876.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-7f4accdc.d.ts +9 -0
- package/dist/esm/countdown-section-7f4accdc.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-2c8a29e0.d.ts +9 -0
- package/dist/modern/countdown-section-2c8a29e0.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 +4 -3
- 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
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState, useCallback, useEffect } from 'react';
|
|
2
|
-
import cn from 'classnames';
|
|
3
|
-
import { Button } from '@alfalab/core-components-button/dist/modern';
|
|
4
|
-
import { phoneNumber } from '@alfalab/utils';
|
|
5
|
-
import { usePrevious } from '@alfalab/hooks';
|
|
6
|
-
import { CountdownLoader } from '../countdown-loader/component.js';
|
|
7
|
-
|
|
8
|
-
var styles = {"component":"confirmation__component_tecu4","hasError":"confirmation__hasError_tecu4","getCodeButton":"confirmation__getCodeButton_tecu4","info":"confirmation__info_tecu4","customContent":"confirmation__customContent_tecu4","loaderWrap":"confirmation__loaderWrap_tecu4","loader":"confirmation__loader_tecu4","center":"confirmation__center_tecu4","timePassed":"confirmation__timePassed_tecu4","noAttemptsLeftMessage":"confirmation__noAttemptsLeftMessage_tecu4"};
|
|
9
|
-
require('./index.css')
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* TODO: Вынести это в utils
|
|
13
|
-
* Форматирование миллисекунд в hh:mm:ss.
|
|
14
|
-
*
|
|
15
|
-
* @param {Number} ms миллисекунды
|
|
16
|
-
* @returns {String} время в формате mm:ss
|
|
17
|
-
*/
|
|
18
|
-
function formatMsAsMinutes(ms) {
|
|
19
|
-
const totalSeconds = Math.ceil(ms / 1000);
|
|
20
|
-
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
21
|
-
const totalHours = Math.floor(totalMinutes / 60);
|
|
22
|
-
const seconds = totalSeconds % 60;
|
|
23
|
-
const paddedSeconds = `00${seconds}`.slice(-2);
|
|
24
|
-
if (totalHours > 0) {
|
|
25
|
-
const minutes = totalMinutes % 60;
|
|
26
|
-
const paddedMinutes = `00${minutes}`.slice(-2);
|
|
27
|
-
const paddedHours = `00${totalHours}`.slice(-2);
|
|
28
|
-
return `${paddedHours}:${paddedMinutes}:${paddedSeconds}`;
|
|
29
|
-
}
|
|
30
|
-
const paddedMinutes = `00${totalMinutes}`.slice(-2);
|
|
31
|
-
return `${paddedMinutes}:${paddedSeconds}`;
|
|
32
|
-
}
|
|
33
|
-
const Container = ({ alignContent, hasError, children }) => (React.createElement("div", { className: cn(styles.component, styles[alignContent], {
|
|
34
|
-
[styles.hasError]: hasError,
|
|
35
|
-
}) }, children));
|
|
36
|
-
const Countdown = ({ duration = 5000, phone = '', hasPhoneMask = true, buttonRetryText, alignContent, noAttemptsLeftMessage, hasError, content, onRepeatSms, onCountdownFinished, }) => {
|
|
37
|
-
const timerId = useRef(0);
|
|
38
|
-
const start = useRef(0);
|
|
39
|
-
const [repeatSmsButtonShow, setRepeatSmsButtonShow] = useState(false);
|
|
40
|
-
const [timePassed, setTimePassed] = useState(0);
|
|
41
|
-
const noAttemptsLeftMessagePrev = usePrevious(noAttemptsLeftMessage);
|
|
42
|
-
const stopTimer = useCallback(() => {
|
|
43
|
-
window.clearInterval(timerId.current);
|
|
44
|
-
}, []);
|
|
45
|
-
const updateProgress = useCallback(() => {
|
|
46
|
-
const passed = Date.now() - start.current;
|
|
47
|
-
if (passed >= duration) {
|
|
48
|
-
setRepeatSmsButtonShow(true);
|
|
49
|
-
if (onCountdownFinished) {
|
|
50
|
-
onCountdownFinished();
|
|
51
|
-
}
|
|
52
|
-
stopTimer();
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
setTimePassed(passed);
|
|
56
|
-
}
|
|
57
|
-
}, [duration, onCountdownFinished, stopTimer]);
|
|
58
|
-
const startTimer = useCallback(() => {
|
|
59
|
-
start.current = Date.now();
|
|
60
|
-
updateProgress();
|
|
61
|
-
timerId.current = window.setInterval(updateProgress, 50);
|
|
62
|
-
}, [updateProgress]);
|
|
63
|
-
const handleRepeatSmsButtonClick = useCallback((event) => {
|
|
64
|
-
setRepeatSmsButtonShow(false);
|
|
65
|
-
if (onRepeatSms) {
|
|
66
|
-
onRepeatSms(event);
|
|
67
|
-
}
|
|
68
|
-
startTimer();
|
|
69
|
-
}, [onRepeatSms, startTimer]);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
startTimer();
|
|
72
|
-
return () => {
|
|
73
|
-
stopTimer();
|
|
74
|
-
};
|
|
75
|
-
}, [startTimer, stopTimer]);
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
// Если кончились попытки ввода кода, то останавливаем таймер
|
|
78
|
-
if (!noAttemptsLeftMessagePrev && noAttemptsLeftMessage) {
|
|
79
|
-
stopTimer();
|
|
80
|
-
}
|
|
81
|
-
}, [noAttemptsLeftMessage, noAttemptsLeftMessagePrev, stopTimer]);
|
|
82
|
-
const progress = timePassed / duration;
|
|
83
|
-
const formattedPhone = phoneNumber.format(phone);
|
|
84
|
-
const retryButton = (React.createElement(Button, { size: 'xs', view: 'secondary', onClick: handleRepeatSmsButtonClick, className: styles.getCodeButton }, buttonRetryText));
|
|
85
|
-
if (content) {
|
|
86
|
-
return (React.createElement(Container, { alignContent: alignContent, hasError: hasError },
|
|
87
|
-
React.createElement("div", { className: styles.customContent }, content),
|
|
88
|
-
retryButton));
|
|
89
|
-
}
|
|
90
|
-
return (React.createElement(Container, { alignContent: alignContent, hasError: hasError },
|
|
91
|
-
phone && !hasError && (React.createElement("div", null,
|
|
92
|
-
"\u041A\u043E\u0434 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u043D\u0430",
|
|
93
|
-
' ',
|
|
94
|
-
hasPhoneMask ? phoneNumber.mask(formattedPhone) : formattedPhone)),
|
|
95
|
-
noAttemptsLeftMessage ? (React.createElement("div", { className: styles.noAttemptsLeftMessage }, noAttemptsLeftMessage)) : repeatSmsButtonShow ? (retryButton) : (React.createElement("div", null,
|
|
96
|
-
React.createElement("div", { className: styles.info }, "\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437"),
|
|
97
|
-
React.createElement("div", { className: styles.loaderWrap },
|
|
98
|
-
React.createElement(CountdownLoader, { progress: progress, className: styles.loader }),
|
|
99
|
-
React.createElement("div", { className: styles.timePassed }, formatMsAsMinutes(duration - timePassed)))))));
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export { Countdown, formatMsAsMinutes };
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/* hash: 16vas */
|
|
2
|
-
:root {
|
|
3
|
-
--color-light-text-secondary: #546272;
|
|
4
|
-
}
|
|
5
|
-
:root {
|
|
6
|
-
|
|
7
|
-
/* Hard */
|
|
8
|
-
|
|
9
|
-
/* Up */
|
|
10
|
-
|
|
11
|
-
/* Hard up */
|
|
12
|
-
}
|
|
13
|
-
:root {
|
|
14
|
-
--gap-2xs: 4px;
|
|
15
|
-
--gap-xs: 8px;
|
|
16
|
-
--gap-2xl: 32px;
|
|
17
|
-
--gap-3xl: 40px;
|
|
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
|
-
|
|
26
|
-
/* text */
|
|
27
|
-
--confirmation-text-font-size: 16px;
|
|
28
|
-
--confirmation-text-line-height: 24px;
|
|
29
|
-
--confirmation-text-font-weight: 400;
|
|
30
|
-
--confirmation-text-font-family: var(--font-family-system);
|
|
31
|
-
--confirmation-text-color: var(--color-light-text-secondary);
|
|
32
|
-
|
|
33
|
-
/* error */
|
|
34
|
-
|
|
35
|
-
/* input */
|
|
36
|
-
}
|
|
37
|
-
.confirmation__component_tecu4 {
|
|
38
|
-
font-size: var(--confirmation-text-font-size);
|
|
39
|
-
line-height: var(--confirmation-text-line-height);
|
|
40
|
-
font-weight: var(--confirmation-text-font-weight);
|
|
41
|
-
font-family: var(--confirmation-text-font-family);
|
|
42
|
-
color: var(--confirmation-text-color);
|
|
43
|
-
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-direction: column;
|
|
46
|
-
align-items: flex-start;
|
|
47
|
-
margin-top: var(--gap-3xl);
|
|
48
|
-
color: var(--confirmation-text-color);
|
|
49
|
-
}
|
|
50
|
-
.confirmation__hasError_tecu4 .confirmation__getCodeButton_tecu4 {
|
|
51
|
-
margin-top: 0;
|
|
52
|
-
}
|
|
53
|
-
.confirmation__hasError_tecu4 .confirmation__info_tecu4 {
|
|
54
|
-
margin-top: 0;
|
|
55
|
-
}
|
|
56
|
-
.confirmation__hasError_tecu4 .confirmation__customContent_tecu4 {
|
|
57
|
-
margin-bottom: var(--gap-2xl);
|
|
58
|
-
}
|
|
59
|
-
.confirmation__info_tecu4 {
|
|
60
|
-
margin: var(--gap-2xs) 0;
|
|
61
|
-
}
|
|
62
|
-
.confirmation__loaderWrap_tecu4 {
|
|
63
|
-
display: flex;
|
|
64
|
-
align-items: center;
|
|
65
|
-
margin-bottom: var(--gap-xs);
|
|
66
|
-
}
|
|
67
|
-
.confirmation__loader_tecu4 {
|
|
68
|
-
margin-right: var(--gap-xs);
|
|
69
|
-
}
|
|
70
|
-
.confirmation__center_tecu4 {
|
|
71
|
-
align-items: center
|
|
72
|
-
}
|
|
73
|
-
.confirmation__center_tecu4 .confirmation__loaderWrap_tecu4 {
|
|
74
|
-
justify-content: center;
|
|
75
|
-
}
|
|
76
|
-
.confirmation__timePassed_tecu4 {
|
|
77
|
-
display: flex;
|
|
78
|
-
min-width: 3em;
|
|
79
|
-
}
|
|
80
|
-
.confirmation__getCodeButton_tecu4 {
|
|
81
|
-
margin-top: var(--gap-2xl);
|
|
82
|
-
}
|
|
83
|
-
.confirmation__noAttemptsLeftMessage_tecu4 {
|
|
84
|
-
margin: var(--gap-2xs) 0 var(--gap-xs);
|
|
85
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { MouseEvent, FC } from 'react';
|
|
2
|
-
type OverlimitProps = {
|
|
3
|
-
duration?: number;
|
|
4
|
-
buttonRetryText: string;
|
|
5
|
-
hasFatalError: boolean;
|
|
6
|
-
title: string;
|
|
7
|
-
text: string;
|
|
8
|
-
onOverlimitCountdownFinished: () => void;
|
|
9
|
-
onOverlimitRepeatSms: (event: MouseEvent) => void;
|
|
10
|
-
};
|
|
11
|
-
declare const Overlimit: FC<OverlimitProps>;
|
|
12
|
-
export { OverlimitProps, Overlimit };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState, useCallback, useEffect } from 'react';
|
|
2
|
-
import 'classnames';
|
|
3
|
-
import { Button } from '@alfalab/core-components-button/dist/modern';
|
|
4
|
-
import '@alfalab/utils';
|
|
5
|
-
import '@alfalab/hooks';
|
|
6
|
-
import { CountdownLoader } from '../countdown-loader/component.js';
|
|
7
|
-
import { formatMsAsMinutes } from '../countdown/component.js';
|
|
8
|
-
import { CrossCircleMIcon } from '@alfalab/icons-glyph';
|
|
9
|
-
|
|
10
|
-
var styles = {"component":"confirmation__component_1iqq7","title":"confirmation__title_1iqq7","description":"confirmation__description_1iqq7","countdown":"confirmation__countdown_1iqq7","loader":"confirmation__loader_1iqq7","timePassed":"confirmation__timePassed_1iqq7","getCodeButton":"confirmation__getCodeButton_1iqq7","alertIcon":"confirmation__alertIcon_1iqq7"};
|
|
11
|
-
require('./index.css')
|
|
12
|
-
|
|
13
|
-
const Overlimit = ({ duration = 60000, buttonRetryText, hasFatalError, onOverlimitRepeatSms, onOverlimitCountdownFinished, text, title, }) => {
|
|
14
|
-
const timerId = useRef(0);
|
|
15
|
-
const start = useRef(0);
|
|
16
|
-
const [isBlockingOver, setIsBlockingOver] = useState(false);
|
|
17
|
-
const [timePassed, setTimePassed] = useState(0);
|
|
18
|
-
const stopTimer = useCallback(() => {
|
|
19
|
-
window.clearInterval(timerId.current);
|
|
20
|
-
}, []);
|
|
21
|
-
const updateProgress = useCallback(() => {
|
|
22
|
-
const passed = Date.now() - start.current;
|
|
23
|
-
if (passed >= duration) {
|
|
24
|
-
setIsBlockingOver(true);
|
|
25
|
-
if (onOverlimitCountdownFinished) {
|
|
26
|
-
onOverlimitCountdownFinished();
|
|
27
|
-
}
|
|
28
|
-
stopTimer();
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
setTimePassed(passed);
|
|
32
|
-
}
|
|
33
|
-
}, [duration, onOverlimitCountdownFinished, stopTimer]);
|
|
34
|
-
const startTimer = useCallback(() => {
|
|
35
|
-
start.current = Date.now();
|
|
36
|
-
updateProgress();
|
|
37
|
-
timerId.current = window.setInterval(updateProgress, 50);
|
|
38
|
-
}, [updateProgress]);
|
|
39
|
-
const handleRepeatSmsButtonClick = useCallback((event) => {
|
|
40
|
-
setIsBlockingOver(false);
|
|
41
|
-
if (onOverlimitRepeatSms) {
|
|
42
|
-
onOverlimitRepeatSms(event);
|
|
43
|
-
}
|
|
44
|
-
startTimer();
|
|
45
|
-
}, [onOverlimitRepeatSms, startTimer]);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
startTimer();
|
|
48
|
-
return () => {
|
|
49
|
-
stopTimer();
|
|
50
|
-
};
|
|
51
|
-
}, [startTimer, stopTimer]);
|
|
52
|
-
const progress = timePassed / duration;
|
|
53
|
-
return (React.createElement("div", { className: styles.component },
|
|
54
|
-
hasFatalError && (React.createElement("div", { className: styles.alertIcon },
|
|
55
|
-
React.createElement(CrossCircleMIcon, { "data-test-id": 'alert-icon', width: 64, height: 64 }))),
|
|
56
|
-
React.createElement("span", { className: styles.title }, title),
|
|
57
|
-
React.createElement("div", { className: styles.description },
|
|
58
|
-
React.createElement("div", null, text),
|
|
59
|
-
isBlockingOver ? (React.createElement(Button, { size: 'xs', view: 'secondary', onClick: handleRepeatSmsButtonClick, className: styles.getCodeButton }, buttonRetryText)) : (React.createElement("div", { className: styles.countdown },
|
|
60
|
-
React.createElement(CountdownLoader, { progress: progress, className: styles.loader }),
|
|
61
|
-
React.createElement("div", { className: styles.timePassed }, formatMsAsMinutes(duration - timePassed)))))));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export { Overlimit };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
import 'classnames';
|
|
3
|
-
import '@alfalab/core-components-button/dist/modern';
|
|
4
|
-
import '@alfalab/utils';
|
|
5
|
-
import '@alfalab/hooks';
|
|
6
|
-
import '../countdown-loader/component.js';
|
|
7
|
-
import '../countdown/component.js';
|
|
8
|
-
import '@alfalab/icons-glyph';
|
|
9
|
-
export { Overlimit } from './component.js';
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { FC, MutableRefObject, ReactNode } from "react";
|
|
4
|
-
import { ContentAlign } from "../../component";
|
|
5
|
-
type SignConfirmationProps = {
|
|
6
|
-
codeChecking: boolean;
|
|
7
|
-
codeSending: boolean;
|
|
8
|
-
smsHintVisible: boolean;
|
|
9
|
-
requiredCharAmount: number;
|
|
10
|
-
countdownDuration: number;
|
|
11
|
-
additionalContent: React.ReactNode;
|
|
12
|
-
hasPhoneMask: boolean;
|
|
13
|
-
phone?: string;
|
|
14
|
-
code: string;
|
|
15
|
-
errorText: string;
|
|
16
|
-
error: boolean;
|
|
17
|
-
title: string | React.ReactNode;
|
|
18
|
-
codeCheckingText: string;
|
|
19
|
-
codeSendingText: string;
|
|
20
|
-
hasSmsCountdown: boolean;
|
|
21
|
-
inputRef: MutableRefObject<HTMLInputElement | null>;
|
|
22
|
-
alignContent: ContentAlign;
|
|
23
|
-
noAttemptsLeftMessage?: string;
|
|
24
|
-
buttonRetryText: string;
|
|
25
|
-
countdownContent?: ReactNode;
|
|
26
|
-
onInputFinished: ({ code }: {
|
|
27
|
-
code: string;
|
|
28
|
-
}) => void;
|
|
29
|
-
onInputChange: ({ code }: {
|
|
30
|
-
code: string;
|
|
31
|
-
}) => void;
|
|
32
|
-
onSmsRetryClick: (event: React.MouseEvent) => void;
|
|
33
|
-
onCountdownFinished: () => void;
|
|
34
|
-
onSmsHintLinkClick: (event: React.MouseEvent) => void;
|
|
35
|
-
};
|
|
36
|
-
declare const SignConfirmation: FC<SignConfirmationProps>;
|
|
37
|
-
export { SignConfirmationProps, SignConfirmation };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import cn from 'classnames';
|
|
3
|
-
import '@alfalab/core-components-button/dist/modern';
|
|
4
|
-
import { Link } from '@alfalab/core-components-link/dist/modern';
|
|
5
|
-
import '@alfalab/utils';
|
|
6
|
-
import '@alfalab/hooks';
|
|
7
|
-
import '../countdown-loader/component.js';
|
|
8
|
-
import { Countdown } from '../countdown/component.js';
|
|
9
|
-
import { Loader } from '@alfalab/core-components-loader/dist/modern';
|
|
10
|
-
import '../code-input/utils.js';
|
|
11
|
-
import { CodeInput } from '../code-input/component.js';
|
|
12
|
-
|
|
13
|
-
var styles = {"component":"confirmation__component_srlhu","countdown":"confirmation__countdown_srlhu","hidden":"confirmation__hidden_srlhu","header":"confirmation__header_srlhu","inputContainer":"confirmation__inputContainer_srlhu","smsComeLinkWrap":"confirmation__smsComeLinkWrap_srlhu","smsComeLink":"confirmation__smsComeLink_srlhu","error":"confirmation__error_srlhu","loaderWrap":"confirmation__loaderWrap_srlhu","loaderText":"confirmation__loaderText_srlhu","center":"confirmation__center_srlhu","codeInput":"confirmation__codeInput_srlhu"};
|
|
14
|
-
require('./index.css')
|
|
15
|
-
|
|
16
|
-
const SignConfirmation = ({ codeChecking, codeSending, smsHintVisible, requiredCharAmount, countdownDuration, additionalContent, hasPhoneMask, phone, code: inputValue, error, errorText, title, hasSmsCountdown, inputRef, codeCheckingText, codeSendingText, alignContent, noAttemptsLeftMessage, buttonRetryText, countdownContent, onInputFinished, onInputChange, onSmsRetryClick, onCountdownFinished, onSmsHintLinkClick, }) => {
|
|
17
|
-
const processing = codeChecking || codeSending;
|
|
18
|
-
const displayedError = processing ? '' : errorText;
|
|
19
|
-
const handleInputKeyDown = useCallback((event) => {
|
|
20
|
-
if (event.key === 'Enter') {
|
|
21
|
-
onInputFinished({ code: event.target.value });
|
|
22
|
-
}
|
|
23
|
-
}, [onInputFinished]);
|
|
24
|
-
const handleInputFinished = useCallback((code) => {
|
|
25
|
-
onInputFinished({ code });
|
|
26
|
-
if (inputRef.current) {
|
|
27
|
-
inputRef.current.blur();
|
|
28
|
-
}
|
|
29
|
-
}, [onInputFinished, inputRef]);
|
|
30
|
-
const handleInputChange = useCallback((code) => {
|
|
31
|
-
if (code.length === requiredCharAmount) {
|
|
32
|
-
handleInputFinished(code);
|
|
33
|
-
}
|
|
34
|
-
onInputChange({ code });
|
|
35
|
-
}, [handleInputFinished, onInputChange, requiredCharAmount]);
|
|
36
|
-
return (React.createElement("div", { className: cn(styles.component, styles[alignContent]) },
|
|
37
|
-
typeof title === 'string' ? React.createElement("span", { className: styles.header }, title) : title,
|
|
38
|
-
React.createElement("div", { className: styles.inputContainer },
|
|
39
|
-
React.createElement(CodeInput, { processing: processing, error: error, value: inputValue, ref: inputRef, slotsCount: requiredCharAmount, className: styles.codeInput, alignContent: alignContent, handleChange: handleInputChange, handleInputKeyDown: handleInputKeyDown }),
|
|
40
|
-
displayedError && (React.createElement("div", { className: styles.error, role: 'alert' }, displayedError))),
|
|
41
|
-
processing && (React.createElement("div", { className: styles.loaderWrap },
|
|
42
|
-
React.createElement(Loader, null),
|
|
43
|
-
React.createElement("span", { className: styles.loaderText }, codeChecking ? codeCheckingText : codeSendingText))),
|
|
44
|
-
hasSmsCountdown && (React.createElement("div", { className: cn('countdown', styles.countdown, { [styles.hidden]: processing }) },
|
|
45
|
-
React.createElement(Countdown, { duration: countdownDuration, phone: phone, hasPhoneMask: hasPhoneMask, alignContent: alignContent, noAttemptsLeftMessage: noAttemptsLeftMessage, hasError: Boolean(displayedError), buttonRetryText: buttonRetryText, content: countdownContent, onRepeatSms: onSmsRetryClick, onCountdownFinished: onCountdownFinished }))),
|
|
46
|
-
smsHintVisible && (React.createElement("div", { className: styles.smsComeLinkWrap },
|
|
47
|
-
React.createElement(Link, { onClick: onSmsHintLinkClick, className: styles.smsComeLink, view: 'secondary', pseudo: true }, "\u041D\u0435 \u043F\u0440\u0438\u0445\u043E\u0434\u0438\u0442 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435?"))),
|
|
48
|
-
React.createElement("div", null, additionalContent)));
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export { SignConfirmation };
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/* hash: u6g7x */
|
|
2
|
-
:root {
|
|
3
|
-
--color-light-text-negative: #d91d0b;
|
|
4
|
-
--color-light-text-primary: #0b1f35;
|
|
5
|
-
--color-light-text-secondary: #546272;
|
|
6
|
-
}
|
|
7
|
-
:root {
|
|
8
|
-
|
|
9
|
-
/* Hard */
|
|
10
|
-
|
|
11
|
-
/* Up */
|
|
12
|
-
|
|
13
|
-
/* Hard up */
|
|
14
|
-
}
|
|
15
|
-
:root {
|
|
16
|
-
--gap-xs: 8px;
|
|
17
|
-
--gap-s: 12px;
|
|
18
|
-
--gap-l: 20px;
|
|
19
|
-
--gap-3xl: 40px;
|
|
20
|
-
}
|
|
21
|
-
:root {
|
|
22
|
-
--font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
|
|
23
|
-
sans-serif;
|
|
24
|
-
}
|
|
25
|
-
:root {
|
|
26
|
-
/* title */
|
|
27
|
-
--confirmation-title-font-size: 22px;
|
|
28
|
-
--confirmation-title-line-height: 26px;
|
|
29
|
-
--confirmation-title-font-weight: 700;
|
|
30
|
-
--confirmation-title-font-family: var(--font-family-system);
|
|
31
|
-
--confirmation-title-color: var(--color-light-text-primary);
|
|
32
|
-
--confirmation-title-font-feature-settings: normal;
|
|
33
|
-
|
|
34
|
-
/* text */
|
|
35
|
-
--confirmation-text-font-size: 16px;
|
|
36
|
-
--confirmation-text-line-height: 24px;
|
|
37
|
-
--confirmation-text-font-weight: 400;
|
|
38
|
-
--confirmation-text-font-family: var(--font-family-system);
|
|
39
|
-
--confirmation-text-color: var(--color-light-text-secondary);
|
|
40
|
-
|
|
41
|
-
/* error */
|
|
42
|
-
--confirmation-error-color: var(--color-light-text-negative);
|
|
43
|
-
|
|
44
|
-
/* input */
|
|
45
|
-
}
|
|
46
|
-
.confirmation__component_srlhu {
|
|
47
|
-
display: flex;
|
|
48
|
-
flex-direction: column;
|
|
49
|
-
}
|
|
50
|
-
.confirmation__countdown_srlhu {
|
|
51
|
-
max-height: 300px;
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
transition: max-height 0.15s ease;
|
|
54
|
-
}
|
|
55
|
-
.confirmation__hidden_srlhu {
|
|
56
|
-
opacity: 0;
|
|
57
|
-
max-height: 0;
|
|
58
|
-
}
|
|
59
|
-
.confirmation__header_srlhu {
|
|
60
|
-
font-size: var(--confirmation-title-font-size);
|
|
61
|
-
line-height: var(--confirmation-title-line-height);
|
|
62
|
-
font-weight: var(--confirmation-title-font-weight);
|
|
63
|
-
font-family: var(--confirmation-title-font-family);
|
|
64
|
-
color: var(--confirmation-title-color);
|
|
65
|
-
font-feature-settings: var(--confirmation-title-font-feature-settings);
|
|
66
|
-
|
|
67
|
-
margin-bottom: var(--gap-3xl);
|
|
68
|
-
color: var(--confirmation-title-color);
|
|
69
|
-
}
|
|
70
|
-
.confirmation__inputContainer_srlhu {
|
|
71
|
-
display: flex;
|
|
72
|
-
flex-direction: column;
|
|
73
|
-
}
|
|
74
|
-
.confirmation__smsComeLinkWrap_srlhu {
|
|
75
|
-
margin-top: var(--gap-l);
|
|
76
|
-
}
|
|
77
|
-
.confirmation__smsComeLink_srlhu {
|
|
78
|
-
font-size: 14px;
|
|
79
|
-
line-height: 20px;
|
|
80
|
-
font-weight: 400;
|
|
81
|
-
}
|
|
82
|
-
.confirmation__error_srlhu {
|
|
83
|
-
font-size: 14px;
|
|
84
|
-
line-height: 20px;
|
|
85
|
-
font-weight: 400;
|
|
86
|
-
|
|
87
|
-
margin-top: var(--gap-xs);
|
|
88
|
-
color: var(--confirmation-error-color);
|
|
89
|
-
}
|
|
90
|
-
.confirmation__loaderWrap_srlhu {
|
|
91
|
-
display: flex;
|
|
92
|
-
align-items: center;
|
|
93
|
-
margin: var(--gap-3xl) 0 var(--gap-xs);
|
|
94
|
-
}
|
|
95
|
-
.confirmation__loaderText_srlhu {
|
|
96
|
-
font-size: var(--confirmation-text-font-size);
|
|
97
|
-
line-height: var(--confirmation-text-line-height);
|
|
98
|
-
font-weight: var(--confirmation-text-font-weight);
|
|
99
|
-
font-family: var(--confirmation-text-font-family);
|
|
100
|
-
color: var(--confirmation-text-color);
|
|
101
|
-
|
|
102
|
-
margin-left: var(--gap-s);
|
|
103
|
-
color: var(--confirmation-text-color);
|
|
104
|
-
}
|
|
105
|
-
.confirmation__center_srlhu .confirmation__codeInput_srlhu,
|
|
106
|
-
.confirmation__center_srlhu .confirmation__loaderWrap_srlhu {
|
|
107
|
-
justify-content: center;
|
|
108
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
import 'classnames';
|
|
3
|
-
import '@alfalab/core-components-button/dist/modern';
|
|
4
|
-
import '@alfalab/core-components-link/dist/modern';
|
|
5
|
-
import '@alfalab/utils';
|
|
6
|
-
import '@alfalab/hooks';
|
|
7
|
-
import '../countdown-loader/component.js';
|
|
8
|
-
import '../countdown/component.js';
|
|
9
|
-
import '@alfalab/core-components-loader/dist/modern';
|
|
10
|
-
import '../code-input/utils.js';
|
|
11
|
-
import '../code-input/component.js';
|
|
12
|
-
export { SignConfirmation } from './component.js';
|