@alfalab/core-components-confirmation 13.9.12 → 13.10.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/components/base-confirmation/component.js +5 -2
- package/components/base-confirmation/index.css +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 -0
- package/components/screens/fatal-error/component.js +1 -1
- package/components/screens/fatal-error/index.css +7 -7
- package/components/screens/hint/component.js +10 -10
- package/components/screens/hint/index.css +13 -13
- package/components/screens/index.d.ts +1 -0
- package/components/screens/index.js +2 -0
- package/components/screens/initial/component.js +8 -5
- package/components/screens/initial/countdown-section.js +1 -1
- package/components/screens/initial/index.css +25 -19
- package/components/screens/temp-block/component.js +2 -2
- package/components/screens/temp-block/index.css +14 -8
- package/components/screens/temp-block-over/component.d.ts +9 -0
- package/components/screens/temp-block-over/component.js +37 -0
- package/components/screens/temp-block-over/index.css +59 -0
- package/components/screens/temp-block-over/index.d.ts +1 -0
- package/components/screens/temp-block-over/index.js +9 -0
- package/{countdown-section-b7271098.js → countdown-section-66246bfb.js} +7 -4
- package/cssm/components/base-confirmation/component.js +4 -1
- package/cssm/components/index.js +2 -0
- package/cssm/components/screens/hint/component.js +9 -9
- package/cssm/components/screens/index.d.ts +1 -0
- package/cssm/components/screens/index.js +2 -0
- package/cssm/components/screens/initial/component.js +7 -4
- package/cssm/components/screens/initial/countdown-section.js +6 -3
- package/cssm/components/screens/initial/index.module.css +7 -0
- package/cssm/components/screens/temp-block/component.js +1 -1
- package/cssm/components/screens/temp-block/index.module.css +7 -0
- package/cssm/components/screens/temp-block-over/component.d.ts +9 -0
- package/cssm/components/screens/temp-block-over/component.js +36 -0
- package/cssm/components/screens/temp-block-over/index.d.ts +1 -0
- package/cssm/components/screens/temp-block-over/index.js +9 -0
- package/cssm/components/screens/temp-block-over/index.module.css +58 -0
- package/cssm/shared/index.js +2 -0
- package/cssm/types.d.ts +13 -2
- package/cssm/types.js +17 -9
- package/esm/components/base-confirmation/component.js +5 -2
- package/esm/components/base-confirmation/index.css +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 +1 -0
- package/esm/components/screens/fatal-error/component.js +1 -1
- package/esm/components/screens/fatal-error/index.css +7 -7
- package/esm/components/screens/hint/component.js +10 -10
- package/esm/components/screens/hint/index.css +13 -13
- package/esm/components/screens/index.d.ts +1 -0
- package/esm/components/screens/index.js +1 -0
- package/esm/components/screens/initial/component.js +8 -5
- package/esm/components/screens/initial/countdown-section.js +1 -1
- package/esm/components/screens/initial/index.css +25 -19
- package/esm/components/screens/temp-block/component.js +2 -2
- package/esm/components/screens/temp-block/index.css +14 -8
- package/esm/components/screens/temp-block-over/component.d.ts +9 -0
- package/esm/components/screens/temp-block-over/component.js +28 -0
- package/esm/components/screens/temp-block-over/index.css +59 -0
- package/esm/components/screens/temp-block-over/index.d.ts +1 -0
- package/esm/components/screens/temp-block-over/index.js +1 -0
- package/esm/{countdown-section-a99ec7db.js → countdown-section-b11f4c6f.js} +8 -5
- package/esm/mobile/component.mobile.js +1 -1
- package/esm/mobile/mobile.css +2 -2
- package/esm/shared/index.js +1 -0
- package/esm/types.d.ts +13 -2
- package/esm/types.js +17 -9
- package/mobile/component.mobile.js +1 -1
- package/mobile/mobile.css +2 -2
- package/modern/components/base-confirmation/component.js +5 -2
- package/modern/components/base-confirmation/index.css +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 +1 -0
- package/modern/components/screens/fatal-error/component.js +1 -1
- package/modern/components/screens/fatal-error/index.css +7 -7
- package/modern/components/screens/hint/component.js +10 -10
- package/modern/components/screens/hint/index.css +13 -13
- package/modern/components/screens/index.d.ts +1 -0
- package/modern/components/screens/index.js +1 -0
- package/modern/components/screens/initial/component.js +8 -5
- package/modern/components/screens/initial/countdown-section.js +1 -1
- package/modern/components/screens/initial/index.css +25 -19
- package/modern/components/screens/temp-block/component.js +2 -2
- package/modern/components/screens/temp-block/index.css +14 -8
- package/modern/components/screens/temp-block-over/component.d.ts +9 -0
- package/modern/components/screens/temp-block-over/component.js +26 -0
- package/modern/components/screens/temp-block-over/index.css +59 -0
- package/modern/components/screens/temp-block-over/index.d.ts +1 -0
- package/modern/components/screens/temp-block-over/index.js +1 -0
- package/modern/{countdown-section-7113cf49.js → countdown-section-5721eff6.js} +8 -5
- package/modern/mobile/component.mobile.js +1 -1
- package/modern/mobile/mobile.css +2 -2
- package/modern/shared/index.js +1 -0
- package/modern/types.d.ts +13 -2
- package/modern/types.js +17 -9
- package/moderncssm/components/base-confirmation/component.js +4 -1
- package/moderncssm/components/index.js +1 -0
- package/moderncssm/components/screens/hint/component.js +9 -9
- package/moderncssm/components/screens/index.d.ts +1 -0
- package/moderncssm/components/screens/index.js +1 -0
- package/moderncssm/components/screens/initial/component.js +7 -4
- package/moderncssm/components/screens/initial/countdown-section.js +7 -4
- package/moderncssm/components/screens/initial/index.module.css +9 -0
- package/moderncssm/components/screens/temp-block/component.js +1 -1
- package/moderncssm/components/screens/temp-block/index.module.css +9 -0
- package/moderncssm/components/screens/temp-block-over/component.d.ts +9 -0
- package/moderncssm/components/screens/temp-block-over/component.js +24 -0
- package/moderncssm/components/screens/temp-block-over/index.d.ts +1 -0
- package/moderncssm/components/screens/temp-block-over/index.js +1 -0
- package/moderncssm/components/screens/temp-block-over/index.module.css +42 -0
- package/moderncssm/shared/index.js +1 -0
- package/moderncssm/types.d.ts +13 -2
- package/moderncssm/types.js +17 -9
- package/package.json +1 -1
- package/shared/index.js +2 -0
- package/src/components/base-confirmation/component.tsx +6 -2
- package/src/components/screens/hint/component.tsx +11 -14
- package/src/components/screens/index.ts +1 -0
- package/src/components/screens/initial/component.tsx +9 -5
- package/src/components/screens/initial/countdown-section.tsx +9 -4
- package/src/components/screens/initial/index.module.css +8 -0
- package/src/components/screens/temp-block/component.tsx +1 -2
- package/src/components/screens/temp-block/index.module.css +8 -0
- package/src/components/screens/temp-block-over/component.tsx +55 -0
- package/src/components/screens/temp-block-over/index.module.css +23 -0
- package/src/components/screens/temp-block-over/index.ts +1 -0
- package/src/types.ts +36 -11
- package/types.d.ts +13 -2
- package/types.js +17 -9
- /package/{countdown-section-b7271098.d.ts → countdown-section-66246bfb.d.ts} +0 -0
- /package/esm/{countdown-section-a99ec7db.d.ts → countdown-section-b11f4c6f.d.ts} +0 -0
- /package/modern/{countdown-section-7113cf49.d.ts → countdown-section-5721eff6.d.ts} +0 -0
package/moderncssm/types.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
const defaultTexts = {
|
|
2
|
-
title: 'Введите код из\xa0
|
|
3
|
-
codeError: 'Код
|
|
2
|
+
title: 'Введите код из\xa0уведомления',
|
|
3
|
+
codeError: 'Код не подходит, проверьте его',
|
|
4
|
+
codeErrorExpired: 'Код устарел, запросите новый',
|
|
5
|
+
codeErrorExpiredEnded: 'Код устарел',
|
|
4
6
|
codeChecking: '',
|
|
5
7
|
codeSending: '',
|
|
6
|
-
buttonRetry: 'Запросить код
|
|
7
|
-
|
|
8
|
+
buttonRetry: 'Запросить код',
|
|
9
|
+
hintTitle: 'Не\xa0приходит код?',
|
|
10
|
+
hintDescription: 'Если\xa0сменили номер, позвоните нам или обратитесь в\xa0любой офис банка.',
|
|
11
|
+
hintNotification: 'Если номер не\xa0меняли, попробуйте запросить код позже — возможно, перегружен сервис отправки уведомлений.',
|
|
12
|
+
linkToHint: 'Не\xa0приходит код?',
|
|
8
13
|
hintButton: 'Вернуться к\xa0вводу кода',
|
|
9
14
|
noAttemptsLeft: 'Не\xa0осталось попыток запроса кода',
|
|
10
15
|
fatalErrorTitle: 'Ввести код больше нельзя',
|
|
11
|
-
fatalErrorDescription: '
|
|
16
|
+
fatalErrorDescription: 'Мы ограничили следующие попытки ввода, потому\xa0что код был введён неверно больше 5 раз.',
|
|
12
17
|
fatalErrorButton: 'Понятно',
|
|
13
|
-
tempBlockTitle: '
|
|
14
|
-
tempBlockDescription: '
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
tempBlockTitle: 'Ввести код пока нельзя',
|
|
19
|
+
tempBlockDescription: 'Слишком много неверных попыток. Запросите новый позже',
|
|
20
|
+
tempBlockOverTitle: 'Ввод разблокирован',
|
|
21
|
+
tempBlockOverDescription: 'Теперь можно запросить новый код',
|
|
22
|
+
tempBlockOverButton: 'Запросить новый код',
|
|
23
|
+
codeSended: 'Код отправлен',
|
|
24
|
+
countdown: 'Запросить новый можно через',
|
|
17
25
|
domesticPhone: '8 800 200 00 00',
|
|
18
26
|
internationalPhone: '+7 495 78 888 78',
|
|
19
27
|
};
|
package/package.json
CHANGED
package/shared/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var components_screens_initial_component = require('../components/screens/initia
|
|
|
6
6
|
var components_screens_hint_component = require('../components/screens/hint/component.js');
|
|
7
7
|
var components_screens_fatalError_component = require('../components/screens/fatal-error/component.js');
|
|
8
8
|
var components_screens_tempBlock_component = require('../components/screens/temp-block/component.js');
|
|
9
|
+
var components_screens_tempBlockOver_component = require('../components/screens/temp-block-over/component.js');
|
|
9
10
|
var components_countdownLoader_component = require('../components/countdown-loader/component.js');
|
|
10
11
|
var context = require('../context.js');
|
|
11
12
|
var types = require('../types.js');
|
|
@@ -17,6 +18,7 @@ exports.Initial = components_screens_initial_component.Initial;
|
|
|
17
18
|
exports.Hint = components_screens_hint_component.Hint;
|
|
18
19
|
exports.FatalError = components_screens_fatalError_component.FatalError;
|
|
19
20
|
exports.TempBlock = components_screens_tempBlock_component.TempBlock;
|
|
21
|
+
exports.TempBlockOver = components_screens_tempBlockOver_component.TempBlockOver;
|
|
20
22
|
exports.CountdownLoader = components_countdownLoader_component.CountdownLoader;
|
|
21
23
|
exports.ConfirmationContext = context.ConfirmationContext;
|
|
22
24
|
exports.defaultTexts = types.defaultTexts;
|
|
@@ -6,7 +6,7 @@ import { usePrevious } from '@alfalab/hooks';
|
|
|
6
6
|
import { ConfirmationContext } from '../../context';
|
|
7
7
|
import { ConfirmationProps, defaultTexts, TConfirmationContext } from '../../types';
|
|
8
8
|
import { ONE_DAY, ONE_MINUTE, useCountdown } from '../../utils';
|
|
9
|
-
import { FatalError, Hint, Initial, TempBlock } from '../screens';
|
|
9
|
+
import { FatalError, Hint, Initial, TempBlock, TempBlockOver } from '../screens';
|
|
10
10
|
|
|
11
11
|
import styles from './index.module.css';
|
|
12
12
|
|
|
@@ -15,6 +15,7 @@ const confirmationScreens: { [key: string]: ComponentType<{ mobile?: boolean }>
|
|
|
15
15
|
HINT: Hint,
|
|
16
16
|
FATAL_ERROR: FatalError,
|
|
17
17
|
TEMP_BLOCK: TempBlock,
|
|
18
|
+
TEMP_BLOCK_OVER: TempBlockOver,
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export const BaseConfirmation: FC<ConfirmationProps> = ({
|
|
@@ -66,7 +67,10 @@ export const BaseConfirmation: FC<ConfirmationProps> = ({
|
|
|
66
67
|
/**
|
|
67
68
|
* Останавливаем таймер, если новый экран/состояние не содержит таймер
|
|
68
69
|
*/
|
|
69
|
-
if (
|
|
70
|
+
if (
|
|
71
|
+
!['INITIAL', 'HINT', 'TEMP_BLOCK', 'TEMP_BLOCK_OVER'].includes(screen) ||
|
|
72
|
+
blockSmsRetry
|
|
73
|
+
) {
|
|
70
74
|
stopTimer();
|
|
71
75
|
}
|
|
72
76
|
}, [state, screen, blockSmsRetry, stopTimer]);
|
|
@@ -31,7 +31,7 @@ export const Hint: FC<HintProps> = ({ mobile }) => {
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<div className={cn(styles.component, styles[alignContent])}>
|
|
34
|
-
<Header mobile={mobile}
|
|
34
|
+
<Header mobile={mobile}>{texts.hintTitle}</Header>
|
|
35
35
|
|
|
36
36
|
<Text
|
|
37
37
|
view='primary-medium'
|
|
@@ -41,8 +41,7 @@ export const Hint: FC<HintProps> = ({ mobile }) => {
|
|
|
41
41
|
[styles.typographyThemeMobile]: mobile,
|
|
42
42
|
})}
|
|
43
43
|
>
|
|
44
|
-
|
|
45
|
-
отделение банка.
|
|
44
|
+
{texts.hintDescription}
|
|
46
45
|
</Text>
|
|
47
46
|
|
|
48
47
|
<div
|
|
@@ -52,11 +51,11 @@ export const Hint: FC<HintProps> = ({ mobile }) => {
|
|
|
52
51
|
>
|
|
53
52
|
<div className={cn(styles.phoneWrap, { [styles.phoneContentMobile]: mobile })}>
|
|
54
53
|
<Link
|
|
55
|
-
href={getPhoneHref(
|
|
54
|
+
href={getPhoneHref(internationalPhone)}
|
|
56
55
|
underline={false}
|
|
57
56
|
className={cn(styles.phoneLink, { [styles.typographyThemeMobile]: mobile })}
|
|
58
57
|
>
|
|
59
|
-
{
|
|
58
|
+
{internationalPhone}
|
|
60
59
|
</Link>
|
|
61
60
|
<Text
|
|
62
61
|
view='primary-medium'
|
|
@@ -67,18 +66,18 @@ export const Hint: FC<HintProps> = ({ mobile }) => {
|
|
|
67
66
|
})}
|
|
68
67
|
>
|
|
69
68
|
{mobile
|
|
70
|
-
? '
|
|
71
|
-
: ' \u2014\u00A0
|
|
69
|
+
? 'В\u00A0Москве и\u00A0за\u00A0границей'
|
|
70
|
+
: ' \u2014\u00A0в\u00A0Москве и\u00A0за\u00A0границей'}
|
|
72
71
|
</Text>
|
|
73
72
|
</div>
|
|
74
73
|
|
|
75
74
|
<div className={cn(styles.phoneWrap, { [styles.phoneContentMobile]: mobile })}>
|
|
76
75
|
<Link
|
|
77
|
-
href={getPhoneHref(
|
|
76
|
+
href={getPhoneHref(domesticPhone)}
|
|
78
77
|
underline={false}
|
|
79
78
|
className={cn(styles.phoneLink, { [styles.typographyThemeMobile]: mobile })}
|
|
80
79
|
>
|
|
81
|
-
{
|
|
80
|
+
{domesticPhone}
|
|
82
81
|
</Link>
|
|
83
82
|
<Text
|
|
84
83
|
view='primary-medium'
|
|
@@ -89,8 +88,8 @@ export const Hint: FC<HintProps> = ({ mobile }) => {
|
|
|
89
88
|
})}
|
|
90
89
|
>
|
|
91
90
|
{mobile
|
|
92
|
-
? '
|
|
93
|
-
: ' \u2014\u00A0
|
|
91
|
+
? 'Для\u00A0звонков по\u00A0России'
|
|
92
|
+
: ' \u2014\u00A0для звонков по\u00A0России'}
|
|
94
93
|
</Text>
|
|
95
94
|
</div>
|
|
96
95
|
</div>
|
|
@@ -103,10 +102,8 @@ export const Hint: FC<HintProps> = ({ mobile }) => {
|
|
|
103
102
|
[styles.typographyThemeMobile]: mobile,
|
|
104
103
|
})}
|
|
105
104
|
>
|
|
106
|
-
|
|
107
|
-
Попробуйте повторить действие через несколько минут.
|
|
105
|
+
{texts.hintNotification}
|
|
108
106
|
</Text>
|
|
109
|
-
|
|
110
107
|
<Button
|
|
111
108
|
size={mobile ? 'xs' : 's'}
|
|
112
109
|
view='secondary'
|
|
@@ -98,10 +98,6 @@ export const Initial: FC<InitialProps> = ({ mobile }) => {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
if (state === 'CODE_ERROR' && prevState !== 'CODE_ERROR') {
|
|
102
|
-
inputRef.current.focus(requiredCharAmount - 1);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
101
|
if (prevState === 'CODE_SENDING' && state !== 'CODE_SENDING') {
|
|
106
102
|
inputRef.current.focus();
|
|
107
103
|
}
|
|
@@ -120,6 +116,14 @@ export const Initial: FC<InitialProps> = ({ mobile }) => {
|
|
|
120
116
|
}, [prevState, state, clearTimer]);
|
|
121
117
|
|
|
122
118
|
const getCodeInputError = (): string | boolean => {
|
|
119
|
+
if (state === 'CODE_EXPIRED') {
|
|
120
|
+
return texts.codeErrorExpired || true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (state === 'CODE_EXPIRED_ENDED') {
|
|
124
|
+
return texts.codeErrorExpiredEnded || true;
|
|
125
|
+
}
|
|
126
|
+
|
|
123
127
|
if (state === 'CODE_ERROR') {
|
|
124
128
|
return texts.codeError || true;
|
|
125
129
|
}
|
|
@@ -176,7 +180,7 @@ export const Initial: FC<InitialProps> = ({ mobile }) => {
|
|
|
176
180
|
[styles.typographyThemeMobile]: mobile,
|
|
177
181
|
})}
|
|
178
182
|
>
|
|
179
|
-
|
|
183
|
+
Отправили на {phone}
|
|
180
184
|
</Text>
|
|
181
185
|
) : null}
|
|
182
186
|
<ComponentCodeInput
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC, useContext } from 'react';
|
|
1
|
+
import React, { FC, Fragment,ReactNode, useContext } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Button } from '@alfalab/core-components-button';
|
|
@@ -28,7 +28,7 @@ export const CountdownSection: FC<CountdownSectionProps> = ({
|
|
|
28
28
|
const { state, texts, timeLeft, blockSmsRetry, breakpoint, client } =
|
|
29
29
|
useContext(ConfirmationContext);
|
|
30
30
|
|
|
31
|
-
const renderText = (
|
|
31
|
+
const renderText = (content: ReactNode) => (
|
|
32
32
|
<Text
|
|
33
33
|
className={cn(styles.countdownContainer, {
|
|
34
34
|
[styles.countdownMobile]: mobile,
|
|
@@ -37,7 +37,7 @@ export const CountdownSection: FC<CountdownSectionProps> = ({
|
|
|
37
37
|
view={mobile ? 'primary-small' : 'primary-medium'}
|
|
38
38
|
tag='div'
|
|
39
39
|
>
|
|
40
|
-
{
|
|
40
|
+
{content}
|
|
41
41
|
</Text>
|
|
42
42
|
);
|
|
43
43
|
|
|
@@ -77,5 +77,10 @@ export const CountdownSection: FC<CountdownSectionProps> = ({
|
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
return renderText(
|
|
80
|
+
return renderText(
|
|
81
|
+
<Fragment>
|
|
82
|
+
{texts.countdown}{'\u00A0'}
|
|
83
|
+
<time className={styles.timeCounter}>{formatMsAsMinutes(timeLeft)}</time>
|
|
84
|
+
</Fragment>,
|
|
85
|
+
);
|
|
81
86
|
};
|
|
@@ -64,6 +64,14 @@
|
|
|
64
64
|
margin-bottom: var(--gap-16);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
.timeCounter {
|
|
68
|
+
display: inline-block;
|
|
69
|
+
min-width: 47px;
|
|
70
|
+
color: var(--color-light-text-secondary);
|
|
71
|
+
text-align: left;
|
|
72
|
+
font-variant-numeric: lining-nums tabular-nums;
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
.getCodeButton {
|
|
68
76
|
position: relative;
|
|
69
77
|
top: var(--gap-4-neg);
|
|
@@ -53,8 +53,7 @@ export const TempBlock: FC<TempBlockProps> = ({ mobile }) => {
|
|
|
53
53
|
progress={1 - timeLeft / tempBlockDuration}
|
|
54
54
|
className={styles.loader}
|
|
55
55
|
/>
|
|
56
|
-
|
|
57
|
-
{formatMsAsMinutes(timeLeft)}
|
|
56
|
+
<time className={styles.timeCounter}>{formatMsAsMinutes(timeLeft)}</time>
|
|
58
57
|
</div>
|
|
59
58
|
</div>
|
|
60
59
|
);
|
|
@@ -27,6 +27,14 @@
|
|
|
27
27
|
align-items: center;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
.timeCounter {
|
|
31
|
+
display: inline-block;
|
|
32
|
+
min-width: 47px;
|
|
33
|
+
color: var(--color-light-text-secondary);
|
|
34
|
+
text-align: left;
|
|
35
|
+
font-variant-numeric: lining-nums tabular-nums;
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
.loader {
|
|
31
39
|
margin-right: var(--gap-8);
|
|
32
40
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { Button } from '@alfalab/core-components-button';
|
|
5
|
+
import { Text } from '@alfalab/core-components-typography';
|
|
6
|
+
|
|
7
|
+
import { ConfirmationContext } from '../../../context';
|
|
8
|
+
import { Header } from '../../header';
|
|
9
|
+
|
|
10
|
+
import styles from './index.module.css';
|
|
11
|
+
|
|
12
|
+
export type TempBlockOverProps = {
|
|
13
|
+
/**
|
|
14
|
+
* Отображать в мобильной версии экран компонента
|
|
15
|
+
*/
|
|
16
|
+
mobile?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const TempBlockOver: FC<TempBlockOverProps> = ({ mobile }) => {
|
|
20
|
+
const { alignContent, texts, breakpoint, client, onChangeScreen, onChangeState } =
|
|
21
|
+
useContext(ConfirmationContext);
|
|
22
|
+
|
|
23
|
+
const handleReturnButtonClick = () => {
|
|
24
|
+
onChangeScreen('INITIAL');
|
|
25
|
+
onChangeState('INITIAL');
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className={cn(styles.component, styles[alignContent])}>
|
|
30
|
+
<Header mobile={mobile}>{texts.tempBlockOverTitle}</Header>
|
|
31
|
+
|
|
32
|
+
<Text
|
|
33
|
+
view='primary-medium'
|
|
34
|
+
color='primary'
|
|
35
|
+
className={cn(styles.description, {
|
|
36
|
+
[styles.typographyTheme]: !mobile,
|
|
37
|
+
[styles.typographyThemeMobile]: mobile,
|
|
38
|
+
})}
|
|
39
|
+
>
|
|
40
|
+
{texts.tempBlockOverDescription}
|
|
41
|
+
</Text>
|
|
42
|
+
|
|
43
|
+
<Button
|
|
44
|
+
size={mobile ? 'xs' : 's'}
|
|
45
|
+
view='secondary'
|
|
46
|
+
onClick={handleReturnButtonClick}
|
|
47
|
+
className={styles.button}
|
|
48
|
+
breakpoint={breakpoint}
|
|
49
|
+
client={client}
|
|
50
|
+
>
|
|
51
|
+
{texts.tempBlockOverButton}
|
|
52
|
+
</Button>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import '../../../vars.css';
|
|
2
|
+
|
|
3
|
+
.component {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.center {
|
|
9
|
+
align-items: center;
|
|
10
|
+
text-align: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.typographyTheme.typographyTheme {
|
|
14
|
+
@mixin _confirmation-text;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.typographyThemeMobile.typographyThemeMobile {
|
|
18
|
+
color: var(--color-light-text-secondary);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.button.button {
|
|
22
|
+
margin-top: var(--gap-32);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component';
|
package/src/types.ts
CHANGED
|
@@ -173,6 +173,8 @@ export type ConfirmationTexts = {
|
|
|
173
173
|
*/
|
|
174
174
|
title?: ReactNode; // заголовок
|
|
175
175
|
codeError?: string; // ошибка проверки кода
|
|
176
|
+
codeErrorExpired?: string; // код устарел, запросите новый
|
|
177
|
+
codeErrorExpiredEnded?: string; // код устарел
|
|
176
178
|
codeChecking?: string; // код проверяется
|
|
177
179
|
codeSending?: string; // код отправляется
|
|
178
180
|
codeSended?: string; // код отправлен
|
|
@@ -184,9 +186,13 @@ export type ConfirmationTexts = {
|
|
|
184
186
|
/**
|
|
185
187
|
* Экран HINT
|
|
186
188
|
*/
|
|
189
|
+
hintTitle?: string; // заголовок
|
|
190
|
+
hintDescription?: string; // описание
|
|
191
|
+
hintNotification?: string; // уведомление
|
|
187
192
|
hintButton?: string; // кнопка 'Вернуться'
|
|
188
193
|
domesticPhone?: string; // номер телефона для звонков по России
|
|
189
194
|
internationalPhone?: string; // номер телефона для звонков из-за границы
|
|
195
|
+
|
|
190
196
|
/**
|
|
191
197
|
* Экран FATAL_ERROR
|
|
192
198
|
*/
|
|
@@ -199,41 +205,60 @@ export type ConfirmationTexts = {
|
|
|
199
205
|
*/
|
|
200
206
|
tempBlockTitle?: ReactNode; // заголовок
|
|
201
207
|
tempBlockDescription?: ReactNode; // описание
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Экран TEMP_BLOCK_OVER
|
|
211
|
+
*/
|
|
212
|
+
tempBlockOverTitle?: ReactNode; // заголовок
|
|
213
|
+
tempBlockOverDescription?: ReactNode; // описание
|
|
214
|
+
tempBlockOverButton?: string; // кнопка
|
|
202
215
|
};
|
|
203
216
|
|
|
204
217
|
export type ConfirmationScreen =
|
|
205
218
|
| 'INITIAL' // начальный экран
|
|
206
219
|
| 'HINT' // экран "Не приходит смс?"
|
|
207
220
|
| 'FATAL_ERROR' // экран критической ошибки
|
|
208
|
-
| 'TEMP_BLOCK'
|
|
221
|
+
| 'TEMP_BLOCK' // экран временной блокировки
|
|
222
|
+
| 'TEMP_BLOCK_OVER'; // экран todo
|
|
209
223
|
|
|
210
224
|
export type ConfirmationState =
|
|
211
225
|
| 'INITIAL' // начальное состояние
|
|
212
226
|
| 'CODE_CHECKING' // проверка кода
|
|
213
227
|
| 'CODE_SENDING' // повторная отправка кода
|
|
214
|
-
| 'CODE_ERROR'
|
|
228
|
+
| 'CODE_ERROR' // ошибка, когда ввели неверный код
|
|
229
|
+
| 'CODE_EXPIRED' // ошибка, когда код устарел, но можно запросить новый
|
|
230
|
+
| 'CODE_EXPIRED_ENDED'; // ошибка, когда код устарел
|
|
215
231
|
|
|
216
232
|
export type ScreensMap = {
|
|
217
233
|
[key: string]: ComponentType;
|
|
218
234
|
};
|
|
219
235
|
|
|
220
236
|
export const defaultTexts: ConfirmationTexts = {
|
|
221
|
-
title: 'Введите код из\xa0
|
|
222
|
-
codeError: 'Код
|
|
237
|
+
title: 'Введите код из\xa0уведомления',
|
|
238
|
+
codeError: 'Код не подходит, проверьте его',
|
|
239
|
+
codeErrorExpired: 'Код устарел, запросите новый',
|
|
240
|
+
codeErrorExpiredEnded: 'Код устарел',
|
|
223
241
|
codeChecking: '',
|
|
224
242
|
codeSending: '',
|
|
225
|
-
buttonRetry: 'Запросить код
|
|
226
|
-
|
|
243
|
+
buttonRetry: 'Запросить код',
|
|
244
|
+
hintTitle: 'Не\xa0приходит код?',
|
|
245
|
+
hintDescription: 'Если\xa0сменили номер, позвоните нам или обратитесь в\xa0любой офис банка.',
|
|
246
|
+
hintNotification:
|
|
247
|
+
'Если номер не\xa0меняли, попробуйте запросить код позже — возможно, перегружен сервис отправки уведомлений.',
|
|
248
|
+
linkToHint: 'Не\xa0приходит код?',
|
|
227
249
|
hintButton: 'Вернуться к\xa0вводу кода',
|
|
228
250
|
noAttemptsLeft: 'Не\xa0осталось попыток запроса кода',
|
|
229
251
|
fatalErrorTitle: 'Ввести код больше нельзя',
|
|
230
252
|
fatalErrorDescription:
|
|
231
|
-
'
|
|
253
|
+
'Мы ограничили следующие попытки ввода, потому\xa0что код был введён неверно больше 5 раз.',
|
|
232
254
|
fatalErrorButton: 'Понятно',
|
|
233
|
-
tempBlockTitle: '
|
|
234
|
-
tempBlockDescription: '
|
|
235
|
-
|
|
236
|
-
|
|
255
|
+
tempBlockTitle: 'Ввести код пока нельзя',
|
|
256
|
+
tempBlockDescription: 'Слишком много неверных попыток. Запросите новый позже',
|
|
257
|
+
tempBlockOverTitle: 'Ввод разблокирован',
|
|
258
|
+
tempBlockOverDescription: 'Теперь можно запросить новый код',
|
|
259
|
+
tempBlockOverButton: 'Запросить новый код',
|
|
260
|
+
codeSended: 'Код отправлен',
|
|
261
|
+
countdown: 'Запросить новый можно через',
|
|
237
262
|
domesticPhone: '8 800 200 00 00',
|
|
238
263
|
internationalPhone: '+7 495 78 888 78',
|
|
239
264
|
};
|
package/types.d.ts
CHANGED
|
@@ -117,6 +117,8 @@ type ConfirmationTexts = {
|
|
|
117
117
|
*/
|
|
118
118
|
title?: ReactNode;
|
|
119
119
|
codeError?: string;
|
|
120
|
+
codeErrorExpired?: string;
|
|
121
|
+
codeErrorExpiredEnded?: string;
|
|
120
122
|
codeChecking?: string;
|
|
121
123
|
codeSending?: string;
|
|
122
124
|
codeSended?: string;
|
|
@@ -127,6 +129,9 @@ type ConfirmationTexts = {
|
|
|
127
129
|
/**
|
|
128
130
|
* Экран HINT
|
|
129
131
|
*/
|
|
132
|
+
hintTitle?: string;
|
|
133
|
+
hintDescription?: string;
|
|
134
|
+
hintNotification?: string;
|
|
130
135
|
hintButton?: string;
|
|
131
136
|
domesticPhone?: string;
|
|
132
137
|
internationalPhone?: string;
|
|
@@ -141,9 +146,15 @@ type ConfirmationTexts = {
|
|
|
141
146
|
*/
|
|
142
147
|
tempBlockTitle?: ReactNode;
|
|
143
148
|
tempBlockDescription?: ReactNode;
|
|
149
|
+
/**
|
|
150
|
+
* Экран TEMP_BLOCK_OVER
|
|
151
|
+
*/
|
|
152
|
+
tempBlockOverTitle?: ReactNode;
|
|
153
|
+
tempBlockOverDescription?: ReactNode;
|
|
154
|
+
tempBlockOverButton?: string;
|
|
144
155
|
};
|
|
145
|
-
type ConfirmationScreen = 'INITIAL' | 'HINT' | 'FATAL_ERROR' | 'TEMP_BLOCK';
|
|
146
|
-
type ConfirmationState = 'INITIAL' | 'CODE_CHECKING' | 'CODE_SENDING' | 'CODE_ERROR';
|
|
156
|
+
type ConfirmationScreen = 'INITIAL' | 'HINT' | 'FATAL_ERROR' | 'TEMP_BLOCK' | 'TEMP_BLOCK_OVER';
|
|
157
|
+
type ConfirmationState = 'INITIAL' | 'CODE_CHECKING' | 'CODE_SENDING' | 'CODE_ERROR' | 'CODE_EXPIRED' | 'CODE_EXPIRED_ENDED';
|
|
147
158
|
type ScreensMap = {
|
|
148
159
|
[key: string]: ComponentType;
|
|
149
160
|
};
|
package/types.js
CHANGED
|
@@ -3,21 +3,29 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var defaultTexts = {
|
|
6
|
-
title: 'Введите код из\xa0
|
|
7
|
-
codeError: 'Код
|
|
6
|
+
title: 'Введите код из\xa0уведомления',
|
|
7
|
+
codeError: 'Код не подходит, проверьте его',
|
|
8
|
+
codeErrorExpired: 'Код устарел, запросите новый',
|
|
9
|
+
codeErrorExpiredEnded: 'Код устарел',
|
|
8
10
|
codeChecking: '',
|
|
9
11
|
codeSending: '',
|
|
10
|
-
buttonRetry: 'Запросить код
|
|
11
|
-
|
|
12
|
+
buttonRetry: 'Запросить код',
|
|
13
|
+
hintTitle: 'Не\xa0приходит код?',
|
|
14
|
+
hintDescription: 'Если\xa0сменили номер, позвоните нам или обратитесь в\xa0любой офис банка.',
|
|
15
|
+
hintNotification: 'Если номер не\xa0меняли, попробуйте запросить код позже — возможно, перегружен сервис отправки уведомлений.',
|
|
16
|
+
linkToHint: 'Не\xa0приходит код?',
|
|
12
17
|
hintButton: 'Вернуться к\xa0вводу кода',
|
|
13
18
|
noAttemptsLeft: 'Не\xa0осталось попыток запроса кода',
|
|
14
19
|
fatalErrorTitle: 'Ввести код больше нельзя',
|
|
15
|
-
fatalErrorDescription: '
|
|
20
|
+
fatalErrorDescription: 'Мы ограничили следующие попытки ввода, потому\xa0что код был введён неверно больше 5 раз.',
|
|
16
21
|
fatalErrorButton: 'Понятно',
|
|
17
|
-
tempBlockTitle: '
|
|
18
|
-
tempBlockDescription: '
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
tempBlockTitle: 'Ввести код пока нельзя',
|
|
23
|
+
tempBlockDescription: 'Слишком много неверных попыток. Запросите новый позже',
|
|
24
|
+
tempBlockOverTitle: 'Ввод разблокирован',
|
|
25
|
+
tempBlockOverDescription: 'Теперь можно запросить новый код',
|
|
26
|
+
tempBlockOverButton: 'Запросить новый код',
|
|
27
|
+
codeSended: 'Код отправлен',
|
|
28
|
+
countdown: 'Запросить новый можно через',
|
|
21
29
|
domesticPhone: '8 800 200 00 00',
|
|
22
30
|
internationalPhone: '+7 495 78 888 78',
|
|
23
31
|
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|