@alfalab/core-components-confirmation 13.0.0 → 13.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/component.desktop.js +2 -2
- package/component.mobile.js +3 -3
- package/component.responsive.js +2 -2
- package/components/base-confirmation/component.js +5 -4
- package/components/base-confirmation/index.css +2 -2
- package/components/base-confirmation/index.js +2 -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 +2 -2
- 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 +2 -2
- package/components/screens/initial/component.js +13 -4
- package/components/screens/initial/countdown-section.js +2 -2
- package/components/screens/initial/index.css +17 -17
- package/components/screens/initial/index.js +2 -2
- package/components/screens/temp-block/component.js +1 -1
- package/components/screens/temp-block/index.css +7 -7
- package/context.js +1 -0
- package/{countdown-section-fb6524aa.js → countdown-section-b212c5b4.js} +3 -3
- package/cssm/component.desktop.js +1 -1
- package/cssm/component.mobile.js +1 -1
- package/cssm/component.responsive.js +1 -1
- package/cssm/components/base-confirmation/component.js +3 -2
- package/cssm/components/base-confirmation/index.js +1 -1
- package/cssm/components/index.js +1 -1
- package/cssm/components/screens/index.js +1 -1
- package/cssm/components/screens/initial/component.js +12 -3
- package/cssm/components/screens/initial/countdown-section.js +2 -2
- package/cssm/components/screens/initial/index.js +1 -1
- package/cssm/context.js +1 -0
- package/cssm/desktop.js +1 -1
- package/cssm/index.js +1 -1
- package/cssm/mobile.js +1 -1
- package/cssm/shared.js +1 -1
- package/cssm/types.d.ts +5 -1
- package/desktop.js +2 -2
- package/esm/component.desktop.js +2 -2
- package/esm/component.mobile.js +3 -3
- package/esm/component.responsive.js +2 -2
- package/esm/components/base-confirmation/component.js +5 -4
- package/esm/components/base-confirmation/index.css +2 -2
- package/esm/components/base-confirmation/index.js +2 -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 +2 -2
- 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 +2 -2
- package/esm/components/screens/initial/component.js +13 -4
- package/esm/components/screens/initial/countdown-section.js +2 -2
- package/esm/components/screens/initial/index.css +17 -17
- package/esm/components/screens/initial/index.js +2 -2
- package/esm/components/screens/temp-block/component.js +1 -1
- package/esm/components/screens/temp-block/index.css +7 -7
- package/esm/context.js +1 -0
- package/esm/{countdown-section-c65cff2d.js → countdown-section-83d922ef.js} +3 -3
- package/esm/desktop.js +2 -2
- package/esm/index.js +2 -2
- package/esm/mobile.css +2 -2
- package/esm/mobile.js +2 -2
- package/esm/shared.js +2 -2
- package/esm/types.d.ts +5 -1
- package/index.js +2 -2
- package/mobile.css +2 -2
- package/mobile.js +2 -2
- package/modern/component.desktop.js +2 -2
- package/modern/component.mobile.js +3 -3
- package/modern/component.responsive.js +2 -2
- package/modern/components/base-confirmation/component.js +5 -4
- package/modern/components/base-confirmation/index.css +2 -2
- package/modern/components/base-confirmation/index.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/modern/components/screens/initial/component.js +13 -4
- package/modern/components/screens/initial/countdown-section.js +2 -2
- package/modern/components/screens/initial/index.css +17 -17
- package/modern/components/screens/initial/index.js +2 -2
- package/modern/components/screens/temp-block/component.js +1 -1
- package/modern/components/screens/temp-block/index.css +7 -7
- package/modern/context.js +1 -0
- package/modern/{countdown-section-dd4e5fe3.js → countdown-section-ea7af879.js} +3 -3
- package/modern/desktop.js +2 -2
- package/modern/index.js +2 -2
- package/modern/mobile.css +2 -2
- package/modern/mobile.js +2 -2
- package/modern/shared.js +2 -2
- package/modern/types.d.ts +5 -1
- package/package.json +3 -3
- package/shared.js +2 -2
- package/src/components/base-confirmation/component.tsx +2 -0
- package/src/components/screens/initial/component.tsx +27 -14
- package/src/components/screens/initial/countdown-section.tsx +2 -2
- package/src/context.ts +1 -0
- package/src/types.ts +10 -1
- package/types.d.ts +5 -1
- /package/{countdown-section-fb6524aa.d.ts → countdown-section-b212c5b4.d.ts} +0 -0
- /package/esm/{countdown-section-c65cff2d.d.ts → countdown-section-83d922ef.d.ts} +0 -0
- /package/modern/{countdown-section-dd4e5fe3.d.ts → countdown-section-ea7af879.d.ts} +0 -0
|
@@ -8,14 +8,14 @@ import { Typography } from '@alfalab/core-components-typography/modern';
|
|
|
8
8
|
import { usePrevious } from '@alfalab/hooks';
|
|
9
9
|
import { ConfirmationContext } from '../../../context.js';
|
|
10
10
|
import { Header } from '../../header/component.js';
|
|
11
|
-
import { s as styles, C as CountdownSection } from '../../../countdown-section-
|
|
11
|
+
import { s as styles, C as CountdownSection } from '../../../countdown-section-ea7af879.js';
|
|
12
12
|
import '../../../utils.js';
|
|
13
13
|
import '@alfalab/core-components-button/modern';
|
|
14
|
-
import '@alfalab/core-components-
|
|
14
|
+
import '@alfalab/core-components-spinner/modern';
|
|
15
15
|
|
|
16
16
|
const CODE_SEND_HINT_VISIBLE_DURATION = 2000;
|
|
17
17
|
const Initial = ({ mobile }) => {
|
|
18
|
-
const { state, alignContent, texts, requiredCharAmount, timeLeft, phone, clearCodeOnError, hideCountdownSection, onChangeState, onInputFinished, onChangeScreen, onSmsRetryClick, } = useContext(ConfirmationContext);
|
|
18
|
+
const { state, alignContent, texts, requiredCharAmount, timeLeft, phone, clearCodeOnError, hideCountdownSection, initialScreenHintSlot, onChangeState, onInputFinished, onChangeScreen, onSmsRetryClick, } = useContext(ConfirmationContext);
|
|
19
19
|
const prevState = usePrevious(state);
|
|
20
20
|
const inputRef = useRef(null);
|
|
21
21
|
const [codeSendHintVisible, setCodeSendHintVisible] = useState(false);
|
|
@@ -79,6 +79,15 @@ const Initial = ({ mobile }) => {
|
|
|
79
79
|
}
|
|
80
80
|
return false;
|
|
81
81
|
};
|
|
82
|
+
const renderHintButton = () => {
|
|
83
|
+
if (initialScreenHintSlot) {
|
|
84
|
+
return initialScreenHintSlot;
|
|
85
|
+
}
|
|
86
|
+
if (mobile) {
|
|
87
|
+
return (React.createElement(ButtonMobile, { onClick: handleSmsHintLinkClick, view: 'link', size: 'xs' }, texts.linkToHint));
|
|
88
|
+
}
|
|
89
|
+
return (React.createElement(Link, { onClick: handleSmsHintLinkClick, className: styles.smsComeLink, view: mobile ? 'primary' : 'secondary', pseudo: true }, texts.linkToHint));
|
|
90
|
+
};
|
|
82
91
|
const processing = ['CODE_CHECKING', 'CODE_SENDING'].includes(state);
|
|
83
92
|
const timePassed = timeLeft === 0;
|
|
84
93
|
const ComponentCodeInput = mobile ? CodeInputMobile : CodeInputDesktop;
|
|
@@ -89,7 +98,7 @@ const Initial = ({ mobile }) => {
|
|
|
89
98
|
phone),
|
|
90
99
|
React.createElement(ComponentCodeInput, { disabled: processing, error: getCodeInputError(), ref: inputRef, fields: requiredCharAmount, className: cn(styles.containerInput, styles.codeInput), onComplete: handleInputComplete, onChange: handleInputChange, clearCodeOnError: clearCodeOnError, onErrorAnimationEnd: handleErrorAnimationEnd }),
|
|
91
100
|
!hideCountdownSection && (React.createElement(CountdownSection, { processing: processing, timePassed: timePassed, codeSendHintVisible: codeSendHintVisible, handleSmsRetryClick: handleSmsRetryClick, mobile: mobile })),
|
|
92
|
-
|
|
101
|
+
renderHintButton()));
|
|
93
102
|
};
|
|
94
103
|
|
|
95
104
|
export { Initial };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
import 'classnames';
|
|
3
3
|
import '@alfalab/core-components-button/modern';
|
|
4
|
-
import '@alfalab/core-components-
|
|
4
|
+
import '@alfalab/core-components-spinner/modern';
|
|
5
5
|
import '@alfalab/core-components-typography/modern';
|
|
6
6
|
import '../../../context.js';
|
|
7
7
|
import '../../../utils.js';
|
|
8
|
-
export { C as CountdownSection } from '../../../countdown-section-
|
|
8
|
+
export { C as CountdownSection } from '../../../countdown-section-ea7af879.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: l1yvu */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-text-primary: #0e0e0e;
|
|
@@ -37,49 +37,49 @@
|
|
|
37
37
|
--confirmation-text-color: var(--color-light-text-primary)
|
|
38
38
|
|
|
39
39
|
/* header */
|
|
40
|
-
} .
|
|
40
|
+
} .confirmation__component_1yvyt {
|
|
41
41
|
display: flex;
|
|
42
42
|
flex-direction: column;
|
|
43
|
-
} .
|
|
43
|
+
} .confirmation__typographyTheme_1yvyt.confirmation__typographyTheme_1yvyt {
|
|
44
44
|
font-size: var(--confirmation-text-font-size);
|
|
45
45
|
line-height: var(--confirmation-text-line-height);
|
|
46
46
|
font-weight: var(--confirmation-text-font-weight);
|
|
47
47
|
font-family: var(--confirmation-text-font-family);
|
|
48
48
|
color: var(--confirmation-text-color);
|
|
49
|
-
} .
|
|
49
|
+
} .confirmation__phone_1yvyt.confirmation__phone_1yvyt {
|
|
50
50
|
color: var(--color-light-text-primary);
|
|
51
51
|
margin-bottom: var(--gap-2xl);
|
|
52
|
-
} .
|
|
52
|
+
} .confirmation__compact_1yvyt {
|
|
53
53
|
margin-bottom: var(--gap-xl);
|
|
54
|
-
} .
|
|
54
|
+
} .confirmation__loaderWrap_1yvyt {
|
|
55
55
|
display: flex;
|
|
56
56
|
align-items: center;
|
|
57
|
-
} .
|
|
57
|
+
} .confirmation__left_1yvyt {
|
|
58
58
|
align-items: flex-start;
|
|
59
|
-
} .
|
|
59
|
+
} .confirmation__center_1yvyt {
|
|
60
60
|
align-items: center;
|
|
61
61
|
text-align: center
|
|
62
|
-
} .
|
|
62
|
+
} .confirmation__center_1yvyt .confirmation__loaderWrap_1yvyt {
|
|
63
63
|
justify-content: center;
|
|
64
|
-
} .
|
|
64
|
+
} .confirmation__codeInput_1yvyt {
|
|
65
65
|
margin-bottom: var(--gap-s);
|
|
66
|
-
} .
|
|
66
|
+
} .confirmation__smsComeLink_1yvyt.confirmation__smsComeLink_1yvyt {
|
|
67
67
|
font-size: 14px;
|
|
68
68
|
line-height: 20px;
|
|
69
69
|
font-weight: 500;
|
|
70
|
-
} .
|
|
70
|
+
} .confirmation__countdownContainer_1yvyt.confirmation__countdownContainer_1yvyt {
|
|
71
71
|
color: var(--color-light-text-secondary);
|
|
72
72
|
margin-bottom: var(--gap-xl);
|
|
73
|
-
} .
|
|
73
|
+
} .confirmation__countdownMobile_1yvyt.confirmation__countdownMobile_1yvyt {
|
|
74
74
|
margin-bottom: var(--gap-l);
|
|
75
|
-
} .
|
|
75
|
+
} .confirmation__countdownLoaderMobile_1yvyt.confirmation__countdownLoaderMobile_1yvyt {
|
|
76
76
|
margin-bottom: var(--gap-m);
|
|
77
|
-
} .
|
|
77
|
+
} .confirmation__getCodeButton_1yvyt {
|
|
78
78
|
position: relative;
|
|
79
79
|
top: var(--gap-2xs-neg);
|
|
80
80
|
margin-bottom: var(--gap-m);
|
|
81
|
-
} .
|
|
81
|
+
} .confirmation__getCodeButtonMobile_1yvyt {
|
|
82
82
|
margin-bottom: 0;
|
|
83
|
-
} .
|
|
83
|
+
} .confirmation__containerInput_1yvyt {
|
|
84
84
|
min-height: 80px;
|
|
85
85
|
}
|
|
@@ -10,6 +10,6 @@ import '@alfalab/hooks';
|
|
|
10
10
|
import '../../../context.js';
|
|
11
11
|
import '../../../utils.js';
|
|
12
12
|
import '../../header/component.js';
|
|
13
|
-
import '../../../countdown-section-
|
|
13
|
+
import '../../../countdown-section-ea7af879.js';
|
|
14
14
|
import '@alfalab/core-components-button/modern';
|
|
15
|
-
import '@alfalab/core-components-
|
|
15
|
+
import '@alfalab/core-components-spinner/modern';
|
|
@@ -6,7 +6,7 @@ import { useCountdown, formatMsAsMinutes } from '../../../utils.js';
|
|
|
6
6
|
import { CountdownLoader } from '../../countdown-loader/component.js';
|
|
7
7
|
import { Header } from '../../header/component.js';
|
|
8
8
|
|
|
9
|
-
const styles = {"component":"
|
|
9
|
+
const styles = {"component":"confirmation__component_164iy","center":"confirmation__center_164iy","typographyTheme":"confirmation__typographyTheme_164iy","description":"confirmation__description_164iy","countdownWrap":"confirmation__countdownWrap_164iy","loader":"confirmation__loader_164iy"};
|
|
10
10
|
require('./index.css')
|
|
11
11
|
|
|
12
12
|
const TempBlock = ({ mobile }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1ce4x */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-text-primary: #0e0e0e; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -31,23 +31,23 @@
|
|
|
31
31
|
--confirmation-text-color: var(--color-light-text-primary)
|
|
32
32
|
|
|
33
33
|
/* header */
|
|
34
|
-
} .
|
|
34
|
+
} .confirmation__component_164iy {
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
|
-
} .
|
|
37
|
+
} .confirmation__center_164iy {
|
|
38
38
|
align-items: center;
|
|
39
39
|
text-align: center;
|
|
40
|
-
} .
|
|
40
|
+
} .confirmation__typographyTheme_164iy.confirmation__typographyTheme_164iy {
|
|
41
41
|
font-size: var(--confirmation-text-font-size);
|
|
42
42
|
line-height: var(--confirmation-text-line-height);
|
|
43
43
|
font-weight: var(--confirmation-text-font-weight);
|
|
44
44
|
font-family: var(--confirmation-text-font-family);
|
|
45
45
|
color: var(--confirmation-text-color);
|
|
46
|
-
} .
|
|
46
|
+
} .confirmation__description_164iy.confirmation__description_164iy {
|
|
47
47
|
margin-bottom: var(--gap-xs);
|
|
48
|
-
} .
|
|
48
|
+
} .confirmation__countdownWrap_164iy {
|
|
49
49
|
display: flex;
|
|
50
50
|
align-items: center;
|
|
51
|
-
} .
|
|
51
|
+
} .confirmation__loader_164iy {
|
|
52
52
|
margin-right: var(--gap-xs);
|
|
53
53
|
}
|
package/modern/context.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { Button } from '@alfalab/core-components-button/modern';
|
|
4
|
-
import {
|
|
4
|
+
import { Spinner } from '@alfalab/core-components-spinner/modern';
|
|
5
5
|
import { Typography } from '@alfalab/core-components-typography/modern';
|
|
6
6
|
import { ConfirmationContext } from './context.js';
|
|
7
7
|
import { formatMsAsMinutes } from './utils.js';
|
|
8
8
|
|
|
9
|
-
const styles = {"component":"
|
|
9
|
+
const styles = {"component":"confirmation__component_1yvyt","typographyTheme":"confirmation__typographyTheme_1yvyt","phone":"confirmation__phone_1yvyt","compact":"confirmation__compact_1yvyt","loaderWrap":"confirmation__loaderWrap_1yvyt","left":"confirmation__left_1yvyt","center":"confirmation__center_1yvyt","codeInput":"confirmation__codeInput_1yvyt","smsComeLink":"confirmation__smsComeLink_1yvyt","countdownContainer":"confirmation__countdownContainer_1yvyt","countdownMobile":"confirmation__countdownMobile_1yvyt","countdownLoaderMobile":"confirmation__countdownLoaderMobile_1yvyt","getCodeButton":"confirmation__getCodeButton_1yvyt","getCodeButtonMobile":"confirmation__getCodeButtonMobile_1yvyt","containerInput":"confirmation__containerInput_1yvyt"};
|
|
10
10
|
require('./components/screens/initial/index.css')
|
|
11
11
|
|
|
12
12
|
const CountdownSection = ({ codeSendHintVisible, timePassed, processing, mobile, handleSmsRetryClick, }) => {
|
|
@@ -22,7 +22,7 @@ const CountdownSection = ({ codeSendHintVisible, timePassed, processing, mobile,
|
|
|
22
22
|
[styles.countdownLoaderMobile]: mobile,
|
|
23
23
|
[styles.typographyTheme]: !mobile,
|
|
24
24
|
}) },
|
|
25
|
-
React.createElement(
|
|
25
|
+
React.createElement(Spinner, { visible: true }),
|
|
26
26
|
React.createElement("span", { className: styles.loaderText }, state === 'CODE_CHECKING' ? texts.codeChecking : texts.codeSending)));
|
|
27
27
|
}
|
|
28
28
|
if (blockSmsRetry)
|
package/modern/desktop.js
CHANGED
|
@@ -13,9 +13,9 @@ import '@alfalab/core-components-code-input/modern/mobile';
|
|
|
13
13
|
import '@alfalab/core-components-link/modern';
|
|
14
14
|
import '@alfalab/core-components-typography/modern';
|
|
15
15
|
import './components/header/component.js';
|
|
16
|
-
import './countdown-section-
|
|
16
|
+
import './countdown-section-ea7af879.js';
|
|
17
17
|
import '@alfalab/core-components-button/modern';
|
|
18
|
-
import '@alfalab/core-components-
|
|
18
|
+
import '@alfalab/core-components-spinner/modern';
|
|
19
19
|
import './components/screens/hint/component.js';
|
|
20
20
|
import './components/screens/fatal-error/component.js';
|
|
21
21
|
import './components/screens/temp-block/component.js';
|
package/modern/index.js
CHANGED
|
@@ -15,9 +15,9 @@ import '@alfalab/core-components-code-input/modern/mobile';
|
|
|
15
15
|
import '@alfalab/core-components-link/modern';
|
|
16
16
|
import '@alfalab/core-components-typography/modern';
|
|
17
17
|
import './components/header/component.js';
|
|
18
|
-
import './countdown-section-
|
|
18
|
+
import './countdown-section-ea7af879.js';
|
|
19
19
|
import '@alfalab/core-components-button/modern';
|
|
20
|
-
import '@alfalab/core-components-
|
|
20
|
+
import '@alfalab/core-components-spinner/modern';
|
|
21
21
|
import './components/screens/hint/component.js';
|
|
22
22
|
import './components/screens/fatal-error/component.js';
|
|
23
23
|
import './components/screens/temp-block/component.js';
|
package/modern/mobile.css
CHANGED
package/modern/mobile.js
CHANGED
|
@@ -13,9 +13,9 @@ import '@alfalab/core-components-code-input/modern/mobile';
|
|
|
13
13
|
import '@alfalab/core-components-link/modern';
|
|
14
14
|
import '@alfalab/core-components-typography/modern';
|
|
15
15
|
import './components/header/component.js';
|
|
16
|
-
import './countdown-section-
|
|
16
|
+
import './countdown-section-ea7af879.js';
|
|
17
17
|
import '@alfalab/core-components-button/modern';
|
|
18
|
-
import '@alfalab/core-components-
|
|
18
|
+
import '@alfalab/core-components-spinner/modern';
|
|
19
19
|
import './components/screens/hint/component.js';
|
|
20
20
|
import './components/screens/fatal-error/component.js';
|
|
21
21
|
import './components/screens/temp-block/component.js';
|
package/modern/shared.js
CHANGED
|
@@ -15,6 +15,6 @@ import '@alfalab/core-components-link/modern';
|
|
|
15
15
|
import '@alfalab/core-components-typography/modern';
|
|
16
16
|
import '@alfalab/hooks';
|
|
17
17
|
import './components/header/component.js';
|
|
18
|
-
import './countdown-section-
|
|
18
|
+
import './countdown-section-ea7af879.js';
|
|
19
19
|
import '@alfalab/core-components-button/modern';
|
|
20
|
-
import '@alfalab/core-components-
|
|
20
|
+
import '@alfalab/core-components-spinner/modern';
|
package/modern/types.d.ts
CHANGED
|
@@ -89,13 +89,17 @@ type ConfirmationProps = {
|
|
|
89
89
|
* @default false
|
|
90
90
|
*/
|
|
91
91
|
hideCountdownSection?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Слот для контента с подсказкой на главном экране
|
|
94
|
+
*/
|
|
95
|
+
initialScreenHintSlot?: ReactNode;
|
|
92
96
|
/**
|
|
93
97
|
* Контрольная точка для кнопки, с нее начинается desktop версия
|
|
94
98
|
* @default 1024
|
|
95
99
|
*/
|
|
96
100
|
breakpoint?: number;
|
|
97
101
|
};
|
|
98
|
-
type TConfirmationContext = Required<Pick<ConfirmationProps, 'alignContent' | 'texts' | 'state' | 'screen' | 'requiredCharAmount' | 'onInputFinished' | 'countdownDuration' | 'onChangeState' | 'onSmsRetryClick' | 'onChangeScreen' | 'onFatalErrorOkButtonClick' | 'tempBlockDuration' | 'hideCountdownSection'>> & Pick<ConfirmationProps, 'phone' | 'blockSmsRetry' | 'onTempBlockFinished' | 'clearCodeOnError'> & {
|
|
102
|
+
type TConfirmationContext = Required<Pick<ConfirmationProps, 'alignContent' | 'texts' | 'state' | 'screen' | 'requiredCharAmount' | 'onInputFinished' | 'countdownDuration' | 'onChangeState' | 'onSmsRetryClick' | 'onChangeScreen' | 'onFatalErrorOkButtonClick' | 'tempBlockDuration' | 'hideCountdownSection'>> & Pick<ConfirmationProps, 'phone' | 'blockSmsRetry' | 'onTempBlockFinished' | 'clearCodeOnError' | 'initialScreenHintSlot'> & {
|
|
99
103
|
timeLeft: number;
|
|
100
104
|
} & {
|
|
101
105
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-confirmation",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.0",
|
|
4
4
|
"description": "Sms confirmation component",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"directory": "dist"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@alfalab/core-components-button": "^9.0.
|
|
38
|
+
"@alfalab/core-components-button": "^9.0.1",
|
|
39
39
|
"@alfalab/core-components-code-input": "^3.0.0",
|
|
40
40
|
"@alfalab/core-components-link": "^5.1.0",
|
|
41
|
-
"@alfalab/core-components-
|
|
41
|
+
"@alfalab/core-components-spinner": "^3.1.0",
|
|
42
42
|
"@alfalab/core-components-typography": "^4.0.0",
|
|
43
43
|
"@alfalab/core-components-mq": "^4.2.0",
|
|
44
44
|
"@alfalab/hooks": "^1.13.0",
|
package/shared.js
CHANGED
|
@@ -19,9 +19,9 @@ require('@alfalab/core-components-link');
|
|
|
19
19
|
require('@alfalab/core-components-typography');
|
|
20
20
|
require('@alfalab/hooks');
|
|
21
21
|
require('./components/header/component.js');
|
|
22
|
-
require('./countdown-section-
|
|
22
|
+
require('./countdown-section-b212c5b4.js');
|
|
23
23
|
require('@alfalab/core-components-button');
|
|
24
|
-
require('@alfalab/core-components-
|
|
24
|
+
require('@alfalab/core-components-spinner');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -40,6 +40,7 @@ export const BaseConfirmation: FC<ConfirmationProps> = ({
|
|
|
40
40
|
clearCodeOnError = true,
|
|
41
41
|
hideCountdownSection = false,
|
|
42
42
|
breakpoint = 1024,
|
|
43
|
+
initialScreenHintSlot,
|
|
43
44
|
...restProps
|
|
44
45
|
}) => {
|
|
45
46
|
const [timeLeft, startTimer, stopTimer] = useCountdown(countdownDuration);
|
|
@@ -104,6 +105,7 @@ export const BaseConfirmation: FC<ConfirmationProps> = ({
|
|
|
104
105
|
onChangeState,
|
|
105
106
|
onChangeScreen,
|
|
106
107
|
clearCodeOnError,
|
|
108
|
+
initialScreenHintSlot,
|
|
107
109
|
onInputFinished: handleInputFinished,
|
|
108
110
|
onSmsRetryClick: handleSmsRetry,
|
|
109
111
|
onFatalErrorOkButtonClick: handleFatalErrorOkButtonClick,
|
|
@@ -43,6 +43,7 @@ export const Initial: FC<InitialProps> = ({ mobile }) => {
|
|
|
43
43
|
phone,
|
|
44
44
|
clearCodeOnError,
|
|
45
45
|
hideCountdownSection,
|
|
46
|
+
initialScreenHintSlot,
|
|
46
47
|
onChangeState,
|
|
47
48
|
onInputFinished,
|
|
48
49
|
onChangeScreen,
|
|
@@ -133,6 +134,31 @@ export const Initial: FC<InitialProps> = ({ mobile }) => {
|
|
|
133
134
|
return false;
|
|
134
135
|
};
|
|
135
136
|
|
|
137
|
+
const renderHintButton = () => {
|
|
138
|
+
if (initialScreenHintSlot) {
|
|
139
|
+
return initialScreenHintSlot;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (mobile) {
|
|
143
|
+
return (
|
|
144
|
+
<ButtonMobile onClick={handleSmsHintLinkClick} view='link' size='xs'>
|
|
145
|
+
{texts.linkToHint}
|
|
146
|
+
</ButtonMobile>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<Link
|
|
152
|
+
onClick={handleSmsHintLinkClick}
|
|
153
|
+
className={styles.smsComeLink}
|
|
154
|
+
view={mobile ? 'primary' : 'secondary'}
|
|
155
|
+
pseudo={true}
|
|
156
|
+
>
|
|
157
|
+
{texts.linkToHint}
|
|
158
|
+
</Link>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
136
162
|
const processing = ['CODE_CHECKING', 'CODE_SENDING'].includes(state);
|
|
137
163
|
|
|
138
164
|
const timePassed = timeLeft === 0;
|
|
@@ -171,20 +197,7 @@ export const Initial: FC<InitialProps> = ({ mobile }) => {
|
|
|
171
197
|
/>
|
|
172
198
|
)}
|
|
173
199
|
|
|
174
|
-
{
|
|
175
|
-
<ButtonMobile onClick={handleSmsHintLinkClick} view='link' size='xs'>
|
|
176
|
-
{texts.linkToHint}
|
|
177
|
-
</ButtonMobile>
|
|
178
|
-
) : (
|
|
179
|
-
<Link
|
|
180
|
-
onClick={handleSmsHintLinkClick}
|
|
181
|
-
className={styles.smsComeLink}
|
|
182
|
-
view={mobile ? 'primary' : 'secondary'}
|
|
183
|
-
pseudo={true}
|
|
184
|
-
>
|
|
185
|
-
{texts.linkToHint}
|
|
186
|
-
</Link>
|
|
187
|
-
)}
|
|
200
|
+
{renderHintButton()}
|
|
188
201
|
</div>
|
|
189
202
|
);
|
|
190
203
|
};
|
|
@@ -2,7 +2,7 @@ import React, { FC, useContext } from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Button } from '@alfalab/core-components-button';
|
|
5
|
-
import {
|
|
5
|
+
import { Spinner } from '@alfalab/core-components-spinner';
|
|
6
6
|
import { Typography } from '@alfalab/core-components-typography';
|
|
7
7
|
|
|
8
8
|
import { ConfirmationContext } from '../../../context';
|
|
@@ -50,7 +50,7 @@ export const CountdownSection: FC<CountdownSectionProps> = ({
|
|
|
50
50
|
[styles.typographyTheme]: !mobile,
|
|
51
51
|
})}
|
|
52
52
|
>
|
|
53
|
-
<
|
|
53
|
+
<Spinner visible={true} />
|
|
54
54
|
|
|
55
55
|
<span className={styles.loaderText}>
|
|
56
56
|
{state === 'CODE_CHECKING' ? texts.codeChecking : texts.codeSending}
|
package/src/context.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -112,6 +112,11 @@ export type ConfirmationProps = {
|
|
|
112
112
|
*/
|
|
113
113
|
hideCountdownSection?: boolean;
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Слот для контента с подсказкой на главном экране
|
|
117
|
+
*/
|
|
118
|
+
initialScreenHintSlot?: ReactNode;
|
|
119
|
+
|
|
115
120
|
/**
|
|
116
121
|
* Контрольная точка для кнопки, с нее начинается desktop версия
|
|
117
122
|
* @default 1024
|
|
@@ -139,7 +144,11 @@ export type TConfirmationContext = Required<
|
|
|
139
144
|
> &
|
|
140
145
|
Pick<
|
|
141
146
|
ConfirmationProps,
|
|
142
|
-
|
|
147
|
+
| 'phone'
|
|
148
|
+
| 'blockSmsRetry'
|
|
149
|
+
| 'onTempBlockFinished'
|
|
150
|
+
| 'clearCodeOnError'
|
|
151
|
+
| 'initialScreenHintSlot'
|
|
143
152
|
> & {
|
|
144
153
|
timeLeft: number;
|
|
145
154
|
} & {
|
package/types.d.ts
CHANGED
|
@@ -89,13 +89,17 @@ type ConfirmationProps = {
|
|
|
89
89
|
* @default false
|
|
90
90
|
*/
|
|
91
91
|
hideCountdownSection?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Слот для контента с подсказкой на главном экране
|
|
94
|
+
*/
|
|
95
|
+
initialScreenHintSlot?: ReactNode;
|
|
92
96
|
/**
|
|
93
97
|
* Контрольная точка для кнопки, с нее начинается desktop версия
|
|
94
98
|
* @default 1024
|
|
95
99
|
*/
|
|
96
100
|
breakpoint?: number;
|
|
97
101
|
};
|
|
98
|
-
type TConfirmationContext = Required<Pick<ConfirmationProps, 'alignContent' | 'texts' | 'state' | 'screen' | 'requiredCharAmount' | 'onInputFinished' | 'countdownDuration' | 'onChangeState' | 'onSmsRetryClick' | 'onChangeScreen' | 'onFatalErrorOkButtonClick' | 'tempBlockDuration' | 'hideCountdownSection'>> & Pick<ConfirmationProps, 'phone' | 'blockSmsRetry' | 'onTempBlockFinished' | 'clearCodeOnError'> & {
|
|
102
|
+
type TConfirmationContext = Required<Pick<ConfirmationProps, 'alignContent' | 'texts' | 'state' | 'screen' | 'requiredCharAmount' | 'onInputFinished' | 'countdownDuration' | 'onChangeState' | 'onSmsRetryClick' | 'onChangeScreen' | 'onFatalErrorOkButtonClick' | 'tempBlockDuration' | 'hideCountdownSection'>> & Pick<ConfirmationProps, 'phone' | 'blockSmsRetry' | 'onTempBlockFinished' | 'clearCodeOnError' | 'initialScreenHintSlot'> & {
|
|
99
103
|
timeLeft: number;
|
|
100
104
|
} & {
|
|
101
105
|
/**
|
|
File without changes
|
|
File without changes
|
|
File without changes
|