@alfalab/core-components-confirmation 12.4.7 → 12.4.8
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/component.desktop.js +4 -3
- package/component.mobile.js +6 -5
- package/component.responsive.js +5 -4
- package/components/base-confirmation/component.d.ts +4 -0
- package/components/base-confirmation/component.js +87 -13
- package/components/base-confirmation/index.css +2 -2
- package/components/base-confirmation/index.d.ts +1 -1
- package/components/base-confirmation/index.js +3 -2
- package/components/countdown-loader/component.js +1 -1
- package/components/countdown-loader/index.css +2 -2
- package/components/header/component.js +1 -1
- package/components/header/index.css +4 -4
- package/components/index.js +1 -1
- package/components/screens/fatal-error/component.js +1 -1
- package/components/screens/fatal-error/index.css +6 -6
- package/components/screens/hint/component.js +1 -1
- package/components/screens/hint/index.css +12 -12
- package/components/screens/index.js +1 -1
- package/components/screens/initial/component.js +1 -1
- package/components/screens/initial/countdown-section.js +1 -1
- package/components/screens/initial/index.css +18 -18
- package/components/screens/initial/index.js +1 -1
- package/components/screens/temp-block/component.js +1 -1
- package/components/screens/temp-block/index.css +7 -7
- package/{countdown-section-94a35216.d.ts → countdown-section-bda43975.d.ts} +0 -0
- package/{countdown-section-94a35216.js → countdown-section-bda43975.js} +1 -1
- package/cssm/component.desktop.js +3 -2
- package/cssm/component.mobile.js +4 -3
- package/cssm/component.responsive.js +4 -3
- package/cssm/components/base-confirmation/component.d.ts +4 -0
- package/cssm/components/base-confirmation/component.js +85 -13
- package/cssm/components/base-confirmation/index.d.ts +1 -1
- package/cssm/components/base-confirmation/index.js +2 -1
- package/cssm/desktop.js +2 -1
- package/cssm/index.js +2 -1
- package/cssm/mobile.js +2 -1
- package/cssm/responsive.js +4 -3
- package/desktop.js +3 -2
- package/esm/component.desktop.js +3 -2
- package/esm/component.mobile.js +4 -3
- package/esm/component.responsive.js +3 -2
- package/esm/components/base-confirmation/component.d.ts +4 -0
- package/esm/components/base-confirmation/component.js +85 -12
- package/esm/components/base-confirmation/index.css +2 -2
- package/esm/components/base-confirmation/index.d.ts +1 -1
- package/esm/components/base-confirmation/index.js +3 -2
- package/esm/components/countdown-loader/component.js +1 -1
- package/esm/components/countdown-loader/index.css +2 -2
- package/esm/components/header/component.js +1 -1
- package/esm/components/header/index.css +4 -4
- package/esm/components/index.js +1 -1
- package/esm/components/screens/fatal-error/component.js +1 -1
- package/esm/components/screens/fatal-error/index.css +6 -6
- package/esm/components/screens/hint/component.js +1 -1
- package/esm/components/screens/hint/index.css +12 -12
- package/esm/components/screens/index.js +1 -1
- package/esm/components/screens/initial/component.js +1 -1
- package/esm/components/screens/initial/countdown-section.js +1 -1
- package/esm/components/screens/initial/index.css +18 -18
- package/esm/components/screens/initial/index.js +1 -1
- package/esm/components/screens/temp-block/component.js +1 -1
- package/esm/components/screens/temp-block/index.css +7 -7
- package/esm/{countdown-section-1560b6e0.d.ts → countdown-section-6eb66678.d.ts} +0 -0
- package/esm/{countdown-section-1560b6e0.js → countdown-section-6eb66678.js} +1 -1
- package/esm/desktop.js +3 -2
- package/esm/index.js +3 -2
- package/esm/mobile.css +2 -2
- package/esm/mobile.js +3 -2
- package/esm/responsive.js +5 -4
- package/index.js +3 -2
- package/mobile.css +2 -2
- package/mobile.js +3 -2
- package/modern/component.desktop.js +1 -1
- package/modern/component.mobile.js +2 -2
- package/modern/component.responsive.js +1 -1
- package/modern/components/base-confirmation/component.js +2 -2
- package/modern/components/base-confirmation/index.css +2 -2
- package/modern/components/base-confirmation/index.js +1 -1
- package/modern/components/countdown-loader/component.js +1 -1
- package/modern/components/countdown-loader/index.css +2 -2
- package/modern/components/header/component.js +1 -1
- package/modern/components/header/index.css +4 -4
- package/modern/components/index.js +1 -1
- package/modern/components/screens/fatal-error/component.js +1 -1
- package/modern/components/screens/fatal-error/index.css +6 -6
- package/modern/components/screens/hint/component.js +1 -1
- package/modern/components/screens/hint/index.css +12 -12
- package/modern/components/screens/index.js +1 -1
- package/modern/components/screens/initial/component.js +1 -1
- package/modern/components/screens/initial/countdown-section.js +1 -1
- package/modern/components/screens/initial/index.css +18 -18
- package/modern/components/screens/initial/index.js +1 -1
- package/modern/components/screens/temp-block/component.js +1 -1
- package/modern/components/screens/temp-block/index.css +7 -7
- package/modern/{countdown-section-b0b34939.d.ts → countdown-section-f17bf1df.d.ts} +0 -0
- package/modern/{countdown-section-b0b34939.js → countdown-section-f17bf1df.js} +1 -1
- package/modern/desktop.js +1 -1
- package/modern/index.js +1 -1
- package/modern/mobile.css +2 -2
- package/modern/mobile.js +1 -1
- package/modern/responsive.js +1 -1
- package/package.json +8 -7
- package/responsive.js +5 -4
- package/component-adbf9996.d.ts +0 -37
- package/component-adbf9996.js +0 -130
- package/cssm/component-3c591970.d.ts +0 -37
- package/cssm/component-3c591970.js +0 -129
- package/esm/component-8d44589b.d.ts +0 -37
- package/esm/component-8d44589b.js +0 -122
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var components_baseConfirmation_component = require('./components/base-confirmation/component.js');
|
|
5
6
|
require('classnames');
|
|
6
7
|
require('@alfalab/hooks');
|
|
7
8
|
require('./context.js');
|
|
@@ -31,6 +32,6 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
31
32
|
|
|
32
33
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
33
34
|
|
|
34
|
-
var ConfirmationDesktop = function (props) { return (React__default.default.createElement(components_baseConfirmation_component.BaseConfirmation,
|
|
35
|
+
var ConfirmationDesktop = function (props) { return (React__default.default.createElement(components_baseConfirmation_component.BaseConfirmation, tslib.__assign({}, props))); };
|
|
35
36
|
|
|
36
37
|
exports.ConfirmationDesktop = ConfirmationDesktop;
|
package/cssm/component.mobile.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var cn = require('classnames');
|
|
6
|
+
var components_baseConfirmation_component = require('./components/base-confirmation/component.js');
|
|
6
7
|
var styles = require('./mobile.module.css');
|
|
7
8
|
require('@alfalab/hooks');
|
|
8
9
|
require('./context.js');
|
|
@@ -35,8 +36,8 @@ var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
|
35
36
|
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
36
37
|
|
|
37
38
|
var ConfirmationMobile = function (_a) {
|
|
38
|
-
var className = _a.className, resProps =
|
|
39
|
-
return (React__default.default.createElement(components_baseConfirmation_component.BaseConfirmation,
|
|
39
|
+
var className = _a.className, resProps = tslib.__rest(_a, ["className"]);
|
|
40
|
+
return (React__default.default.createElement(components_baseConfirmation_component.BaseConfirmation, tslib.__assign({ mobile: true, className: cn__default.default(className, styles__default.default.container) }, resProps)));
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
exports.ConfirmationMobile = ConfirmationMobile;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var hooks = require('@alfalab/hooks');
|
|
6
6
|
var component_desktop = require('./component.desktop.js');
|
|
7
7
|
var component_mobile = require('./component.mobile.js');
|
|
8
|
+
require('./components/base-confirmation/component.js');
|
|
8
9
|
require('classnames');
|
|
9
10
|
require('./context.js');
|
|
10
11
|
require('./utils.js');
|
|
@@ -35,12 +36,12 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
35
36
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
36
37
|
|
|
37
38
|
var ConfirmationResponsive = function (_a) {
|
|
38
|
-
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps =
|
|
39
|
+
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = tslib.__rest(_a, ["breakpoint"]);
|
|
39
40
|
var view = hooks.useMedia([
|
|
40
41
|
['mobile', "(max-width: ".concat(breakpoint - 1, "px)")],
|
|
41
42
|
['desktop', "(min-width: ".concat(breakpoint, "px)")],
|
|
42
43
|
], 'desktop')[0];
|
|
43
|
-
return view === 'desktop' ? (React__default.default.createElement(component_desktop.ConfirmationDesktop,
|
|
44
|
+
return view === 'desktop' ? (React__default.default.createElement(component_desktop.ConfirmationDesktop, tslib.__assign({}, restProps))) : (React__default.default.createElement(component_mobile.ConfirmationMobile, tslib.__assign({}, restProps)));
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
exports.ConfirmationResponsive = ConfirmationResponsive;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('react');
|
|
5
|
-
require('classnames');
|
|
6
|
-
require('@alfalab/hooks');
|
|
7
|
-
require('../../context.js');
|
|
8
|
-
require('../../types.js');
|
|
9
|
-
require('../../utils.js');
|
|
10
|
-
require('../screens/initial/component.js');
|
|
11
|
-
require('../screens/hint/component.js');
|
|
12
|
-
require('../screens/fatal-error/component.js');
|
|
13
|
-
require('../screens/temp-block/component.js');
|
|
14
|
-
require('./index.module.css');
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var cn = require('classnames');
|
|
6
|
+
var hooks = require('@alfalab/hooks');
|
|
7
|
+
var context = require('../../context.js');
|
|
8
|
+
var types = require('../../types.js');
|
|
9
|
+
var utils = require('../../utils.js');
|
|
10
|
+
var components_screens_initial_component = require('../screens/initial/component.js');
|
|
11
|
+
var components_screens_hint_component = require('../screens/hint/component.js');
|
|
12
|
+
var components_screens_fatalError_component = require('../screens/fatal-error/component.js');
|
|
13
|
+
var components_screens_tempBlock_component = require('../screens/temp-block/component.js');
|
|
14
|
+
var styles = require('./index.module.css');
|
|
15
15
|
require('@alfalab/core-components-button/cssm');
|
|
16
16
|
require('@alfalab/core-components-code-input/cssm');
|
|
17
17
|
require('@alfalab/core-components-link/cssm');
|
|
@@ -27,6 +27,78 @@ require('../countdown-loader/component.js');
|
|
|
27
27
|
require('../countdown-loader/index.module.css');
|
|
28
28
|
require('../screens/temp-block/index.module.css');
|
|
29
29
|
|
|
30
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
30
31
|
|
|
32
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
33
|
+
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
34
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
var confirmationScreens = {
|
|
37
|
+
INITIAL: components_screens_initial_component.Initial,
|
|
38
|
+
HINT: components_screens_hint_component.Hint,
|
|
39
|
+
FATAL_ERROR: components_screens_fatalError_component.FatalError,
|
|
40
|
+
TEMP_BLOCK: components_screens_tempBlock_component.TempBlock,
|
|
41
|
+
};
|
|
42
|
+
var BaseConfirmation = function (_a) {
|
|
43
|
+
var state = _a.state, screen = _a.screen, _b = _a.alignContent, alignContent = _b === void 0 ? 'left' : _b; _a.children; var _c = _a.requiredCharAmount, requiredCharAmount = _c === void 0 ? 5 : _c, _d = _a.countdownDuration, countdownDuration = _d === void 0 ? utils.ONE_MINUTE : _d, _e = _a.tempBlockDuration, tempBlockDuration = _e === void 0 ? utils.ONE_DAY : _e, phone = _a.phone, blockSmsRetry = _a.blockSmsRetry, dataTestId = _a.dataTestId, className = _a.className, getScreensMap = _a.getScreensMap, onInputFinished = _a.onInputFinished, onChangeState = _a.onChangeState, onSmsRetryClick = _a.onSmsRetryClick, onChangeScreen = _a.onChangeScreen, onFatalErrorOkButtonClick = _a.onFatalErrorOkButtonClick, onTempBlockFinished = _a.onTempBlockFinished, mobile = _a.mobile, _f = _a.clearCodeOnError, clearCodeOnError = _f === void 0 ? true : _f, restProps = tslib.__rest(_a, ["state", "screen", "alignContent", "children", "requiredCharAmount", "countdownDuration", "tempBlockDuration", "phone", "blockSmsRetry", "dataTestId", "className", "getScreensMap", "onInputFinished", "onChangeState", "onSmsRetryClick", "onChangeScreen", "onFatalErrorOkButtonClick", "onTempBlockFinished", "mobile", "clearCodeOnError"]);
|
|
44
|
+
var _g = utils.useCountdown(countdownDuration), timeLeft = _g[0], startTimer = _g[1], stopTimer = _g[2];
|
|
45
|
+
var prevState = hooks.usePrevious(state);
|
|
46
|
+
React.useEffect(function () {
|
|
47
|
+
startTimer();
|
|
48
|
+
}, [startTimer]);
|
|
49
|
+
React.useEffect(function () {
|
|
50
|
+
/**
|
|
51
|
+
* Перезапускаем таймер после повторного запроса кода
|
|
52
|
+
*/
|
|
53
|
+
if (state === 'INITIAL' && prevState === 'CODE_SENDING') {
|
|
54
|
+
startTimer();
|
|
55
|
+
}
|
|
56
|
+
}, [state, prevState, startTimer]);
|
|
57
|
+
React.useEffect(function () {
|
|
58
|
+
/**
|
|
59
|
+
* Останавливаем таймер, если новый экран/состояние не содержит таймер
|
|
60
|
+
*/
|
|
61
|
+
if (!['INITIAL', 'HINT', 'TEMP_BLOCK'].includes(screen) || blockSmsRetry) {
|
|
62
|
+
stopTimer();
|
|
63
|
+
}
|
|
64
|
+
}, [state, screen, blockSmsRetry, stopTimer]);
|
|
65
|
+
var handleSmsRetry = function () {
|
|
66
|
+
onChangeState('CODE_SENDING');
|
|
67
|
+
onSmsRetryClick();
|
|
68
|
+
};
|
|
69
|
+
var handleInputFinished = function (code) {
|
|
70
|
+
onChangeState('CODE_CHECKING');
|
|
71
|
+
onInputFinished(code);
|
|
72
|
+
};
|
|
73
|
+
var handleFatalErrorOkButtonClick = function () {
|
|
74
|
+
if (onFatalErrorOkButtonClick) {
|
|
75
|
+
onFatalErrorOkButtonClick();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
79
|
+
var contextValue = {
|
|
80
|
+
alignContent: alignContent,
|
|
81
|
+
texts: tslib.__assign(tslib.__assign({}, types.defaultTexts), restProps.texts),
|
|
82
|
+
state: state,
|
|
83
|
+
screen: screen,
|
|
84
|
+
requiredCharAmount: requiredCharAmount,
|
|
85
|
+
countdownDuration: countdownDuration,
|
|
86
|
+
timeLeft: timeLeft,
|
|
87
|
+
tempBlockDuration: tempBlockDuration,
|
|
88
|
+
phone: phone,
|
|
89
|
+
blockSmsRetry: blockSmsRetry,
|
|
90
|
+
onTempBlockFinished: onTempBlockFinished,
|
|
91
|
+
onChangeState: onChangeState,
|
|
92
|
+
onChangeScreen: onChangeScreen,
|
|
93
|
+
clearCodeOnError: clearCodeOnError,
|
|
94
|
+
onInputFinished: handleInputFinished,
|
|
95
|
+
onSmsRetryClick: handleSmsRetry,
|
|
96
|
+
onFatalErrorOkButtonClick: handleFatalErrorOkButtonClick,
|
|
97
|
+
};
|
|
98
|
+
var screensMap = getScreensMap ? getScreensMap(confirmationScreens) : confirmationScreens;
|
|
99
|
+
var CurrentScreen = screensMap[screen];
|
|
100
|
+
return (React__default.default.createElement(context.ConfirmationContext.Provider, { value: contextValue },
|
|
101
|
+
React__default.default.createElement("div", { className: cn__default.default(styles__default.default.component, className), "data-test-id": dataTestId }, CurrentScreen && React__default.default.createElement(CurrentScreen, { mobile: mobile }))));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
exports.BaseConfirmation = BaseConfirmation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "./component";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var components_baseConfirmation_component = require('
|
|
3
|
+
var components_baseConfirmation_component = require('./component.js');
|
|
4
|
+
require('tslib');
|
|
4
5
|
require('react');
|
|
5
6
|
require('classnames');
|
|
6
7
|
require('@alfalab/hooks');
|
package/cssm/desktop.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var component_desktop = require('./component.desktop.js');
|
|
4
|
-
require('
|
|
4
|
+
require('tslib');
|
|
5
5
|
require('react');
|
|
6
|
+
require('./components/base-confirmation/component.js');
|
|
6
7
|
require('classnames');
|
|
7
8
|
require('@alfalab/hooks');
|
|
8
9
|
require('./context.js');
|
package/cssm/index.js
CHANGED
|
@@ -10,8 +10,9 @@ var components_countdownLoader_component = require('./components/countdown-loade
|
|
|
10
10
|
var context = require('./context.js');
|
|
11
11
|
var types = require('./types.js');
|
|
12
12
|
var utils = require('./utils.js');
|
|
13
|
-
require('
|
|
13
|
+
require('tslib');
|
|
14
14
|
require('react');
|
|
15
|
+
require('./components/base-confirmation/component.js');
|
|
15
16
|
require('classnames');
|
|
16
17
|
require('@alfalab/hooks');
|
|
17
18
|
require('./components/base-confirmation/index.module.css');
|
package/cssm/mobile.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var component_mobile = require('./component.mobile.js');
|
|
4
|
-
require('
|
|
4
|
+
require('tslib');
|
|
5
5
|
require('react');
|
|
6
6
|
require('classnames');
|
|
7
|
+
require('./components/base-confirmation/component.js');
|
|
7
8
|
require('@alfalab/hooks');
|
|
8
9
|
require('./context.js');
|
|
9
10
|
require('./utils.js');
|
package/cssm/responsive.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var component_responsive = require('./component.responsive.js');
|
|
4
|
-
require('
|
|
4
|
+
require('tslib');
|
|
5
5
|
require('react');
|
|
6
|
-
require('classnames');
|
|
7
6
|
require('@alfalab/hooks');
|
|
7
|
+
require('./component.desktop.js');
|
|
8
|
+
require('./components/base-confirmation/component.js');
|
|
9
|
+
require('classnames');
|
|
8
10
|
require('./context.js');
|
|
9
11
|
require('./utils.js');
|
|
10
12
|
require('./types.js');
|
|
@@ -27,7 +29,6 @@ require('./components/countdown-loader/component.js');
|
|
|
27
29
|
require('./components/countdown-loader/index.module.css');
|
|
28
30
|
require('./components/screens/temp-block/index.module.css');
|
|
29
31
|
require('./components/base-confirmation/index.module.css');
|
|
30
|
-
require('./component.desktop.js');
|
|
31
32
|
require('./component.mobile.js');
|
|
32
33
|
require('./mobile.module.css');
|
|
33
34
|
|
package/desktop.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var component_desktop = require('./component.desktop.js');
|
|
4
|
-
require('
|
|
4
|
+
require('tslib');
|
|
5
5
|
require('react');
|
|
6
|
+
require('./components/base-confirmation/component.js');
|
|
6
7
|
require('classnames');
|
|
7
8
|
require('@alfalab/hooks');
|
|
8
9
|
require('./context.js');
|
|
@@ -14,7 +15,7 @@ require('@alfalab/core-components-code-input');
|
|
|
14
15
|
require('@alfalab/core-components-link');
|
|
15
16
|
require('@alfalab/core-components-typography');
|
|
16
17
|
require('./components/header/component.js');
|
|
17
|
-
require('./countdown-section-
|
|
18
|
+
require('./countdown-section-bda43975.js');
|
|
18
19
|
require('@alfalab/core-components-loader');
|
|
19
20
|
require('./components/screens/hint/component.js');
|
|
20
21
|
require('./components/screens/fatal-error/component.js');
|
package/esm/component.desktop.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { BaseConfirmation } from './components/base-confirmation/component.js';
|
|
3
4
|
import 'classnames';
|
|
4
5
|
import '@alfalab/hooks';
|
|
5
6
|
import './context.js';
|
|
@@ -11,7 +12,7 @@ import '@alfalab/core-components-code-input/esm';
|
|
|
11
12
|
import '@alfalab/core-components-link/esm';
|
|
12
13
|
import '@alfalab/core-components-typography/esm';
|
|
13
14
|
import './components/header/component.js';
|
|
14
|
-
import './countdown-section-
|
|
15
|
+
import './countdown-section-6eb66678.js';
|
|
15
16
|
import '@alfalab/core-components-loader/esm';
|
|
16
17
|
import './components/screens/hint/component.js';
|
|
17
18
|
import './components/screens/fatal-error/component.js';
|
package/esm/component.mobile.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import cn from 'classnames';
|
|
4
|
+
import { BaseConfirmation } from './components/base-confirmation/component.js';
|
|
4
5
|
import '@alfalab/hooks';
|
|
5
6
|
import './context.js';
|
|
6
7
|
import './utils.js';
|
|
@@ -11,14 +12,14 @@ import '@alfalab/core-components-code-input/esm';
|
|
|
11
12
|
import '@alfalab/core-components-link/esm';
|
|
12
13
|
import '@alfalab/core-components-typography/esm';
|
|
13
14
|
import './components/header/component.js';
|
|
14
|
-
import './countdown-section-
|
|
15
|
+
import './countdown-section-6eb66678.js';
|
|
15
16
|
import '@alfalab/core-components-loader/esm';
|
|
16
17
|
import './components/screens/hint/component.js';
|
|
17
18
|
import './components/screens/fatal-error/component.js';
|
|
18
19
|
import './components/screens/temp-block/component.js';
|
|
19
20
|
import './components/countdown-loader/component.js';
|
|
20
21
|
|
|
21
|
-
var styles = {"container":"
|
|
22
|
+
var styles = {"container":"confirmation__container_16npl"};
|
|
22
23
|
require('./mobile.css')
|
|
23
24
|
|
|
24
25
|
var ConfirmationMobile = function (_a) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useMedia } from '@alfalab/hooks';
|
|
4
4
|
import { ConfirmationDesktop } from './component.desktop.js';
|
|
5
5
|
import { ConfirmationMobile } from './component.mobile.js';
|
|
6
|
+
import './components/base-confirmation/component.js';
|
|
6
7
|
import 'classnames';
|
|
7
8
|
import './context.js';
|
|
8
9
|
import './utils.js';
|
|
@@ -13,7 +14,7 @@ import '@alfalab/core-components-code-input/esm';
|
|
|
13
14
|
import '@alfalab/core-components-link/esm';
|
|
14
15
|
import '@alfalab/core-components-typography/esm';
|
|
15
16
|
import './components/header/component.js';
|
|
16
|
-
import './countdown-section-
|
|
17
|
+
import './countdown-section-6eb66678.js';
|
|
17
18
|
import '@alfalab/core-components-loader/esm';
|
|
18
19
|
import './components/screens/hint/component.js';
|
|
19
20
|
import './components/screens/fatal-error/component.js';
|
|
@@ -1,19 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
import 'react';
|
|
3
|
-
import 'classnames';
|
|
4
|
-
import '@alfalab/hooks';
|
|
5
|
-
import '../../context.js';
|
|
6
|
-
import '../../types.js';
|
|
7
|
-
import '../../utils.js';
|
|
8
|
-
import '../screens/initial/component.js';
|
|
9
|
-
import '../screens/hint/component.js';
|
|
10
|
-
import '../screens/fatal-error/component.js';
|
|
11
|
-
import '../screens/temp-block/component.js';
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import cn from 'classnames';
|
|
4
|
+
import { usePrevious } from '@alfalab/hooks';
|
|
5
|
+
import { ConfirmationContext } from '../../context.js';
|
|
6
|
+
import { defaultTexts } from '../../types.js';
|
|
7
|
+
import { useCountdown, ONE_MINUTE, ONE_DAY } from '../../utils.js';
|
|
8
|
+
import { Initial } from '../screens/initial/component.js';
|
|
9
|
+
import { Hint } from '../screens/hint/component.js';
|
|
10
|
+
import { FatalError } from '../screens/fatal-error/component.js';
|
|
11
|
+
import { TempBlock } from '../screens/temp-block/component.js';
|
|
12
12
|
import '@alfalab/core-components-button/esm';
|
|
13
13
|
import '@alfalab/core-components-code-input/esm';
|
|
14
14
|
import '@alfalab/core-components-link/esm';
|
|
15
15
|
import '@alfalab/core-components-typography/esm';
|
|
16
16
|
import '../header/component.js';
|
|
17
|
-
import '../../countdown-section-
|
|
17
|
+
import '../../countdown-section-6eb66678.js';
|
|
18
18
|
import '@alfalab/core-components-loader/esm';
|
|
19
19
|
import '../countdown-loader/component.js';
|
|
20
|
+
|
|
21
|
+
var styles = {"component":"confirmation__component_y3i6g"};
|
|
22
|
+
require('./index.css')
|
|
23
|
+
|
|
24
|
+
var confirmationScreens = {
|
|
25
|
+
INITIAL: Initial,
|
|
26
|
+
HINT: Hint,
|
|
27
|
+
FATAL_ERROR: FatalError,
|
|
28
|
+
TEMP_BLOCK: TempBlock,
|
|
29
|
+
};
|
|
30
|
+
var BaseConfirmation = function (_a) {
|
|
31
|
+
var state = _a.state, screen = _a.screen, _b = _a.alignContent, alignContent = _b === void 0 ? 'left' : _b; _a.children; var _c = _a.requiredCharAmount, requiredCharAmount = _c === void 0 ? 5 : _c, _d = _a.countdownDuration, countdownDuration = _d === void 0 ? ONE_MINUTE : _d, _e = _a.tempBlockDuration, tempBlockDuration = _e === void 0 ? ONE_DAY : _e, phone = _a.phone, blockSmsRetry = _a.blockSmsRetry, dataTestId = _a.dataTestId, className = _a.className, getScreensMap = _a.getScreensMap, onInputFinished = _a.onInputFinished, onChangeState = _a.onChangeState, onSmsRetryClick = _a.onSmsRetryClick, onChangeScreen = _a.onChangeScreen, onFatalErrorOkButtonClick = _a.onFatalErrorOkButtonClick, onTempBlockFinished = _a.onTempBlockFinished, mobile = _a.mobile, _f = _a.clearCodeOnError, clearCodeOnError = _f === void 0 ? true : _f, restProps = __rest(_a, ["state", "screen", "alignContent", "children", "requiredCharAmount", "countdownDuration", "tempBlockDuration", "phone", "blockSmsRetry", "dataTestId", "className", "getScreensMap", "onInputFinished", "onChangeState", "onSmsRetryClick", "onChangeScreen", "onFatalErrorOkButtonClick", "onTempBlockFinished", "mobile", "clearCodeOnError"]);
|
|
32
|
+
var _g = useCountdown(countdownDuration), timeLeft = _g[0], startTimer = _g[1], stopTimer = _g[2];
|
|
33
|
+
var prevState = usePrevious(state);
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
startTimer();
|
|
36
|
+
}, [startTimer]);
|
|
37
|
+
useEffect(function () {
|
|
38
|
+
/**
|
|
39
|
+
* Перезапускаем таймер после повторного запроса кода
|
|
40
|
+
*/
|
|
41
|
+
if (state === 'INITIAL' && prevState === 'CODE_SENDING') {
|
|
42
|
+
startTimer();
|
|
43
|
+
}
|
|
44
|
+
}, [state, prevState, startTimer]);
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
/**
|
|
47
|
+
* Останавливаем таймер, если новый экран/состояние не содержит таймер
|
|
48
|
+
*/
|
|
49
|
+
if (!['INITIAL', 'HINT', 'TEMP_BLOCK'].includes(screen) || blockSmsRetry) {
|
|
50
|
+
stopTimer();
|
|
51
|
+
}
|
|
52
|
+
}, [state, screen, blockSmsRetry, stopTimer]);
|
|
53
|
+
var handleSmsRetry = function () {
|
|
54
|
+
onChangeState('CODE_SENDING');
|
|
55
|
+
onSmsRetryClick();
|
|
56
|
+
};
|
|
57
|
+
var handleInputFinished = function (code) {
|
|
58
|
+
onChangeState('CODE_CHECKING');
|
|
59
|
+
onInputFinished(code);
|
|
60
|
+
};
|
|
61
|
+
var handleFatalErrorOkButtonClick = function () {
|
|
62
|
+
if (onFatalErrorOkButtonClick) {
|
|
63
|
+
onFatalErrorOkButtonClick();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
67
|
+
var contextValue = {
|
|
68
|
+
alignContent: alignContent,
|
|
69
|
+
texts: __assign(__assign({}, defaultTexts), restProps.texts),
|
|
70
|
+
state: state,
|
|
71
|
+
screen: screen,
|
|
72
|
+
requiredCharAmount: requiredCharAmount,
|
|
73
|
+
countdownDuration: countdownDuration,
|
|
74
|
+
timeLeft: timeLeft,
|
|
75
|
+
tempBlockDuration: tempBlockDuration,
|
|
76
|
+
phone: phone,
|
|
77
|
+
blockSmsRetry: blockSmsRetry,
|
|
78
|
+
onTempBlockFinished: onTempBlockFinished,
|
|
79
|
+
onChangeState: onChangeState,
|
|
80
|
+
onChangeScreen: onChangeScreen,
|
|
81
|
+
clearCodeOnError: clearCodeOnError,
|
|
82
|
+
onInputFinished: handleInputFinished,
|
|
83
|
+
onSmsRetryClick: handleSmsRetry,
|
|
84
|
+
onFatalErrorOkButtonClick: handleFatalErrorOkButtonClick,
|
|
85
|
+
};
|
|
86
|
+
var screensMap = getScreensMap ? getScreensMap(confirmationScreens) : confirmationScreens;
|
|
87
|
+
var CurrentScreen = screensMap[screen];
|
|
88
|
+
return (React.createElement(ConfirmationContext.Provider, { value: contextValue },
|
|
89
|
+
React.createElement("div", { className: cn(styles.component, className), "data-test-id": dataTestId }, CurrentScreen && React.createElement(CurrentScreen, { mobile: mobile }))));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export { BaseConfirmation };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 37onl */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-text-secondary: rgba(11, 31, 53, 0.7);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
} :root {
|
|
16
16
|
} :root {
|
|
17
17
|
} :root {
|
|
18
|
-
} .
|
|
18
|
+
} .confirmation__component_y3i6g {
|
|
19
19
|
width: 100%;
|
|
20
20
|
max-width: 388px;
|
|
21
21
|
margin: 0 auto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "./component";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { BaseConfirmation } from './component.js';
|
|
2
|
+
import 'tslib';
|
|
2
3
|
import 'react';
|
|
3
4
|
import 'classnames';
|
|
4
5
|
import '@alfalab/hooks';
|
|
@@ -11,7 +12,7 @@ import '@alfalab/core-components-code-input/esm';
|
|
|
11
12
|
import '@alfalab/core-components-link/esm';
|
|
12
13
|
import '@alfalab/core-components-typography/esm';
|
|
13
14
|
import '../header/component.js';
|
|
14
|
-
import '../../countdown-section-
|
|
15
|
+
import '../../countdown-section-6eb66678.js';
|
|
15
16
|
import '@alfalab/core-components-loader/esm';
|
|
16
17
|
import '../screens/hint/component.js';
|
|
17
18
|
import '../screens/fatal-error/component.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1e5nj */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-tertiary: #b6bcc3;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
} :root {
|
|
16
16
|
} :root {
|
|
17
17
|
} :root {
|
|
18
|
-
} .
|
|
18
|
+
} .confirmation__circle_1q6wg {
|
|
19
19
|
fill: transparent;
|
|
20
20
|
stroke: var(--color-light-graphic-tertiary);
|
|
21
21
|
stroke-width: 2px;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { Typography } from '@alfalab/core-components-typography/esm';
|
|
4
4
|
|
|
5
|
-
var styles = {"header":"
|
|
5
|
+
var styles = {"header":"confirmation__header_k1gli","typography":"confirmation__typography_k1gli","typographyMobile":"confirmation__typographyMobile_k1gli"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
var Header = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 4uqfp */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
} :root {
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
|
|
35
35
|
/* header */
|
|
36
36
|
--confirmation-header-font-feature-settings: normal
|
|
37
|
-
} .
|
|
37
|
+
} .confirmation__header_k1gli.confirmation__header_k1gli {
|
|
38
38
|
margin-bottom: var(--gap-xl);
|
|
39
|
-
} .
|
|
39
|
+
} .confirmation__typography_k1gli.confirmation__typography_k1gli {
|
|
40
40
|
font-feature-settings: var(--confirmation-header-font-feature-settings);
|
|
41
41
|
font-size: var(--confirmation-header-desktop-font-size);
|
|
42
42
|
line-height: var(--confirmation-header-desktop-line-height);
|
|
43
43
|
font-weight: var(--confirmation-header-desktop-font-weight);
|
|
44
44
|
font-family: var(--confirmation-header-desktop-font-family);
|
|
45
|
-
} .
|
|
45
|
+
} .confirmation__typographyMobile_k1gli.confirmation__typographyMobile_k1gli {
|
|
46
46
|
font-feature-settings: var(--confirmation-header-font-feature-settings);
|
|
47
47
|
font-size: var(--confirmation-header-mobile-font-size);
|
|
48
48
|
line-height: var(--confirmation-header-mobile-line-height);
|
package/esm/components/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { ConfirmationContext } from '../../../context.js';
|
|
|
6
6
|
import { Header } from '../../header/component.js';
|
|
7
7
|
import '../../../utils.js';
|
|
8
8
|
|
|
9
|
-
var styles = {"component":"
|
|
9
|
+
var styles = {"component":"confirmation__component_1751l","typographyTheme":"confirmation__typographyTheme_1751l","left":"confirmation__left_1751l","center":"confirmation__center_1751l","button":"confirmation__button_1751l"};
|
|
10
10
|
require('./index.css')
|
|
11
11
|
|
|
12
12
|
var FatalError = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 112kj */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-text-primary: #0b1f35;
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
--confirmation-text-color: var(--color-light-text-primary)
|
|
32
32
|
|
|
33
33
|
/* header */
|
|
34
|
-
} .
|
|
34
|
+
} .confirmation__component_1751l {
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
|
-
} .
|
|
37
|
+
} .confirmation__typographyTheme_1751l.confirmation__typographyTheme_1751l {
|
|
38
38
|
font-size: var(--confirmation-text-font-size);
|
|
39
39
|
line-height: var(--confirmation-text-line-height);
|
|
40
40
|
font-weight: var(--confirmation-text-font-weight);
|
|
41
41
|
font-family: var(--confirmation-text-font-family);
|
|
42
42
|
color: var(--confirmation-text-color);
|
|
43
|
-
} .
|
|
43
|
+
} .confirmation__left_1751l {
|
|
44
44
|
align-items: flex-start;
|
|
45
|
-
} .
|
|
45
|
+
} .confirmation__center_1751l {
|
|
46
46
|
align-items: center;
|
|
47
47
|
text-align: center;
|
|
48
|
-
} .
|
|
48
|
+
} .confirmation__button_1751l {
|
|
49
49
|
margin-top: var(--gap-2xl);
|
|
50
50
|
}
|
|
@@ -7,7 +7,7 @@ import { ConfirmationContext } from '../../../context.js';
|
|
|
7
7
|
import { Header } from '../../header/component.js';
|
|
8
8
|
import '../../../utils.js';
|
|
9
9
|
|
|
10
|
-
var styles = {"component":"
|
|
10
|
+
var styles = {"component":"confirmation__component_r22t9","center":"confirmation__center_r22t9","text":"confirmation__text_r22t9","typographyTheme":"confirmation__typographyTheme_r22t9","phonesWrap":"confirmation__phonesWrap_r22t9","phoneWrap":"confirmation__phoneWrap_r22t9","phoneLink":"confirmation__phoneLink_r22t9","hintButton":"confirmation__hintButton_r22t9","phoneContentMobile":"confirmation__phoneContentMobile_r22t9"};
|
|
11
11
|
require('./index.css')
|
|
12
12
|
|
|
13
13
|
var Hint = function (_a) {
|