@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.
- package/CHANGELOG.md +59 -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 +5 -4
- 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,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,64 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var cn = require('classnames');
|
|
7
|
-
require('@alfalab/core-components-button/dist/cssm');
|
|
8
|
-
var coreComponentsLink = require('@alfalab/core-components-link/dist/cssm');
|
|
9
|
-
require('@alfalab/utils');
|
|
10
|
-
require('@alfalab/hooks');
|
|
11
|
-
require('../countdown-loader/index.module.css');
|
|
12
|
-
require('../countdown-loader/component.js');
|
|
13
|
-
require('../countdown/index.module.css');
|
|
14
|
-
var components_countdown_component = require('../countdown/component.js');
|
|
15
|
-
var coreComponentsLoader = require('@alfalab/core-components-loader/dist/cssm');
|
|
16
|
-
var components_codeInput_component = require('../code-input/component.js');
|
|
17
|
-
require('../code-input/utils.js');
|
|
18
|
-
require('../code-input/index.module.css');
|
|
19
|
-
var styles = require('./index.module.css');
|
|
20
|
-
|
|
21
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
|
-
|
|
23
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
-
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
25
|
-
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
|
|
26
|
-
|
|
27
|
-
var SignConfirmation = function (_a) {
|
|
28
|
-
var _b;
|
|
29
|
-
var codeChecking = _a.codeChecking, codeSending = _a.codeSending, smsHintVisible = _a.smsHintVisible, requiredCharAmount = _a.requiredCharAmount, countdownDuration = _a.countdownDuration, additionalContent = _a.additionalContent, hasPhoneMask = _a.hasPhoneMask, phone = _a.phone, inputValue = _a.code, error = _a.error, errorText = _a.errorText, title = _a.title, hasSmsCountdown = _a.hasSmsCountdown, inputRef = _a.inputRef, codeCheckingText = _a.codeCheckingText, codeSendingText = _a.codeSendingText, alignContent = _a.alignContent, noAttemptsLeftMessage = _a.noAttemptsLeftMessage, buttonRetryText = _a.buttonRetryText, countdownContent = _a.countdownContent, onInputFinished = _a.onInputFinished, onInputChange = _a.onInputChange, onSmsRetryClick = _a.onSmsRetryClick, onCountdownFinished = _a.onCountdownFinished, onSmsHintLinkClick = _a.onSmsHintLinkClick;
|
|
30
|
-
var processing = codeChecking || codeSending;
|
|
31
|
-
var displayedError = processing ? '' : errorText;
|
|
32
|
-
var handleInputKeyDown = React.useCallback(function (event) {
|
|
33
|
-
if (event.key === 'Enter') {
|
|
34
|
-
onInputFinished({ code: event.target.value });
|
|
35
|
-
}
|
|
36
|
-
}, [onInputFinished]);
|
|
37
|
-
var handleInputFinished = React.useCallback(function (code) {
|
|
38
|
-
onInputFinished({ code: code });
|
|
39
|
-
if (inputRef.current) {
|
|
40
|
-
inputRef.current.blur();
|
|
41
|
-
}
|
|
42
|
-
}, [onInputFinished, inputRef]);
|
|
43
|
-
var handleInputChange = React.useCallback(function (code) {
|
|
44
|
-
if (code.length === requiredCharAmount) {
|
|
45
|
-
handleInputFinished(code);
|
|
46
|
-
}
|
|
47
|
-
onInputChange({ code: code });
|
|
48
|
-
}, [handleInputFinished, onInputChange, requiredCharAmount]);
|
|
49
|
-
return (React__default['default'].createElement("div", { className: cn__default['default'](styles__default['default'].component, styles__default['default'][alignContent]) },
|
|
50
|
-
typeof title === 'string' ? React__default['default'].createElement("span", { className: styles__default['default'].header }, title) : title,
|
|
51
|
-
React__default['default'].createElement("div", { className: styles__default['default'].inputContainer },
|
|
52
|
-
React__default['default'].createElement(components_codeInput_component.CodeInput, { processing: processing, error: error, value: inputValue, ref: inputRef, slotsCount: requiredCharAmount, className: styles__default['default'].codeInput, alignContent: alignContent, handleChange: handleInputChange, handleInputKeyDown: handleInputKeyDown }),
|
|
53
|
-
displayedError && (React__default['default'].createElement("div", { className: styles__default['default'].error, role: 'alert' }, displayedError))),
|
|
54
|
-
processing && (React__default['default'].createElement("div", { className: styles__default['default'].loaderWrap },
|
|
55
|
-
React__default['default'].createElement(coreComponentsLoader.Loader, null),
|
|
56
|
-
React__default['default'].createElement("span", { className: styles__default['default'].loaderText }, codeChecking ? codeCheckingText : codeSendingText))),
|
|
57
|
-
hasSmsCountdown && (React__default['default'].createElement("div", { className: cn__default['default']('countdown', styles__default['default'].countdown, (_b = {}, _b[styles__default['default'].hidden] = processing, _b)) },
|
|
58
|
-
React__default['default'].createElement(components_countdown_component.Countdown, { duration: countdownDuration, phone: phone, hasPhoneMask: hasPhoneMask, alignContent: alignContent, noAttemptsLeftMessage: noAttemptsLeftMessage, hasError: Boolean(displayedError), buttonRetryText: buttonRetryText, content: countdownContent, onRepeatSms: onSmsRetryClick, onCountdownFinished: onCountdownFinished }))),
|
|
59
|
-
smsHintVisible && (React__default['default'].createElement("div", { className: styles__default['default'].smsComeLinkWrap },
|
|
60
|
-
React__default['default'].createElement(coreComponentsLink.Link, { onClick: onSmsHintLinkClick, className: styles__default['default'].smsComeLink, view: 'secondary', pseudo: true }, "\u041D\u0435 \u043F\u0440\u0438\u0445\u043E\u0434\u0438\u0442 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435?"))),
|
|
61
|
-
React__default['default'].createElement("div", null, additionalContent)));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
exports.SignConfirmation = SignConfirmation;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
require('react');
|
|
6
|
-
require('classnames');
|
|
7
|
-
require('@alfalab/core-components-button/dist/cssm');
|
|
8
|
-
require('@alfalab/core-components-link/dist/cssm');
|
|
9
|
-
require('@alfalab/utils');
|
|
10
|
-
require('@alfalab/hooks');
|
|
11
|
-
require('../countdown-loader/index.module.css');
|
|
12
|
-
require('../countdown-loader/component.js');
|
|
13
|
-
require('../countdown/index.module.css');
|
|
14
|
-
require('../countdown/component.js');
|
|
15
|
-
require('@alfalab/core-components-loader/dist/cssm');
|
|
16
|
-
require('../code-input/component.js');
|
|
17
|
-
require('../code-input/utils.js');
|
|
18
|
-
require('../code-input/index.module.css');
|
|
19
|
-
require('./index.module.css');
|
|
20
|
-
var components_signConfirmation_component = require('./component.js');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
exports.SignConfirmation = components_signConfirmation_component.SignConfirmation;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { KeyboardEvent } from "react";
|
|
4
|
-
import { ContentAlign } from "../../component";
|
|
5
|
-
type CodeInputProps = {
|
|
6
|
-
processing: boolean;
|
|
7
|
-
value: string;
|
|
8
|
-
slotsCount: number;
|
|
9
|
-
error: boolean;
|
|
10
|
-
className?: string;
|
|
11
|
-
alignContent: ContentAlign;
|
|
12
|
-
handleChange: (code: string) => void;
|
|
13
|
-
handleInputKeyDown: (event: KeyboardEvent) => void;
|
|
14
|
-
};
|
|
15
|
-
declare const CodeInput: React.ForwardRefExoticComponent<CodeInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
16
|
-
export { CodeInput };
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useImperativeHandle, useCallback, useEffect } from 'react';
|
|
2
|
-
import cn from 'classnames';
|
|
3
|
-
import { usePrevious } from '@alfalab/hooks';
|
|
4
|
-
import { mergeArrays } from './utils.js';
|
|
5
|
-
|
|
6
|
-
/*! *****************************************************************************
|
|
7
|
-
Copyright (c) Microsoft Corporation.
|
|
8
|
-
|
|
9
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
-
purpose with or without fee is hereby granted.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
-
***************************************************************************** */
|
|
20
|
-
function __spreadArrays() {
|
|
21
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
22
|
-
s += arguments[i].length;
|
|
23
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
24
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
25
|
-
r[k] = a[j];
|
|
26
|
-
return r;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var styles = {"component":"confirmation__component_8b7fm","input":"confirmation__input_8b7fm","hasError":"confirmation__hasError_8b7fm","center":"confirmation__center_8b7fm","disabled":"confirmation__disabled_8b7fm","compact":"confirmation__compact_8b7fm","shake":"confirmation__shake_8b7fm"};
|
|
30
|
-
require('./index.css')
|
|
31
|
-
|
|
32
|
-
var Input = function (_a) {
|
|
33
|
-
var _b;
|
|
34
|
-
var index = _a.index, slotsCount = _a.slotsCount, error = _a.error, processing = _a.processing, value = _a.value, alignContent = _a.alignContent, handleChange = _a.handleChange, handleInputKeyDown = _a.handleInputKeyDown, setRef = _a.setRef, focus = _a.focus;
|
|
35
|
-
var splittedValue = value.split('');
|
|
36
|
-
var inputRef = useRef(null);
|
|
37
|
-
var onChange = function (event) {
|
|
38
|
-
var targetValue = event.target.value;
|
|
39
|
-
if (/^\d$/.test(targetValue)) {
|
|
40
|
-
var newValues = __spreadArrays(splittedValue);
|
|
41
|
-
newValues[index] = targetValue;
|
|
42
|
-
handleChange(newValues.join(''));
|
|
43
|
-
}
|
|
44
|
-
else if (/^\d{1,}$/.test(targetValue) && index !== slotsCount - 1) {
|
|
45
|
-
/*
|
|
46
|
-
* если пользователь хочет ввести более 1 цифры в инпут,
|
|
47
|
-
* то предполагаем, что это вставка кода (например, из смс)
|
|
48
|
-
*/
|
|
49
|
-
var newValues = mergeArrays({
|
|
50
|
-
sourceArray: splittedValue,
|
|
51
|
-
targetArray: targetValue.split(''),
|
|
52
|
-
startIndex: index,
|
|
53
|
-
resultArrayLength: slotsCount,
|
|
54
|
-
});
|
|
55
|
-
handleChange(newValues.join(''));
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var onInputKeyDown = function (event) {
|
|
59
|
-
var key = event.key;
|
|
60
|
-
var newValues = __spreadArrays(splittedValue);
|
|
61
|
-
switch (key) {
|
|
62
|
-
case 'Backspace':
|
|
63
|
-
case 'Delete':
|
|
64
|
-
newValues[index] = '';
|
|
65
|
-
handleChange(newValues.join('').trim());
|
|
66
|
-
if (index !== 0) {
|
|
67
|
-
focus(index - 1);
|
|
68
|
-
}
|
|
69
|
-
break;
|
|
70
|
-
case 'ArrowRight':
|
|
71
|
-
if (index !== slotsCount - 1) {
|
|
72
|
-
focus(index + 1);
|
|
73
|
-
}
|
|
74
|
-
break;
|
|
75
|
-
case 'ArrowLeft':
|
|
76
|
-
if (index !== 0) {
|
|
77
|
-
focus(index - 1);
|
|
78
|
-
}
|
|
79
|
-
break;
|
|
80
|
-
case 'Home':
|
|
81
|
-
focus(0);
|
|
82
|
-
break;
|
|
83
|
-
case 'End':
|
|
84
|
-
focus(slotsCount - 1);
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
handleInputKeyDown(event);
|
|
88
|
-
};
|
|
89
|
-
var handleRef = function (node) {
|
|
90
|
-
inputRef.current = node;
|
|
91
|
-
setRef({ node: node, index: index });
|
|
92
|
-
};
|
|
93
|
-
return (React.createElement("input", { className: cn(styles.input, styles[alignContent], (_b = {},
|
|
94
|
-
_b[styles.hasError] = error,
|
|
95
|
-
_b[styles.disabled] = processing,
|
|
96
|
-
_b)), disabled: processing, value: splittedValue[index] || '', autoComplete: index === 0 ? 'one-time-code' : '', inputMode: 'numeric', pattern: '[0-9]*', onChange: onChange, onKeyDown: onInputKeyDown, ref: handleRef }));
|
|
97
|
-
};
|
|
98
|
-
var CodeInput = forwardRef(function (_a, ref) {
|
|
99
|
-
var _b;
|
|
100
|
-
var processing = _a.processing, _c = _a.value, value = _c === void 0 ? '' : _c, slotsCount = _a.slotsCount, error = _a.error, handleInputKeyDown = _a.handleInputKeyDown, handleChange = _a.handleChange, className = _a.className, alignContent = _a.alignContent;
|
|
101
|
-
var inputs = useRef([]);
|
|
102
|
-
useImperativeHandle(ref, function () { return inputs.current[0]; });
|
|
103
|
-
var prevValue = usePrevious(value) || '';
|
|
104
|
-
var focus = useCallback(function (index) {
|
|
105
|
-
var input = inputs.current[index];
|
|
106
|
-
if (input) {
|
|
107
|
-
input.focus();
|
|
108
|
-
input.setSelectionRange(1, 1);
|
|
109
|
-
}
|
|
110
|
-
}, []);
|
|
111
|
-
var setRef = useCallback(function (_a) {
|
|
112
|
-
var node = _a.node, index = _a.index;
|
|
113
|
-
inputs.current[index] = node;
|
|
114
|
-
}, []);
|
|
115
|
-
/**
|
|
116
|
-
* Устанавливаем фокус на инпуте:
|
|
117
|
-
* 1) если код введен неверно
|
|
118
|
-
* 2) по нажатию кнопки 'Запросить код'
|
|
119
|
-
*/
|
|
120
|
-
useEffect(function () {
|
|
121
|
-
var inputIndex = value.length === slotsCount ? value.length - 1 : value.length;
|
|
122
|
-
var needFocus = !processing || error;
|
|
123
|
-
if (needFocus && value.length === prevValue.length) {
|
|
124
|
-
focus(inputIndex);
|
|
125
|
-
}
|
|
126
|
-
}, [focus, error, slotsCount, value.length, prevValue.length, processing]);
|
|
127
|
-
useEffect(function () {
|
|
128
|
-
if (value.length > prevValue.length && value.length < slotsCount) {
|
|
129
|
-
/**
|
|
130
|
-
* Если value.length увеличился - ставим фокус на следующем инпуте
|
|
131
|
-
*/
|
|
132
|
-
var nextInputIndex = value.length;
|
|
133
|
-
focus(nextInputIndex);
|
|
134
|
-
}
|
|
135
|
-
else if (value.length <= prevValue.length && value.length > 0) {
|
|
136
|
-
/**
|
|
137
|
-
* Если value.length уменьшился - ставим фокус на предыдущем инпуте
|
|
138
|
-
*/
|
|
139
|
-
var nextInputIndex = value.length - 1;
|
|
140
|
-
focus(nextInputIndex);
|
|
141
|
-
}
|
|
142
|
-
}, [value.length, prevValue.length, slotsCount, focus]);
|
|
143
|
-
return (React.createElement("div", { className: cn(styles.component, className, (_b = {},
|
|
144
|
-
_b[styles.shake] = Boolean(error),
|
|
145
|
-
_b[styles.compact] = slotsCount > 6,
|
|
146
|
-
_b)) }, new Array(slotsCount).fill('').map(function (_, index) { return (React.createElement(Input, { value: value, index: index, error: error, processing: processing, slotsCount: slotsCount, alignContent: alignContent, handleChange: handleChange, handleInputKeyDown: handleInputKeyDown, setRef: setRef, focus: focus,
|
|
147
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
148
|
-
key: index })); })));
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
export { CodeInput };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/* hash: 154em */
|
|
2
|
-
:root {
|
|
3
|
-
--color-light-bg-negative-muted: #feebea;
|
|
4
|
-
--color-light-bg-secondary: #f3f4f5;
|
|
5
|
-
--color-light-text-negative: #d91d0b;
|
|
6
|
-
--color-light-text-primary: #0b1f35;
|
|
7
|
-
--color-light-text-tertiary: #b6bcc3;
|
|
8
|
-
}
|
|
9
|
-
:root {
|
|
10
|
-
|
|
11
|
-
/* Hard */
|
|
12
|
-
|
|
13
|
-
/* Up */
|
|
14
|
-
|
|
15
|
-
/* Hard up */
|
|
16
|
-
}
|
|
17
|
-
:root {
|
|
18
|
-
--gap-2xs: 4px;
|
|
19
|
-
--gap-xs: 8px;
|
|
20
|
-
}
|
|
21
|
-
:root {
|
|
22
|
-
--font-family-system: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica,
|
|
23
|
-
sans-serif;
|
|
24
|
-
}
|
|
25
|
-
:root {
|
|
26
|
-
--border-radius-s: 4px;
|
|
27
|
-
}
|
|
28
|
-
:root {
|
|
29
|
-
/* title */
|
|
30
|
-
|
|
31
|
-
/* text */
|
|
32
|
-
|
|
33
|
-
/* error */
|
|
34
|
-
--confirmation-error-color: var(--color-light-text-negative);
|
|
35
|
-
|
|
36
|
-
/* input */
|
|
37
|
-
--confirmation-input-font-size: 30px;
|
|
38
|
-
--confirmation-input-font-weight: 700;
|
|
39
|
-
--confirmation-input-font-family: var(--font-family-system);
|
|
40
|
-
--confirmation-input-text-color: var(--color-light-text-primary);
|
|
41
|
-
--confirmation-input-bg-color: var(--color-light-bg-secondary);
|
|
42
|
-
--confirmation-input-error-bg-color: var(--color-light-bg-negative-muted);
|
|
43
|
-
}
|
|
44
|
-
.confirmation__component_8b7fm {
|
|
45
|
-
display: flex;
|
|
46
|
-
}
|
|
47
|
-
.confirmation__input_8b7fm {
|
|
48
|
-
flex-shrink: 0;
|
|
49
|
-
width: 36px;
|
|
50
|
-
height: 48px;
|
|
51
|
-
margin-right: var(--gap-xs);
|
|
52
|
-
padding: 0;
|
|
53
|
-
background-color: var(--confirmation-input-bg-color);
|
|
54
|
-
border: none;
|
|
55
|
-
border-radius: var(--border-radius-s);
|
|
56
|
-
box-sizing: border-box;
|
|
57
|
-
outline: none;
|
|
58
|
-
color: var(--confirmation-input-text-color);
|
|
59
|
-
text-align: center;
|
|
60
|
-
font-size: var(--confirmation-input-font-size);
|
|
61
|
-
font-weight: var(--confirmation-input-font-weight);
|
|
62
|
-
font-family: var(--confirmation-input-font-family)
|
|
63
|
-
}
|
|
64
|
-
.confirmation__input_8b7fm.confirmation__hasError_8b7fm {
|
|
65
|
-
color: var(--confirmation-error-color);
|
|
66
|
-
caret-color: var(--confirmation-input-text-color);
|
|
67
|
-
background-color: var(--confirmation-input-error-bg-color);
|
|
68
|
-
}
|
|
69
|
-
.confirmation__input_8b7fm.confirmation__center_8b7fm {
|
|
70
|
-
margin: 0 var(--gap-2xs);
|
|
71
|
-
}
|
|
72
|
-
.confirmation__input_8b7fm.confirmation__disabled_8b7fm {
|
|
73
|
-
color: var(--color-light-text-tertiary);
|
|
74
|
-
opacity: 1;
|
|
75
|
-
}
|
|
76
|
-
.confirmation__compact_8b7fm .confirmation__input_8b7fm {
|
|
77
|
-
width: 28px;
|
|
78
|
-
height: 40px;
|
|
79
|
-
}
|
|
80
|
-
@keyframes confirmation__shake_8b7fm {
|
|
81
|
-
0% {
|
|
82
|
-
transform: translateX(0);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
25% {
|
|
86
|
-
transform: translateX(-2px);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
75% {
|
|
90
|
-
transform: translateX(2px);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
100% {
|
|
94
|
-
transform: translateX(0);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
.confirmation__shake_8b7fm {
|
|
98
|
-
animation: confirmation__shake_8b7fm 0.15s linear 0s 3;
|
|
99
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Начиная с указанного индекса, заменяет элементы исходного массива
|
|
3
|
-
*/
|
|
4
|
-
declare const mergeArrays: ({ sourceArray, targetArray, startIndex, resultArrayLength, }: {
|
|
5
|
-
sourceArray: string[];
|
|
6
|
-
targetArray: string[];
|
|
7
|
-
startIndex: number;
|
|
8
|
-
resultArrayLength: number;
|
|
9
|
-
}) => string[];
|
|
10
|
-
export { mergeArrays };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Начиная с указанного индекса, заменяет элементы исходного массива
|
|
3
|
-
*/
|
|
4
|
-
var mergeArrays = function (_a) {
|
|
5
|
-
var sourceArray = _a.sourceArray, targetArray = _a.targetArray, startIndex = _a.startIndex, resultArrayLength = _a.resultArrayLength;
|
|
6
|
-
var insertedElemIndex = 0;
|
|
7
|
-
var result = new Array(resultArrayLength).fill('');
|
|
8
|
-
return result.map(function (_, index) {
|
|
9
|
-
if (index < startIndex) {
|
|
10
|
-
return sourceArray[index] || '';
|
|
11
|
-
}
|
|
12
|
-
// eslint-disable-next-line no-plusplus
|
|
13
|
-
return targetArray[insertedElemIndex++] || sourceArray[index] || '';
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { mergeArrays };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { MouseEvent, FC, ReactNode } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* TODO: Вынести это в utils
|
|
4
|
-
* Форматирование миллисекунд в hh:mm:ss.
|
|
5
|
-
*
|
|
6
|
-
* @param {Number} ms миллисекунды
|
|
7
|
-
* @returns {String} время в формате mm:ss
|
|
8
|
-
*/
|
|
9
|
-
declare function formatMsAsMinutes(ms: number): string;
|
|
10
|
-
type CountdownProps = {
|
|
11
|
-
duration: number;
|
|
12
|
-
hasPhoneMask: boolean;
|
|
13
|
-
phone?: string;
|
|
14
|
-
alignContent: string;
|
|
15
|
-
buttonRetryText: string;
|
|
16
|
-
noAttemptsLeftMessage?: string;
|
|
17
|
-
hasError: boolean;
|
|
18
|
-
content?: ReactNode;
|
|
19
|
-
onCountdownFinished?: () => void;
|
|
20
|
-
onRepeatSms: (event: MouseEvent) => void;
|
|
21
|
-
};
|
|
22
|
-
declare const Countdown: FC<CountdownProps>;
|
|
23
|
-
export { formatMsAsMinutes, CountdownProps, Countdown };
|
|
@@ -1,107 +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/esm';
|
|
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_1622v","hasError":"confirmation__hasError_1622v","getCodeButton":"confirmation__getCodeButton_1622v","info":"confirmation__info_1622v","customContent":"confirmation__customContent_1622v","loaderWrap":"confirmation__loaderWrap_1622v","loader":"confirmation__loader_1622v","center":"confirmation__center_1622v","timePassed":"confirmation__timePassed_1622v","noAttemptsLeftMessage":"confirmation__noAttemptsLeftMessage_1622v"};
|
|
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
|
-
var totalSeconds = Math.ceil(ms / 1000);
|
|
20
|
-
var totalMinutes = Math.floor(totalSeconds / 60);
|
|
21
|
-
var totalHours = Math.floor(totalMinutes / 60);
|
|
22
|
-
var seconds = totalSeconds % 60;
|
|
23
|
-
var paddedSeconds = ("00" + seconds).slice(-2);
|
|
24
|
-
if (totalHours > 0) {
|
|
25
|
-
var minutes = totalMinutes % 60;
|
|
26
|
-
var paddedMinutes_1 = ("00" + minutes).slice(-2);
|
|
27
|
-
var paddedHours = ("00" + totalHours).slice(-2);
|
|
28
|
-
return paddedHours + ":" + paddedMinutes_1 + ":" + paddedSeconds;
|
|
29
|
-
}
|
|
30
|
-
var paddedMinutes = ("00" + totalMinutes).slice(-2);
|
|
31
|
-
return paddedMinutes + ":" + paddedSeconds;
|
|
32
|
-
}
|
|
33
|
-
var Container = function (_a) {
|
|
34
|
-
var _b;
|
|
35
|
-
var alignContent = _a.alignContent, hasError = _a.hasError, children = _a.children;
|
|
36
|
-
return (React.createElement("div", { className: cn(styles.component, styles[alignContent], (_b = {},
|
|
37
|
-
_b[styles.hasError] = hasError,
|
|
38
|
-
_b)) }, children));
|
|
39
|
-
};
|
|
40
|
-
var Countdown = function (_a) {
|
|
41
|
-
var _b = _a.duration, duration = _b === void 0 ? 5000 : _b, _c = _a.phone, phone = _c === void 0 ? '' : _c, _d = _a.hasPhoneMask, hasPhoneMask = _d === void 0 ? true : _d, buttonRetryText = _a.buttonRetryText, alignContent = _a.alignContent, noAttemptsLeftMessage = _a.noAttemptsLeftMessage, hasError = _a.hasError, content = _a.content, onRepeatSms = _a.onRepeatSms, onCountdownFinished = _a.onCountdownFinished;
|
|
42
|
-
var timerId = useRef(0);
|
|
43
|
-
var start = useRef(0);
|
|
44
|
-
var _e = useState(false), repeatSmsButtonShow = _e[0], setRepeatSmsButtonShow = _e[1];
|
|
45
|
-
var _f = useState(0), timePassed = _f[0], setTimePassed = _f[1];
|
|
46
|
-
var noAttemptsLeftMessagePrev = usePrevious(noAttemptsLeftMessage);
|
|
47
|
-
var stopTimer = useCallback(function () {
|
|
48
|
-
window.clearInterval(timerId.current);
|
|
49
|
-
}, []);
|
|
50
|
-
var updateProgress = useCallback(function () {
|
|
51
|
-
var passed = Date.now() - start.current;
|
|
52
|
-
if (passed >= duration) {
|
|
53
|
-
setRepeatSmsButtonShow(true);
|
|
54
|
-
if (onCountdownFinished) {
|
|
55
|
-
onCountdownFinished();
|
|
56
|
-
}
|
|
57
|
-
stopTimer();
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
setTimePassed(passed);
|
|
61
|
-
}
|
|
62
|
-
}, [duration, onCountdownFinished, stopTimer]);
|
|
63
|
-
var startTimer = useCallback(function () {
|
|
64
|
-
start.current = Date.now();
|
|
65
|
-
updateProgress();
|
|
66
|
-
timerId.current = window.setInterval(updateProgress, 50);
|
|
67
|
-
}, [updateProgress]);
|
|
68
|
-
var handleRepeatSmsButtonClick = useCallback(function (event) {
|
|
69
|
-
setRepeatSmsButtonShow(false);
|
|
70
|
-
if (onRepeatSms) {
|
|
71
|
-
onRepeatSms(event);
|
|
72
|
-
}
|
|
73
|
-
startTimer();
|
|
74
|
-
}, [onRepeatSms, startTimer]);
|
|
75
|
-
useEffect(function () {
|
|
76
|
-
startTimer();
|
|
77
|
-
return function () {
|
|
78
|
-
stopTimer();
|
|
79
|
-
};
|
|
80
|
-
}, [startTimer, stopTimer]);
|
|
81
|
-
useEffect(function () {
|
|
82
|
-
// Если кончились попытки ввода кода, то останавливаем таймер
|
|
83
|
-
if (!noAttemptsLeftMessagePrev && noAttemptsLeftMessage) {
|
|
84
|
-
stopTimer();
|
|
85
|
-
}
|
|
86
|
-
}, [noAttemptsLeftMessage, noAttemptsLeftMessagePrev, stopTimer]);
|
|
87
|
-
var progress = timePassed / duration;
|
|
88
|
-
var formattedPhone = phoneNumber.format(phone);
|
|
89
|
-
var retryButton = (React.createElement(Button, { size: 'xs', view: 'secondary', onClick: handleRepeatSmsButtonClick, className: styles.getCodeButton }, buttonRetryText));
|
|
90
|
-
if (content) {
|
|
91
|
-
return (React.createElement(Container, { alignContent: alignContent, hasError: hasError },
|
|
92
|
-
React.createElement("div", { className: styles.customContent }, content),
|
|
93
|
-
retryButton));
|
|
94
|
-
}
|
|
95
|
-
return (React.createElement(Container, { alignContent: alignContent, hasError: hasError },
|
|
96
|
-
phone && !hasError && (React.createElement("div", null,
|
|
97
|
-
"\u041A\u043E\u0434 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u043D\u0430",
|
|
98
|
-
' ',
|
|
99
|
-
hasPhoneMask ? phoneNumber.mask(formattedPhone) : formattedPhone)),
|
|
100
|
-
noAttemptsLeftMessage ? (React.createElement("div", { className: styles.noAttemptsLeftMessage }, noAttemptsLeftMessage)) : repeatSmsButtonShow ? (retryButton) : (React.createElement("div", null,
|
|
101
|
-
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"),
|
|
102
|
-
React.createElement("div", { className: styles.loaderWrap },
|
|
103
|
-
React.createElement(CountdownLoader, { progress: progress, className: styles.loader }),
|
|
104
|
-
React.createElement("div", { className: styles.timePassed }, formatMsAsMinutes(duration - timePassed)))))));
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export { Countdown, formatMsAsMinutes };
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/* hash: 1bllo */
|
|
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_1622v {
|
|
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_1622v .confirmation__getCodeButton_1622v {
|
|
51
|
-
margin-top: 0;
|
|
52
|
-
}
|
|
53
|
-
.confirmation__hasError_1622v .confirmation__info_1622v {
|
|
54
|
-
margin-top: 0;
|
|
55
|
-
}
|
|
56
|
-
.confirmation__hasError_1622v .confirmation__customContent_1622v {
|
|
57
|
-
margin-bottom: var(--gap-2xl);
|
|
58
|
-
}
|
|
59
|
-
.confirmation__info_1622v {
|
|
60
|
-
margin: var(--gap-2xs) 0;
|
|
61
|
-
}
|
|
62
|
-
.confirmation__loaderWrap_1622v {
|
|
63
|
-
display: flex;
|
|
64
|
-
align-items: center;
|
|
65
|
-
margin-bottom: var(--gap-xs);
|
|
66
|
-
}
|
|
67
|
-
.confirmation__loader_1622v {
|
|
68
|
-
margin-right: var(--gap-xs);
|
|
69
|
-
}
|
|
70
|
-
.confirmation__center_1622v {
|
|
71
|
-
align-items: center
|
|
72
|
-
}
|
|
73
|
-
.confirmation__center_1622v .confirmation__loaderWrap_1622v {
|
|
74
|
-
justify-content: center;
|
|
75
|
-
}
|
|
76
|
-
.confirmation__timePassed_1622v {
|
|
77
|
-
display: flex;
|
|
78
|
-
min-width: 3em;
|
|
79
|
-
}
|
|
80
|
-
.confirmation__getCodeButton_1622v {
|
|
81
|
-
margin-top: var(--gap-2xl);
|
|
82
|
-
}
|
|
83
|
-
.confirmation__noAttemptsLeftMessage_1622v {
|
|
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 };
|