@alfalab/core-components-confirmation 14.0.1 → 14.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.responsive.d.ts +2 -2
- package/component.responsive.js.map +1 -1
- package/components/base-confirmation/component.d.ts +2 -2
- package/components/base-confirmation/component.js +4 -3
- package/components/base-confirmation/component.js.map +1 -1
- package/components/base-confirmation/index.css +3 -3
- package/components/base-confirmation/index.module.css.js +1 -1
- package/components/base-confirmation/index.module.css.js.map +1 -1
- package/components/countdown-loader/component.d.ts +1 -1
- package/components/countdown-loader/component.js.map +1 -1
- package/components/countdown-loader/index.css +1 -1
- package/components/countdown-loader/index.module.css.js +1 -1
- package/components/countdown-loader/index.module.css.js.map +1 -1
- package/components/header/component.d.ts +6 -1
- package/components/header/component.js +2 -2
- package/components/header/component.js.map +1 -1
- package/components/header/index.css +5 -5
- package/components/header/index.module.css.js +1 -1
- package/components/screens/fatal-error/component.d.ts +1 -1
- package/components/screens/fatal-error/component.js +2 -2
- package/components/screens/fatal-error/component.js.map +1 -1
- package/components/screens/fatal-error/index.css +8 -10
- package/components/screens/fatal-error/index.module.css.js +1 -1
- package/components/screens/hint/component.d.ts +1 -1
- package/components/screens/hint/component.js +2 -2
- package/components/screens/hint/component.js.map +1 -1
- package/components/screens/hint/index.css +16 -18
- package/components/screens/hint/index.module.css.js +1 -1
- package/components/screens/initial/component.d.ts +1 -1
- package/components/screens/initial/component.js +2 -2
- package/components/screens/initial/component.js.map +1 -1
- package/components/screens/initial/countdown-section.d.ts +1 -1
- package/components/screens/initial/countdown-section.js.map +1 -1
- package/components/screens/initial/index.css +22 -24
- package/components/screens/initial/index.module.css.js +1 -1
- package/components/screens/temp-block/component.d.ts +1 -1
- package/components/screens/temp-block/component.js +2 -2
- package/components/screens/temp-block/component.js.map +1 -1
- package/components/screens/temp-block/index.css +10 -12
- package/components/screens/temp-block/index.module.css.js +1 -1
- package/components/screens/temp-block-over/component.d.ts +1 -1
- package/components/screens/temp-block-over/component.js +2 -2
- package/components/screens/temp-block-over/component.js.map +1 -1
- package/components/screens/temp-block-over/index.css +7 -9
- package/components/screens/temp-block-over/index.module.css.js +1 -1
- package/context.d.ts +1 -1
- package/context.js +1 -0
- package/context.js.map +1 -1
- package/cssm/component.responsive.d.ts +2 -2
- package/cssm/component.responsive.js.map +1 -1
- package/cssm/components/base-confirmation/component.d.ts +2 -2
- package/cssm/components/base-confirmation/component.js +4 -3
- package/cssm/components/base-confirmation/component.js.map +1 -1
- package/cssm/components/base-confirmation/index.module.css +1 -1
- package/cssm/components/countdown-loader/component.d.ts +1 -1
- package/cssm/components/countdown-loader/component.js.map +1 -1
- package/cssm/components/header/component.d.ts +6 -1
- package/cssm/components/header/component.js +2 -2
- package/cssm/components/header/component.js.map +1 -1
- package/cssm/components/header/index.module.css +2 -2
- package/cssm/components/screens/fatal-error/component.d.ts +1 -1
- package/cssm/components/screens/fatal-error/component.js +2 -2
- package/cssm/components/screens/fatal-error/component.js.map +1 -1
- package/cssm/components/screens/fatal-error/index.module.css +2 -4
- package/cssm/components/screens/hint/component.d.ts +1 -1
- package/cssm/components/screens/hint/component.js +2 -2
- package/cssm/components/screens/hint/component.js.map +1 -1
- package/cssm/components/screens/hint/index.module.css +4 -6
- package/cssm/components/screens/initial/component.d.ts +1 -1
- package/cssm/components/screens/initial/component.js +2 -2
- package/cssm/components/screens/initial/component.js.map +1 -1
- package/cssm/components/screens/initial/countdown-section.d.ts +1 -1
- package/cssm/components/screens/initial/countdown-section.js.map +1 -1
- package/cssm/components/screens/initial/index.module.css +3 -5
- package/cssm/components/screens/temp-block/component.d.ts +1 -1
- package/cssm/components/screens/temp-block/component.js +2 -2
- package/cssm/components/screens/temp-block/component.js.map +1 -1
- package/cssm/components/screens/temp-block/index.module.css +2 -4
- package/cssm/components/screens/temp-block-over/component.d.ts +1 -1
- package/cssm/components/screens/temp-block-over/component.js +2 -2
- package/cssm/components/screens/temp-block-over/component.js.map +1 -1
- package/cssm/components/screens/temp-block-over/index.module.css +2 -4
- package/cssm/context.d.ts +1 -1
- package/cssm/context.js +1 -0
- package/cssm/context.js.map +1 -1
- package/cssm/desktop/component.desktop.d.ts +2 -2
- package/cssm/desktop/component.desktop.js.map +1 -1
- package/cssm/mobile/component.mobile.d.ts +2 -2
- package/cssm/mobile/component.mobile.js.map +1 -1
- package/cssm/types.d.ts +13 -8
- package/cssm/types.js.map +1 -1
- package/cssm/utils.d.ts +1 -1
- package/cssm/utils.js.map +1 -1
- package/desktop/component.desktop.d.ts +2 -2
- package/desktop/component.desktop.js.map +1 -1
- package/esm/component.responsive.d.ts +2 -2
- package/esm/component.responsive.js.map +1 -1
- package/esm/components/base-confirmation/component.d.ts +2 -2
- package/esm/components/base-confirmation/component.js +4 -3
- package/esm/components/base-confirmation/component.js.map +1 -1
- package/esm/components/base-confirmation/index.css +3 -3
- package/esm/components/base-confirmation/index.module.css.js +1 -1
- package/esm/components/base-confirmation/index.module.css.js.map +1 -1
- package/esm/components/countdown-loader/component.d.ts +1 -1
- package/esm/components/countdown-loader/component.js.map +1 -1
- package/esm/components/countdown-loader/index.css +1 -1
- package/esm/components/countdown-loader/index.module.css.js +1 -1
- package/esm/components/countdown-loader/index.module.css.js.map +1 -1
- package/esm/components/header/component.d.ts +6 -1
- package/esm/components/header/component.js +2 -2
- package/esm/components/header/component.js.map +1 -1
- package/esm/components/header/index.css +5 -5
- package/esm/components/header/index.module.css.js +1 -1
- package/esm/components/screens/fatal-error/component.d.ts +1 -1
- package/esm/components/screens/fatal-error/component.js +2 -2
- package/esm/components/screens/fatal-error/component.js.map +1 -1
- package/esm/components/screens/fatal-error/index.css +8 -10
- package/esm/components/screens/fatal-error/index.module.css.js +1 -1
- package/esm/components/screens/hint/component.d.ts +1 -1
- package/esm/components/screens/hint/component.js +2 -2
- package/esm/components/screens/hint/component.js.map +1 -1
- package/esm/components/screens/hint/index.css +16 -18
- package/esm/components/screens/hint/index.module.css.js +1 -1
- package/esm/components/screens/initial/component.d.ts +1 -1
- package/esm/components/screens/initial/component.js +2 -2
- package/esm/components/screens/initial/component.js.map +1 -1
- package/esm/components/screens/initial/countdown-section.d.ts +1 -1
- package/esm/components/screens/initial/countdown-section.js.map +1 -1
- package/esm/components/screens/initial/index.css +22 -24
- package/esm/components/screens/initial/index.module.css.js +1 -1
- package/esm/components/screens/temp-block/component.d.ts +1 -1
- package/esm/components/screens/temp-block/component.js +2 -2
- package/esm/components/screens/temp-block/component.js.map +1 -1
- package/esm/components/screens/temp-block/index.css +10 -12
- package/esm/components/screens/temp-block/index.module.css.js +1 -1
- package/esm/components/screens/temp-block-over/component.d.ts +1 -1
- package/esm/components/screens/temp-block-over/component.js +2 -2
- package/esm/components/screens/temp-block-over/component.js.map +1 -1
- package/esm/components/screens/temp-block-over/index.css +7 -9
- package/esm/components/screens/temp-block-over/index.module.css.js +1 -1
- package/esm/context.d.ts +1 -1
- package/esm/context.js +1 -0
- package/esm/context.js.map +1 -1
- package/esm/desktop/component.desktop.d.ts +2 -2
- package/esm/desktop/component.desktop.js.map +1 -1
- package/esm/mobile/component.mobile.d.ts +2 -2
- package/esm/mobile/component.mobile.js.map +1 -1
- package/esm/mobile/mobile.css +1 -1
- package/esm/mobile/mobile.module.css.js +1 -1
- package/esm/types.d.ts +13 -8
- package/esm/types.js.map +1 -1
- package/esm/utils.d.ts +1 -1
- package/esm/utils.js.map +1 -1
- package/mobile/component.mobile.d.ts +2 -2
- package/mobile/component.mobile.js.map +1 -1
- package/mobile/mobile.css +1 -1
- package/mobile/mobile.module.css.js +1 -1
- package/modern/component.responsive.d.ts +2 -2
- package/modern/component.responsive.js.map +1 -1
- package/modern/components/base-confirmation/component.d.ts +2 -2
- package/modern/components/base-confirmation/component.js +3 -2
- package/modern/components/base-confirmation/component.js.map +1 -1
- package/modern/components/base-confirmation/index.css +3 -3
- package/modern/components/base-confirmation/index.module.css.js +1 -1
- package/modern/components/base-confirmation/index.module.css.js.map +1 -1
- package/modern/components/countdown-loader/component.d.ts +1 -1
- package/modern/components/countdown-loader/component.js.map +1 -1
- package/modern/components/countdown-loader/index.css +1 -1
- package/modern/components/countdown-loader/index.module.css.js +1 -1
- package/modern/components/countdown-loader/index.module.css.js.map +1 -1
- package/modern/components/header/component.d.ts +6 -1
- package/modern/components/header/component.js +1 -1
- package/modern/components/header/component.js.map +1 -1
- package/modern/components/header/index.css +5 -5
- package/modern/components/header/index.module.css.js +1 -1
- package/modern/components/screens/fatal-error/component.d.ts +1 -1
- package/modern/components/screens/fatal-error/component.js +2 -2
- package/modern/components/screens/fatal-error/component.js.map +1 -1
- package/modern/components/screens/fatal-error/index.css +8 -10
- package/modern/components/screens/fatal-error/index.module.css.js +1 -1
- package/modern/components/screens/hint/component.d.ts +1 -1
- package/modern/components/screens/hint/component.js +2 -2
- package/modern/components/screens/hint/component.js.map +1 -1
- package/modern/components/screens/hint/index.css +16 -18
- package/modern/components/screens/hint/index.module.css.js +1 -1
- package/modern/components/screens/initial/component.d.ts +1 -1
- package/modern/components/screens/initial/component.js +2 -2
- package/modern/components/screens/initial/component.js.map +1 -1
- package/modern/components/screens/initial/countdown-section.d.ts +1 -1
- package/modern/components/screens/initial/countdown-section.js.map +1 -1
- package/modern/components/screens/initial/index.css +22 -24
- package/modern/components/screens/initial/index.module.css.js +1 -1
- package/modern/components/screens/temp-block/component.d.ts +1 -1
- package/modern/components/screens/temp-block/component.js +2 -2
- package/modern/components/screens/temp-block/component.js.map +1 -1
- package/modern/components/screens/temp-block/index.css +10 -12
- package/modern/components/screens/temp-block/index.module.css.js +1 -1
- package/modern/components/screens/temp-block-over/component.d.ts +1 -1
- package/modern/components/screens/temp-block-over/component.js +2 -2
- package/modern/components/screens/temp-block-over/component.js.map +1 -1
- package/modern/components/screens/temp-block-over/index.css +7 -9
- package/modern/components/screens/temp-block-over/index.module.css.js +1 -1
- package/modern/context.d.ts +1 -1
- package/modern/context.js +1 -0
- package/modern/context.js.map +1 -1
- package/modern/desktop/component.desktop.d.ts +2 -2
- package/modern/desktop/component.desktop.js.map +1 -1
- package/modern/mobile/component.mobile.d.ts +2 -2
- package/modern/mobile/component.mobile.js.map +1 -1
- package/modern/mobile/mobile.css +1 -1
- package/modern/mobile/mobile.module.css.js +1 -1
- package/modern/types.d.ts +13 -8
- package/modern/types.js.map +1 -1
- package/modern/utils.d.ts +1 -1
- package/modern/utils.js.map +1 -1
- package/moderncssm/component.responsive.d.ts +2 -2
- package/moderncssm/component.responsive.js.map +1 -1
- package/moderncssm/components/base-confirmation/component.d.ts +2 -2
- package/moderncssm/components/base-confirmation/component.js +3 -2
- package/moderncssm/components/base-confirmation/component.js.map +1 -1
- package/moderncssm/components/base-confirmation/index.module.css +3 -2
- package/moderncssm/components/countdown-loader/component.d.ts +1 -1
- package/moderncssm/components/countdown-loader/component.js.map +1 -1
- package/moderncssm/components/countdown-loader/index.module.css +2 -0
- package/moderncssm/components/header/component.d.ts +6 -1
- package/moderncssm/components/header/component.js +1 -1
- package/moderncssm/components/header/component.js.map +1 -1
- package/moderncssm/components/header/index.module.css +2 -0
- package/moderncssm/components/screens/fatal-error/component.d.ts +1 -1
- package/moderncssm/components/screens/fatal-error/component.js +2 -2
- package/moderncssm/components/screens/fatal-error/component.js.map +1 -1
- package/moderncssm/components/screens/fatal-error/index.module.css +2 -2
- package/moderncssm/components/screens/hint/component.d.ts +1 -1
- package/moderncssm/components/screens/hint/component.js +2 -2
- package/moderncssm/components/screens/hint/component.js.map +1 -1
- package/moderncssm/components/screens/hint/index.module.css +4 -4
- package/moderncssm/components/screens/initial/component.d.ts +1 -1
- package/moderncssm/components/screens/initial/component.js +2 -2
- package/moderncssm/components/screens/initial/component.js.map +1 -1
- package/moderncssm/components/screens/initial/countdown-section.d.ts +1 -1
- package/moderncssm/components/screens/initial/countdown-section.js.map +1 -1
- package/moderncssm/components/screens/initial/index.module.css +3 -3
- package/moderncssm/components/screens/temp-block/component.d.ts +1 -1
- package/moderncssm/components/screens/temp-block/component.js +2 -2
- package/moderncssm/components/screens/temp-block/component.js.map +1 -1
- package/moderncssm/components/screens/temp-block/index.module.css +2 -2
- package/moderncssm/components/screens/temp-block-over/component.d.ts +1 -1
- package/moderncssm/components/screens/temp-block-over/component.js +2 -2
- package/moderncssm/components/screens/temp-block-over/component.js.map +1 -1
- package/moderncssm/components/screens/temp-block-over/index.module.css +2 -2
- package/moderncssm/context.d.ts +1 -1
- package/moderncssm/context.js +1 -0
- package/moderncssm/context.js.map +1 -1
- package/moderncssm/desktop/component.desktop.d.ts +2 -2
- package/moderncssm/desktop/component.desktop.js.map +1 -1
- package/moderncssm/mobile/component.mobile.d.ts +2 -2
- package/moderncssm/mobile/component.mobile.js.map +1 -1
- package/moderncssm/types.d.ts +13 -8
- package/moderncssm/types.js.map +1 -1
- package/moderncssm/utils.d.ts +1 -1
- package/moderncssm/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/component.responsive.tsx +2 -2
- package/src/components/base-confirmation/component.tsx +5 -6
- package/src/components/base-confirmation/index.module.css +1 -1
- package/src/components/countdown-loader/component.tsx +1 -1
- package/src/components/countdown-loader/index.module.css +1 -1
- package/src/components/header/component.tsx +9 -3
- package/src/components/screens/fatal-error/component.tsx +5 -3
- package/src/components/screens/hint/component.tsx +5 -3
- package/src/components/screens/initial/component.tsx +9 -3
- package/src/components/screens/initial/countdown-section.tsx +1 -1
- package/src/components/screens/temp-block/component.tsx +12 -4
- package/src/components/screens/temp-block-over/component.tsx +5 -3
- package/src/context.ts +2 -1
- package/src/desktop/component.desktop.tsx +2 -2
- package/src/mobile/component.mobile.tsx +2 -2
- package/src/types.ts +14 -7
- package/src/utils.ts +1 -1
- package/src/vars.css +1 -1
- package/types.d.ts +13 -8
- package/types.js.map +1 -1
- package/utils.d.ts +1 -1
- package/utils.js.map +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
:root {
|
|
2
4
|
--confirmation-text-font-size: 16px;
|
|
3
5
|
--confirmation-text-line-height: 24px;
|
|
4
6
|
--confirmation-text-font-weight: 400;
|
|
5
7
|
--confirmation-text-font-family: var(--font-family-system);
|
|
6
8
|
--confirmation-text-color: var(--color-light-text-primary)
|
|
7
|
-
|
|
8
|
-
/* header */
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.component {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
.center {
|
|
47
47
|
align-items: center;
|
|
48
|
-
text-align: center
|
|
48
|
+
text-align: center;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.center .loaderWrap {
|
|
@@ -8,7 +8,7 @@ import { Header } from '../../header/component.js';
|
|
|
8
8
|
import styles from './index.module.css';
|
|
9
9
|
|
|
10
10
|
const TempBlock = ({ mobile }) => {
|
|
11
|
-
const { alignContent, texts, tempBlockDuration, onChangeScreen, onTempBlockFinished } = useContext(ConfirmationContext);
|
|
11
|
+
const { alignContent, titleTag, texts, tempBlockDuration, onChangeScreen, onTempBlockFinished, } = useContext(ConfirmationContext);
|
|
12
12
|
const [timeLeft, startTimer] = useCountdown(tempBlockDuration);
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
startTimer();
|
|
@@ -19,7 +19,7 @@ const TempBlock = ({ mobile }) => {
|
|
|
19
19
|
}
|
|
20
20
|
}, [timeLeft, onChangeScreen, onTempBlockFinished]);
|
|
21
21
|
return (React.createElement("div", { className: cn(styles.component, styles[alignContent]) },
|
|
22
|
-
React.createElement(Header, { mobile: mobile }, texts.tempBlockTitle),
|
|
22
|
+
React.createElement(Header, { mobile: mobile, titleTag: titleTag }, texts.tempBlockTitle),
|
|
23
23
|
React.createElement(Text, { view: 'primary-medium', color: 'primary', className: cn(styles.description, {
|
|
24
24
|
[styles.typographyTheme]: !mobile,
|
|
25
25
|
[styles.typographyThemeMobile]: mobile,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../../src/components/screens/temp-block/component.tsx"],"sourcesContent":["import React, { FC, useContext, useEffect } from 'react';\nimport cn from 'classnames';\n\nimport { Text } from '@alfalab/core-components-typography';\n\nimport { ConfirmationContext } from '../../../context';\nimport { formatMsAsMinutes, useCountdown } from '../../../utils';\nimport { CountdownLoader } from '../../countdown-loader';\nimport { Header } from '../../header';\n\nimport styles from './index.module.css';\n\nexport type TempBlockProps = {\n /**\n * Отображать в мобильной версии экран компонента\n */\n mobile?: boolean;\n};\n\nexport const TempBlock: FC<TempBlockProps> = ({ mobile }) => {\n const {
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../../src/components/screens/temp-block/component.tsx"],"sourcesContent":["import React, { type FC, useContext, useEffect } from 'react';\nimport cn from 'classnames';\n\nimport { Text } from '@alfalab/core-components-typography';\n\nimport { ConfirmationContext } from '../../../context';\nimport { formatMsAsMinutes, useCountdown } from '../../../utils';\nimport { CountdownLoader } from '../../countdown-loader';\nimport { Header } from '../../header';\n\nimport styles from './index.module.css';\n\nexport type TempBlockProps = {\n /**\n * Отображать в мобильной версии экран компонента\n */\n mobile?: boolean;\n};\n\nexport const TempBlock: FC<TempBlockProps> = ({ mobile }) => {\n const {\n alignContent,\n titleTag,\n texts,\n tempBlockDuration,\n onChangeScreen,\n onTempBlockFinished,\n } = useContext(ConfirmationContext);\n\n const [timeLeft, startTimer] = useCountdown(tempBlockDuration);\n\n useEffect(() => {\n startTimer();\n }, [startTimer]);\n\n useEffect(() => {\n if (timeLeft === 0 && onTempBlockFinished) {\n onTempBlockFinished();\n }\n }, [timeLeft, onChangeScreen, onTempBlockFinished]);\n\n return (\n <div className={cn(styles.component, styles[alignContent])}>\n <Header mobile={mobile} titleTag={titleTag}>\n {texts.tempBlockTitle}\n </Header>\n\n <Text\n view='primary-medium'\n color='primary'\n className={cn(styles.description, {\n [styles.typographyTheme]: !mobile,\n [styles.typographyThemeMobile]: mobile,\n })}\n >\n {texts.tempBlockDescription}\n </Text>\n\n <div className={cn(styles.countdownWrap, { [styles.typographyTheme]: !mobile })}>\n <CountdownLoader\n progress={1 - timeLeft / tempBlockDuration}\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AAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,MAAM,EAAE,CAAC,EAAA;AAC3E,YAAA,KAAA,CAAA,aAAA,CAAC,eAAe,EAAA,EACZ,QAAQ,EAAE,CAAC,GAAG,QAAQ,GAAG,iBAAiB,EAC1C,SAAS,EAAE,MAAM,CAAC,MAAM,EAC1B,CAAA;AACF,YAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,MAAM,CAAC,WAAW,EAAG,EAAA,iBAAiB,CAAC,QAAQ,CAAC,CAAQ,CACvE,CACJ;AAEd;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
:root {
|
|
2
4
|
--confirmation-text-font-size: 16px;
|
|
3
5
|
--confirmation-text-line-height: 24px;
|
|
4
6
|
--confirmation-text-font-weight: 400;
|
|
5
7
|
--confirmation-text-font-family: var(--font-family-system);
|
|
6
8
|
--confirmation-text-color: var(--color-light-text-primary)
|
|
7
|
-
|
|
8
|
-
/* header */
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.component {
|
|
@@ -7,13 +7,13 @@ import { Header } from '../../header/component.js';
|
|
|
7
7
|
import styles from './index.module.css';
|
|
8
8
|
|
|
9
9
|
const TempBlockOver = ({ mobile }) => {
|
|
10
|
-
const { alignContent, texts, breakpoint, client, onChangeScreen, onChangeState } = useContext(ConfirmationContext);
|
|
10
|
+
const { alignContent, titleTag, texts, breakpoint, client, onChangeScreen, onChangeState } = useContext(ConfirmationContext);
|
|
11
11
|
const handleReturnButtonClick = () => {
|
|
12
12
|
onChangeScreen('INITIAL');
|
|
13
13
|
onChangeState('INITIAL');
|
|
14
14
|
};
|
|
15
15
|
return (React.createElement("div", { className: cn(styles.component, styles[alignContent]) },
|
|
16
|
-
React.createElement(Header, { mobile: mobile }, texts.tempBlockOverTitle),
|
|
16
|
+
React.createElement(Header, { mobile: mobile, titleTag: titleTag }, texts.tempBlockOverTitle),
|
|
17
17
|
React.createElement(Text, { view: 'primary-medium', color: 'primary', className: cn(styles.description, {
|
|
18
18
|
[styles.typographyTheme]: !mobile,
|
|
19
19
|
[styles.typographyThemeMobile]: mobile,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../../src/components/screens/temp-block-over/component.tsx"],"sourcesContent":["import React, { FC, useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Button } from '@alfalab/core-components-button';\nimport { Text } from '@alfalab/core-components-typography';\n\nimport { ConfirmationContext } from '../../../context';\nimport { Header } from '../../header';\n\nimport styles from './index.module.css';\n\nexport type TempBlockOverProps = {\n /**\n * Отображать в мобильной версии экран компонента\n */\n mobile?: boolean;\n};\n\nexport const TempBlockOver: FC<TempBlockOverProps> = ({ mobile }) => {\n const { alignContent, texts, breakpoint, client, onChangeScreen, onChangeState } =\n useContext(ConfirmationContext);\n\n const handleReturnButtonClick = () => {\n onChangeScreen('INITIAL');\n onChangeState('INITIAL');\n };\n\n return (\n <div className={cn(styles.component, styles[alignContent])}>\n <Header mobile={mobile}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../../src/components/screens/temp-block-over/component.tsx"],"sourcesContent":["import React, { type FC, useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Button } from '@alfalab/core-components-button';\nimport { Text } from '@alfalab/core-components-typography';\n\nimport { ConfirmationContext } from '../../../context';\nimport { Header } from '../../header';\n\nimport styles from './index.module.css';\n\nexport type TempBlockOverProps = {\n /**\n * Отображать в мобильной версии экран компонента\n */\n mobile?: boolean;\n};\n\nexport const TempBlockOver: FC<TempBlockOverProps> = ({ mobile }) => {\n const { alignContent, titleTag, texts, breakpoint, client, onChangeScreen, onChangeState } =\n useContext(ConfirmationContext);\n\n const handleReturnButtonClick = () => {\n onChangeScreen('INITIAL');\n onChangeState('INITIAL');\n };\n\n return (\n <div className={cn(styles.component, styles[alignContent])}>\n <Header mobile={mobile} titleTag={titleTag}>\n {texts.tempBlockOverTitle}\n </Header>\n\n <Text\n view='primary-medium'\n color='primary'\n className={cn(styles.description, {\n [styles.typographyTheme]: !mobile,\n [styles.typographyThemeMobile]: mobile,\n })}\n >\n {texts.tempBlockOverDescription}\n </Text>\n\n <Button\n size={mobile ? 'xs' : 's'}\n view='secondary'\n onClick={handleReturnButtonClick}\n className={styles.button}\n breakpoint={breakpoint}\n client={client}\n >\n {texts.tempBlockOverButton}\n </Button>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;MAkBa,aAAa,GAA2B,CAAC,EAAE,MAAM,EAAE,KAAI;IAChE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,GACtF,UAAU,CAAC,mBAAmB,CAAC;IAEnC,MAAM,uBAAuB,GAAG,MAAK;QACjC,cAAc,CAAC,SAAS,CAAC;QACzB,aAAa,CAAC,SAAS,CAAC;AAC5B,KAAC;AAED,IAAA,QACI,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,EAAA;AACtD,QAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAA,EACrC,KAAK,CAAC,kBAAkB,CACpB;AAET,QAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EACD,EAAA,IAAI,EAAC,gBAAgB,EACrB,KAAK,EAAC,SAAS,EACf,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE;AAC9B,gBAAA,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,MAAM;AACjC,gBAAA,CAAC,MAAM,CAAC,qBAAqB,GAAG,MAAM;AACzC,aAAA,CAAC,EAED,EAAA,KAAK,CAAC,wBAAwB,CAC5B;AAEP,QAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EACH,EAAA,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,GAAG,EACzB,IAAI,EAAC,WAAW,EAChB,OAAO,EAAE,uBAAuB,EAChC,SAAS,EAAE,MAAM,CAAC,MAAM,EACxB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,IAEb,KAAK,CAAC,mBAAmB,CACrB,CACP;AAEd;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
:root {
|
|
2
4
|
--confirmation-text-font-size: 16px;
|
|
3
5
|
--confirmation-text-line-height: 24px;
|
|
4
6
|
--confirmation-text-font-weight: 400;
|
|
5
7
|
--confirmation-text-font-family: var(--font-family-system);
|
|
6
8
|
--confirmation-text-color: var(--color-light-text-primary)
|
|
7
|
-
|
|
8
|
-
/* header */
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.component {
|
package/moderncssm/context.d.ts
CHANGED
package/moderncssm/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../src/context.ts"],"sourcesContent":["import { createContext } from 'react';\n\nimport { TConfirmationContext } from './types';\nimport { ONE_DAY, ONE_MINUTE } from './utils';\n\nconst mockFn = () => undefined;\n\nexport const ConfirmationContext = createContext<TConfirmationContext>({\n alignContent: 'left',\n texts: {},\n state: 'INITIAL',\n screen: 'INITIAL',\n requiredCharAmount: 5,\n countdownDuration: ONE_MINUTE,\n timeLeft: ONE_MINUTE,\n tempBlockDuration: ONE_DAY,\n phone: '',\n hideCountdownSection: false,\n breakpoint: 1024,\n client: 'desktop',\n initialScreenHintSlot: null,\n onTempBlockFinished: mockFn,\n onInputFinished: mockFn,\n onChangeState: mockFn,\n onSmsRetryClick: mockFn,\n onChangeScreen: mockFn,\n onFatalErrorOkButtonClick: mockFn,\n});\n"],"names":[],"mappings":";;;AAKA,MAAM,MAAM,GAAG,MAAM,SAAS;AAEvB,MAAM,mBAAmB,GAAG,aAAa,CAAuB;AACnE,IAAA,YAAY,EAAE,MAAM;AACpB,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,kBAAkB,EAAE,CAAC;AACrB,IAAA,iBAAiB,EAAE,UAAU;AAC7B,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,iBAAiB,EAAE,OAAO;AAC1B,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,oBAAoB,EAAE,KAAK;AAC3B,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,qBAAqB,EAAE,IAAI;AAC3B,IAAA,mBAAmB,EAAE,MAAM;AAC3B,IAAA,eAAe,EAAE,MAAM;AACvB,IAAA,aAAa,EAAE,MAAM;AACrB,IAAA,eAAe,EAAE,MAAM;AACvB,IAAA,cAAc,EAAE,MAAM;AACtB,IAAA,yBAAyB,EAAE,MAAM;AACpC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../src/context.ts"],"sourcesContent":["import { createContext } from 'react';\n\nimport { type TConfirmationContext } from './types';\nimport { ONE_DAY, ONE_MINUTE } from './utils';\n\nconst mockFn = () => undefined;\n\nexport const ConfirmationContext = createContext<TConfirmationContext>({\n alignContent: 'left',\n titleTag: 'h3',\n texts: {},\n state: 'INITIAL',\n screen: 'INITIAL',\n requiredCharAmount: 5,\n countdownDuration: ONE_MINUTE,\n timeLeft: ONE_MINUTE,\n tempBlockDuration: ONE_DAY,\n phone: '',\n hideCountdownSection: false,\n breakpoint: 1024,\n client: 'desktop',\n initialScreenHintSlot: null,\n onTempBlockFinished: mockFn,\n onInputFinished: mockFn,\n onChangeState: mockFn,\n onSmsRetryClick: mockFn,\n onChangeScreen: mockFn,\n onFatalErrorOkButtonClick: mockFn,\n});\n"],"names":[],"mappings":";;;AAKA,MAAM,MAAM,GAAG,MAAM,SAAS;AAEvB,MAAM,mBAAmB,GAAG,aAAa,CAAuB;AACnE,IAAA,YAAY,EAAE,MAAM;AACpB,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,kBAAkB,EAAE,CAAC;AACrB,IAAA,iBAAiB,EAAE,UAAU;AAC7B,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,iBAAiB,EAAE,OAAO;AAC1B,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,oBAAoB,EAAE,KAAK;AAC3B,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,qBAAqB,EAAE,IAAI;AAC3B,IAAA,mBAAmB,EAAE,MAAM;AAC3B,IAAA,eAAe,EAAE,MAAM;AACvB,IAAA,aAAa,EAAE,MAAM;AACrB,IAAA,eAAe,EAAE,MAAM;AACvB,IAAA,cAAc,EAAE,MAAM;AACtB,IAAA,yBAAyB,EAAE,MAAM;AACpC,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { ConfirmationProps } from '../types';
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import { type ConfirmationProps } from '../types';
|
|
3
3
|
export declare type DesktopConfirmationProps = Omit<ConfirmationProps, 'mobile' | 'breakpoint'>;
|
|
4
4
|
export declare const ConfirmationDesktop: FC<DesktopConfirmationProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.desktop.js","sources":["../../src/desktop/component.desktop.tsx"],"sourcesContent":["import React, { FC } from 'react';\n\nimport { BaseConfirmation } from '../components/base-confirmation';\nimport { ConfirmationProps } from '../types';\n\nexport type DesktopConfirmationProps = Omit<ConfirmationProps, 'mobile' | 'breakpoint'>;\n\nexport const ConfirmationDesktop: FC<DesktopConfirmationProps> = (props) => (\n <BaseConfirmation {...props} />\n);\n"],"names":[],"mappings":";;;AAOa,MAAA,mBAAmB,GAAiC,CAAC,KAAK,MACnE,oBAAC,gBAAgB,EAAA,EAAA,GAAK,KAAK,EAAA,CAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"component.desktop.js","sources":["../../src/desktop/component.desktop.tsx"],"sourcesContent":["import React, { type FC } from 'react';\n\nimport { BaseConfirmation } from '../components/base-confirmation';\nimport { type ConfirmationProps } from '../types';\n\nexport type DesktopConfirmationProps = Omit<ConfirmationProps, 'mobile' | 'breakpoint'>;\n\nexport const ConfirmationDesktop: FC<DesktopConfirmationProps> = (props) => (\n <BaseConfirmation {...props} />\n);\n"],"names":[],"mappings":";;;AAOa,MAAA,mBAAmB,GAAiC,CAAC,KAAK,MACnE,oBAAC,gBAAgB,EAAA,EAAA,GAAK,KAAK,EAAA,CAAI;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { ConfirmationProps } from '../types';
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import { type ConfirmationProps } from '../types';
|
|
3
3
|
export declare type MobileConfirmationProps = Omit<ConfirmationProps, 'mobile'>;
|
|
4
4
|
export declare const ConfirmationMobile: FC<MobileConfirmationProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.mobile.js","sources":["../../src/mobile/component.mobile.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport cn from 'classnames';\n\nimport { BaseConfirmation } from '../components/base-confirmation';\nimport { ConfirmationProps } from '../types';\n\nimport styles from './mobile.module.css';\n\nexport type MobileConfirmationProps = Omit<ConfirmationProps, 'mobile'>;\n\nexport const ConfirmationMobile: FC<MobileConfirmationProps> = ({ className, ...resProps }) => (\n <BaseConfirmation mobile={true} className={cn(className, styles.container)} {...resProps} />\n);\n"],"names":[],"mappings":";;;;;AAUa,MAAA,kBAAkB,GAAgC,CAAC,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,MACtF,oBAAC,gBAAgB,EAAA,EAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,EAAA,GAAM,QAAQ,EAAA,CAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"component.mobile.js","sources":["../../src/mobile/component.mobile.tsx"],"sourcesContent":["import React, { type FC } from 'react';\nimport cn from 'classnames';\n\nimport { BaseConfirmation } from '../components/base-confirmation';\nimport { type ConfirmationProps } from '../types';\n\nimport styles from './mobile.module.css';\n\nexport type MobileConfirmationProps = Omit<ConfirmationProps, 'mobile'>;\n\nexport const ConfirmationMobile: FC<MobileConfirmationProps> = ({ className, ...resProps }) => (\n <BaseConfirmation mobile={true} className={cn(className, styles.container)} {...resProps} />\n);\n"],"names":[],"mappings":";;;;;AAUa,MAAA,kBAAkB,GAAgC,CAAC,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,MACtF,oBAAC,gBAAgB,EAAA,EAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,EAAA,GAAM,QAAQ,EAAA,CAAI;;;;"}
|
package/moderncssm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentType, ReactNode } from 'react';
|
|
2
|
-
export
|
|
1
|
+
import { type ComponentType, type ReactNode } from 'react';
|
|
2
|
+
export interface ConfirmationProps {
|
|
3
3
|
/**
|
|
4
4
|
* Экран компонента
|
|
5
5
|
*/
|
|
@@ -16,6 +16,11 @@ export declare type ConfirmationProps = {
|
|
|
16
16
|
* Позиционирование контента
|
|
17
17
|
*/
|
|
18
18
|
alignContent?: 'left' | 'center';
|
|
19
|
+
/**
|
|
20
|
+
* HTML тег для заголовка
|
|
21
|
+
* @default 'h3'
|
|
22
|
+
*/
|
|
23
|
+
titleTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
19
24
|
/**
|
|
20
25
|
* Объект с текстами
|
|
21
26
|
*/
|
|
@@ -107,11 +112,11 @@ export declare type ConfirmationProps = {
|
|
|
107
112
|
* @default 1300
|
|
108
113
|
*/
|
|
109
114
|
errorVisibleDuration?: number;
|
|
110
|
-
}
|
|
111
|
-
export declare 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' | 'errorVisibleDuration' | 'breakpoint' | 'client'> & {
|
|
115
|
+
}
|
|
116
|
+
export declare type TConfirmationContext = Required<Pick<ConfirmationProps, 'alignContent' | 'titleTag' | 'texts' | 'state' | 'screen' | 'requiredCharAmount' | 'onInputFinished' | 'countdownDuration' | 'onChangeState' | 'onSmsRetryClick' | 'onChangeScreen' | 'onFatalErrorOkButtonClick' | 'tempBlockDuration' | 'hideCountdownSection'>> & Pick<ConfirmationProps, 'phone' | 'blockSmsRetry' | 'onTempBlockFinished' | 'clearCodeOnError' | 'initialScreenHintSlot' | 'errorVisibleDuration' | 'breakpoint' | 'client'> & {
|
|
112
117
|
timeLeft: number;
|
|
113
118
|
};
|
|
114
|
-
export
|
|
119
|
+
export interface ConfirmationTexts {
|
|
115
120
|
/**
|
|
116
121
|
* Экран INITIAL
|
|
117
122
|
*/
|
|
@@ -152,10 +157,10 @@ export declare type ConfirmationTexts = {
|
|
|
152
157
|
tempBlockOverTitle?: ReactNode;
|
|
153
158
|
tempBlockOverDescription?: ReactNode;
|
|
154
159
|
tempBlockOverButton?: string;
|
|
155
|
-
}
|
|
160
|
+
}
|
|
156
161
|
export declare type ConfirmationScreen = 'INITIAL' | 'HINT' | 'FATAL_ERROR' | 'TEMP_BLOCK' | 'TEMP_BLOCK_OVER';
|
|
157
162
|
export declare type ConfirmationState = 'INITIAL' | 'CODE_CHECKING' | 'CODE_SENDING' | 'CODE_ERROR' | 'CODE_EXPIRED' | 'CODE_EXPIRED_ENDED';
|
|
158
|
-
export
|
|
163
|
+
export interface ScreensMap {
|
|
159
164
|
[key: string]: ComponentType;
|
|
160
|
-
}
|
|
165
|
+
}
|
|
161
166
|
export declare const defaultTexts: ConfirmationTexts;
|
package/moderncssm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import { ComponentType, ReactNode } from 'react';\n\nexport
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import { type ComponentType, type ReactNode } from 'react';\n\nexport interface ConfirmationProps {\n /**\n * Экран компонента\n */\n screen: ConfirmationScreen | string;\n\n /**\n * Состояние компонента\n */\n state: ConfirmationState | string;\n\n /**\n * Мобильная версия компонента для экрана\n */\n mobile?: boolean;\n\n /**\n * Позиционирование контента\n */\n alignContent?: 'left' | 'center';\n\n /**\n * HTML тег для заголовка\n * @default 'h3'\n */\n titleTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\n /**\n * Объект с текстами\n */\n texts?: ConfirmationTexts;\n\n /**\n * Количество символов, которое можно ввести в поле ввода подписания до того, как произойдет автоотправка\n */\n requiredCharAmount?: number;\n\n /**\n * Длительность обратного отсчета на кнопке повторного запроса сообщения, в милисекундах\n */\n countdownDuration?: number;\n\n /**\n * Продолжительность блокировки формы (ms)\n */\n tempBlockDuration?: number;\n\n /**\n * Номер телефона, на который отправлен код\n */\n phone?: string;\n\n /**\n * Не осталось попыток ввода кода\n */\n blockSmsRetry?: boolean;\n\n /**\n * Идентификатор для систем автоматизированного тестирования\n */\n dataTestId?: string;\n\n /**\n * Сss класс для стилизации общей обёртки\n */\n className?: string;\n\n /**\n * Флаг - нужно ли очищать код при возникновении ошибки\n */\n clearCodeOnError?: boolean;\n\n /**\n * Функция обновления состояния компонента\n */\n onChangeState: (state: ConfirmationState | string) => void;\n\n /**\n * Функция обновления состояния компонента\n */\n onChangeScreen: (state: ConfirmationScreen | string) => void;\n\n /**\n * Обработчик события завершения ввода кода подписания\n */\n onInputFinished: (code: string) => void;\n\n /**\n * Обработчик события нажатия на кнопку \"Запросить код\"\n */\n onSmsRetryClick: () => void;\n\n /**\n * Клик по кнопке \"Понятно\" на экране фатальной ошибки\n */\n onFatalErrorOkButtonClick?: () => void;\n\n /**\n * Временная блокировка формы закончилась\n */\n onTempBlockFinished?: () => void;\n\n /**\n * Возвращает объект, где ключ - название экрана (screen), значение - компонент для экрана\n */\n getScreensMap?: (defaultScreensMap: ScreensMap) => ScreensMap;\n\n /**\n * Дочерние элементы\n */\n children?: ReactNode;\n\n /**\n * Скрыть секцию с повторной отправкой кода\n * @default false\n */\n hideCountdownSection?: boolean;\n\n /**\n * Слот для контента с подсказкой на главном экране\n */\n initialScreenHintSlot?: ReactNode;\n\n /**\n * Контрольная точка для кнопки, с нее начинается desktop версия\n * @default 1024\n */\n breakpoint?: number;\n\n /**\n * Версия, которая будет использоваться при серверном рендеринге\n */\n client?: 'desktop' | 'mobile';\n\n /**\n * Продолжительность отображения ошибки\n * @default 1300\n */\n errorVisibleDuration?: number;\n}\n\nexport type TConfirmationContext = Required<\n Pick<\n ConfirmationProps,\n | 'alignContent'\n | 'titleTag'\n | 'texts'\n | 'state'\n | 'screen'\n | 'requiredCharAmount'\n | 'onInputFinished'\n | 'countdownDuration'\n | 'onChangeState'\n | 'onSmsRetryClick'\n | 'onChangeScreen'\n | 'onFatalErrorOkButtonClick'\n | 'tempBlockDuration'\n | 'hideCountdownSection'\n >\n> &\n Pick<\n ConfirmationProps,\n | 'phone'\n | 'blockSmsRetry'\n | 'onTempBlockFinished'\n | 'clearCodeOnError'\n | 'initialScreenHintSlot'\n | 'errorVisibleDuration'\n | 'breakpoint'\n | 'client'\n > & {\n timeLeft: number;\n };\n\nexport interface ConfirmationTexts {\n /**\n * Экран INITIAL\n */\n title?: ReactNode; // заголовок\n codeError?: string; // ошибка проверки кода\n codeErrorExpired?: string; // код устарел, запросите новый\n codeErrorExpiredEnded?: string; // код устарел\n codeChecking?: string; // код проверяется\n codeSending?: string; // код отправляется\n codeSended?: string; // код отправлен\n buttonRetry?: string; // кнопка повторной отправки кода\n linkToHint?: string; // ссылка на экран HINT\n noAttemptsLeft?: string; // не осталось попыток запроса кода\n countdown?: string; // 'запросить повторно можно через'\n\n /**\n * Экран HINT\n */\n hintTitle?: string; // заголовок\n hintDescription?: string; // описание\n hintNotification?: string; // уведомление\n hintButton?: string; // кнопка 'Вернуться'\n domesticPhone?: string; // номер телефона для звонков по России\n internationalPhone?: string; // номер телефона для звонков из-за границы\n\n /**\n * Экран FATAL_ERROR\n */\n fatalErrorTitle?: ReactNode; // заголовок\n fatalErrorDescription?: ReactNode; // описание\n fatalErrorButton?: string; // кнопка\n\n /**\n * Экран TEMP_BLOCK\n */\n tempBlockTitle?: ReactNode; // заголовок\n tempBlockDescription?: ReactNode; // описание\n\n /**\n * Экран TEMP_BLOCK_OVER\n */\n tempBlockOverTitle?: ReactNode; // заголовок\n tempBlockOverDescription?: ReactNode; // описание\n tempBlockOverButton?: string; // кнопка\n}\n\nexport type ConfirmationScreen =\n | 'INITIAL' // начальный экран\n | 'HINT' // экран \"Не приходит смс?\"\n | 'FATAL_ERROR' // экран критической ошибки\n | 'TEMP_BLOCK' // экран временной блокировки\n | 'TEMP_BLOCK_OVER'; // экран todo\n\nexport type ConfirmationState =\n | 'INITIAL' // начальное состояние\n | 'CODE_CHECKING' // проверка кода\n | 'CODE_SENDING' // повторная отправка кода\n | 'CODE_ERROR' // ошибка, когда ввели неверный код\n | 'CODE_EXPIRED' // ошибка, когда код устарел, но можно запросить новый\n | 'CODE_EXPIRED_ENDED'; // ошибка, когда код устарел\n\nexport interface ScreensMap {\n [key: string]: ComponentType;\n}\n\nexport const defaultTexts: ConfirmationTexts = {\n title: 'Введите код из\\xa0уведомления',\n codeError: 'Код не подходит, проверьте его',\n codeErrorExpired: 'Код устарел, запросите новый',\n codeErrorExpiredEnded: 'Код устарел',\n codeChecking: '',\n codeSending: '',\n buttonRetry: 'Запросить код',\n hintTitle: 'Не\\xa0приходит код?',\n hintDescription: 'Если\\xa0сменили номер, позвоните нам или обратитесь в\\xa0любой офис банка.',\n hintNotification:\n 'Если номер не\\xa0меняли, попробуйте запросить код позже — возможно, перегружен сервис отправки уведомлений.',\n linkToHint: 'Не\\xa0приходит код?',\n hintButton: 'Вернуться к\\xa0вводу кода',\n noAttemptsLeft: 'Не\\xa0осталось попыток запроса кода',\n fatalErrorTitle: 'Ввести код больше нельзя',\n fatalErrorDescription:\n 'Мы ограничили следующие попытки ввода, потому\\xa0что код был введён неверно больше 5 раз.',\n fatalErrorButton: 'Понятно',\n tempBlockTitle: 'Ввести код пока нельзя',\n tempBlockDescription: 'Слишком много неверных попыток. Запросите новый позже',\n tempBlockOverTitle: 'Ввод разблокирован',\n tempBlockOverDescription: 'Теперь можно запросить новый код',\n tempBlockOverButton: 'Запросить новый код',\n codeSended: 'Код отправлен',\n countdown: 'Запросить новый можно через',\n domesticPhone: '8 800 200 00 00',\n internationalPhone: '+7 495 78 888 78',\n};\n"],"names":[],"mappings":"AAkPa,MAAA,YAAY,GAAsB;AAC3C,IAAA,KAAK,EAAE,+BAA+B;AACtC,IAAA,SAAS,EAAE,gCAAgC;AAC3C,IAAA,gBAAgB,EAAE,8BAA8B;AAChD,IAAA,qBAAqB,EAAE,aAAa;AACpC,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,WAAW,EAAE,EAAE;AACf,IAAA,WAAW,EAAE,eAAe;AAC5B,IAAA,SAAS,EAAE,qBAAqB;AAChC,IAAA,eAAe,EAAE,4EAA4E;AAC7F,IAAA,gBAAgB,EACZ,6GAA6G;AACjH,IAAA,UAAU,EAAE,qBAAqB;AACjC,IAAA,UAAU,EAAE,2BAA2B;AACvC,IAAA,cAAc,EAAE,qCAAqC;AACrD,IAAA,eAAe,EAAE,0BAA0B;AAC3C,IAAA,qBAAqB,EACjB,2FAA2F;AAC/F,IAAA,gBAAgB,EAAE,SAAS;AAC3B,IAAA,cAAc,EAAE,wBAAwB;AACxC,IAAA,oBAAoB,EAAE,uDAAuD;AAC7E,IAAA,kBAAkB,EAAE,oBAAoB;AACxC,IAAA,wBAAwB,EAAE,kCAAkC;AAC5D,IAAA,mBAAmB,EAAE,qBAAqB;AAC1C,IAAA,UAAU,EAAE,eAAe;AAC3B,IAAA,SAAS,EAAE,6BAA6B;AACxC,IAAA,aAAa,EAAE,iBAAiB;AAChC,IAAA,kBAAkB,EAAE,kBAAkB;;;;;"}
|
package/moderncssm/utils.d.ts
CHANGED
package/moderncssm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { ConfirmationProps } from './types';\n\n/**\n * Форматирование миллисекунд в hh:mm:ss.\n *\n * @param {Number} ms миллисекунды\n * @returns {String} время в формате mm:ss\n */\nexport function formatMsAsMinutes(ms: number) {\n const totalSeconds = Math.ceil(ms / 1000);\n const totalMinutes = Math.floor(totalSeconds / 60);\n const totalHours = Math.floor(totalMinutes / 60);\n\n const seconds = totalSeconds % 60;\n const paddedSeconds = `00${seconds}`.slice(-2);\n\n if (totalHours > 0) {\n const minutes = totalMinutes % 60;\n\n const paddedMinutes = `00${minutes}`.slice(-2);\n const paddedHours = `00${totalHours}`.slice(-2);\n\n return `${paddedHours}:${paddedMinutes}:${paddedSeconds}`;\n }\n\n const paddedMinutes = `00${totalMinutes}`.slice(-2);\n\n return `${paddedMinutes}:${paddedSeconds}`;\n}\n\ntype UseCountdown = (countdownDuration: number, tick?: number) => [number, () => void, () => void];\n\n/**\n * Возвращает время, которое осталось до истечения таймера в ms\n */\nexport const useCountdown: UseCountdown = (countdownDuration, tick = 1000) => {\n const timerId = useRef(0);\n\n const start = useRef(0);\n\n const [timePassed, setTimePassed] = useState(0);\n\n const stopTimer = useCallback(() => {\n window.clearInterval(timerId.current);\n }, []);\n\n const updateProgress = useCallback(() => {\n const passed = Date.now() - start.current;\n\n if (passed >= countdownDuration) {\n stopTimer();\n\n setTimePassed(countdownDuration);\n } else {\n setTimePassed(passed);\n }\n }, [countdownDuration, stopTimer]);\n\n const startTimer = useCallback(() => {\n stopTimer();\n\n start.current = Date.now();\n\n updateProgress();\n\n timerId.current = window.setInterval(updateProgress, tick);\n }, [stopTimer, updateProgress, tick]);\n\n const timeLeft = countdownDuration - timePassed;\n\n useEffect(\n () => () => {\n stopTimer();\n },\n [stopTimer],\n );\n\n return [timeLeft, startTimer, stopTimer];\n};\n\nexport const ONE_DAY = 24 * 60 * 60 * 1000;\nexport const ONE_MINUTE = 60 * 1000;\n\ntype UseConfirmationParams = {\n state?: ConfirmationProps['state'];\n screen?: ConfirmationProps['screen'];\n blockSmsRetry?: ConfirmationProps['blockSmsRetry'];\n};\n\nexport const useConfirmation = ({ state, screen, blockSmsRetry }: UseConfirmationParams = {}) => {\n const [confirmationState, setConfirmationState] = useState(state ?? 'INITIAL');\n const [confirmationScreen, setConfirmationScreen] = useState(screen ?? 'INITIAL');\n const [confirmationBlockSmsRetry, setConfirmationBlockSmsRetry] = useState(\n blockSmsRetry ?? false,\n );\n\n return {\n confirmationState,\n confirmationScreen,\n confirmationBlockSmsRetry,\n setConfirmationState,\n setConfirmationScreen,\n setConfirmationBlockSmsRetry,\n };\n};\n\nconst NON_NUMBER_OR_PLUS_REGEXP = new RegExp(/[^\\d+]/g);\n\n/**\n * @returns ссылку для набора номера\n */\nexport function getPhoneHref(phone: string): string {\n return `tel:${phone.replace(NON_NUMBER_OR_PLUS_REGEXP, '')}`;\n}\n"],"names":[],"mappings":";;AAIA;;;;;AAKG;AACG,SAAU,iBAA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EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC;AACjF,IAAA,MAAM,CAAC,yBAAyB,EAAE,4BAA4B,CAAC,GAAG,QAAQ,CACtE,aAAa,IAAI,KAAK,CACzB;IAED,OAAO;QACH,iBAAiB;QACjB,kBAAkB;QAClB,yBAAyB;QACzB,oBAAoB;QACpB,qBAAqB;QACrB,4BAA4B;KAC/B;AACL;AAEA,MAAM,yBAAyB,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC;AAEvD;;AAEG;AACG,SAAU,YAAY,CAAC,KAAa,EAAA;IACtC,OAAO,CAAA,IAAA,EAAO,KAAK,CAAC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAA,CAAE;AAChE;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { type ConfirmationProps } from './types';\n\n/**\n * Форматирование миллисекунд в hh:mm:ss.\n *\n * @param {Number} ms миллисекунды\n * @returns {String} время в формате mm:ss\n */\nexport function formatMsAsMinutes(ms: number) {\n const totalSeconds = Math.ceil(ms / 1000);\n const totalMinutes = Math.floor(totalSeconds / 60);\n const totalHours = Math.floor(totalMinutes / 60);\n\n const seconds = totalSeconds % 60;\n const paddedSeconds = `00${seconds}`.slice(-2);\n\n if (totalHours > 0) {\n const minutes = totalMinutes % 60;\n\n const paddedMinutes = `00${minutes}`.slice(-2);\n const paddedHours = `00${totalHours}`.slice(-2);\n\n return `${paddedHours}:${paddedMinutes}:${paddedSeconds}`;\n }\n\n const paddedMinutes = `00${totalMinutes}`.slice(-2);\n\n return `${paddedMinutes}:${paddedSeconds}`;\n}\n\ntype UseCountdown = (countdownDuration: number, tick?: number) => [number, () => void, () => void];\n\n/**\n * Возвращает время, которое осталось до истечения таймера в ms\n */\nexport const useCountdown: UseCountdown = (countdownDuration, tick = 1000) => {\n const timerId = useRef(0);\n\n const start = useRef(0);\n\n const [timePassed, setTimePassed] = useState(0);\n\n const stopTimer = useCallback(() => {\n window.clearInterval(timerId.current);\n }, []);\n\n const updateProgress = useCallback(() => {\n const passed = Date.now() - start.current;\n\n if (passed >= countdownDuration) {\n stopTimer();\n\n setTimePassed(countdownDuration);\n } else {\n setTimePassed(passed);\n }\n }, [countdownDuration, stopTimer]);\n\n const startTimer = useCallback(() => {\n stopTimer();\n\n start.current = Date.now();\n\n updateProgress();\n\n timerId.current = window.setInterval(updateProgress, tick);\n }, [stopTimer, updateProgress, tick]);\n\n const timeLeft = countdownDuration - timePassed;\n\n useEffect(\n () => () => {\n stopTimer();\n },\n [stopTimer],\n );\n\n return [timeLeft, startTimer, stopTimer];\n};\n\nexport const ONE_DAY = 24 * 60 * 60 * 1000;\nexport const ONE_MINUTE = 60 * 1000;\n\ntype UseConfirmationParams = {\n state?: ConfirmationProps['state'];\n screen?: ConfirmationProps['screen'];\n blockSmsRetry?: ConfirmationProps['blockSmsRetry'];\n};\n\nexport const useConfirmation = ({ state, screen, blockSmsRetry }: UseConfirmationParams = {}) => {\n const [confirmationState, setConfirmationState] = useState(state ?? 'INITIAL');\n const [confirmationScreen, setConfirmationScreen] = useState(screen ?? 'INITIAL');\n const [confirmationBlockSmsRetry, setConfirmationBlockSmsRetry] = useState(\n blockSmsRetry ?? false,\n );\n\n return {\n confirmationState,\n confirmationScreen,\n confirmationBlockSmsRetry,\n setConfirmationState,\n setConfirmationScreen,\n setConfirmationBlockSmsRetry,\n };\n};\n\nconst NON_NUMBER_OR_PLUS_REGEXP = new RegExp(/[^\\d+]/g);\n\n/**\n * @returns ссылку для набора номера\n */\nexport function getPhoneHref(phone: string): string {\n return `tel:${phone.replace(NON_NUMBER_OR_PLUS_REGEXP, '')}`;\n}\n"],"names":[],"mappings":";;AAIA;;;;;AAKG;AACG,SAAU,iBAAiB,CAAC,EAAU,EAAA;IACxC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAA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AyB,EAAE,4BAA4B,CAAC,GAAG,QAAQ,CACtE,aAAa,IAAI,KAAK,CACzB;IAED,OAAO;QACH,iBAAiB;QACjB,kBAAkB;QAClB,yBAAyB;QACzB,oBAAoB;QACpB,qBAAqB;QACrB,4BAA4B;KAC/B;AACL;AAEA,MAAM,yBAAyB,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC;AAEvD;;AAEG;AACG,SAAU,YAAY,CAAC,KAAa,EAAA;IACtC,OAAO,CAAA,IAAA,EAAO,KAAK,CAAC,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAA,CAAE;AAChE;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-confirmation",
|
|
3
|
-
"version": "14.0
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"description": "Sms confirmation component",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@alfalab/core-components-link": "^6.0.0",
|
|
16
16
|
"@alfalab/core-components-mq": "^5.0.1",
|
|
17
17
|
"@alfalab/core-components-spinner": "^5.0.1",
|
|
18
|
-
"@alfalab/core-components-typography": "^5.0.
|
|
18
|
+
"@alfalab/core-components-typography": "^5.0.2",
|
|
19
19
|
"@alfalab/hooks": "^1.13.1",
|
|
20
20
|
"classnames": "^2.5.1",
|
|
21
21
|
"tslib": "^2.4.0"
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"access": "public",
|
|
29
29
|
"directory": "dist"
|
|
30
30
|
},
|
|
31
|
-
"themesVersion": "14.1.
|
|
31
|
+
"themesVersion": "14.1.2",
|
|
32
32
|
"varsVersion": "10.1.0"
|
|
33
33
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { type FC } from 'react';
|
|
2
2
|
|
|
3
3
|
import { useIsDesktop } from '@alfalab/core-components-mq';
|
|
4
4
|
|
|
5
5
|
import { ConfirmationDesktop } from './desktop';
|
|
6
6
|
import { ConfirmationMobile } from './mobile';
|
|
7
|
-
import { ConfirmationProps } from './types';
|
|
7
|
+
import { type ConfirmationProps } from './types';
|
|
8
8
|
|
|
9
9
|
export type ResponsiveConfirmationProps = Omit<
|
|
10
10
|
ConfirmationProps,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { ComponentType, FC, useEffect, useMemo } from 'react';
|
|
1
|
+
import React, { type ComponentType, type FC, useEffect, useMemo } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { usePrevious } from '@alfalab/hooks';
|
|
5
5
|
|
|
6
6
|
import { ConfirmationContext } from '../../context';
|
|
7
|
-
import { ConfirmationProps, defaultTexts, TConfirmationContext } from '../../types';
|
|
7
|
+
import { type ConfirmationProps, defaultTexts, type TConfirmationContext } from '../../types';
|
|
8
8
|
import { ONE_DAY, ONE_MINUTE, useCountdown } from '../../utils';
|
|
9
9
|
import { FatalError, Hint, Initial, TempBlock, TempBlockOver } from '../screens';
|
|
10
10
|
|
|
@@ -21,6 +21,7 @@ const confirmationScreens: { [key: string]: ComponentType<{ mobile?: boolean }>
|
|
|
21
21
|
export const BaseConfirmation: FC<ConfirmationProps> = ({
|
|
22
22
|
state,
|
|
23
23
|
screen,
|
|
24
|
+
titleTag = 'h3',
|
|
24
25
|
alignContent = 'left',
|
|
25
26
|
children,
|
|
26
27
|
requiredCharAmount = 5,
|
|
@@ -97,6 +98,7 @@ export const BaseConfirmation: FC<ConfirmationProps> = ({
|
|
|
97
98
|
const contextValue: TConfirmationContext = {
|
|
98
99
|
hideCountdownSection,
|
|
99
100
|
alignContent,
|
|
101
|
+
titleTag,
|
|
100
102
|
texts: { ...defaultTexts, ...restProps.texts },
|
|
101
103
|
state,
|
|
102
104
|
screen,
|
|
@@ -119,10 +121,7 @@ export const BaseConfirmation: FC<ConfirmationProps> = ({
|
|
|
119
121
|
onFatalErrorOkButtonClick: handleFatalErrorOkButtonClick,
|
|
120
122
|
};
|
|
121
123
|
|
|
122
|
-
const customScreen = useMemo(
|
|
123
|
-
() => getScreensMap && getScreensMap(confirmationScreens),
|
|
124
|
-
[getScreensMap],
|
|
125
|
-
);
|
|
124
|
+
const customScreen = useMemo(() => getScreensMap?.(confirmationScreens), [getScreensMap]);
|
|
126
125
|
|
|
127
126
|
const screensMap = customScreen || confirmationScreens;
|
|
128
127
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC, ReactNode } from 'react';
|
|
1
|
+
import React, { type FC, type ReactNode } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { TitleDesktop } from '@alfalab/core-components-typography';
|
|
@@ -15,12 +15,18 @@ export type HeaderProps = {
|
|
|
15
15
|
* Отображать в мобильной версии экран компонента
|
|
16
16
|
*/
|
|
17
17
|
mobile?: boolean;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* HTML тег для заголовка
|
|
21
|
+
* @default 'h3'
|
|
22
|
+
*/
|
|
23
|
+
titleTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
18
24
|
};
|
|
19
25
|
|
|
20
|
-
export const Header: FC<HeaderProps> = ({ mobile, children }) => (
|
|
26
|
+
export const Header: FC<HeaderProps> = ({ mobile, children, titleTag = 'h3' }) => (
|
|
21
27
|
<TitleDesktop
|
|
22
28
|
className={cn(styles.header, styles.typography, { [styles.typographyMobile]: mobile })}
|
|
23
|
-
tag=
|
|
29
|
+
tag={titleTag}
|
|
24
30
|
color='primary'
|
|
25
31
|
>
|
|
26
32
|
{children}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC, useContext } from 'react';
|
|
1
|
+
import React, { type FC, useContext } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Button } from '@alfalab/core-components-button';
|
|
@@ -17,12 +17,14 @@ export type FatalErrorProps = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export const FatalError: FC<FatalErrorProps> = ({ mobile }) => {
|
|
20
|
-
const { alignContent, texts, onFatalErrorOkButtonClick, breakpoint, client } =
|
|
20
|
+
const { alignContent, titleTag, texts, onFatalErrorOkButtonClick, breakpoint, client } =
|
|
21
21
|
useContext(ConfirmationContext);
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<div className={cn(styles.component, styles[alignContent])}>
|
|
25
|
-
<Header mobile={mobile}
|
|
25
|
+
<Header mobile={mobile} titleTag={titleTag}>
|
|
26
|
+
{texts.fatalErrorTitle}
|
|
27
|
+
</Header>
|
|
26
28
|
|
|
27
29
|
<Text
|
|
28
30
|
view='primary-medium'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC, useContext } from 'react';
|
|
1
|
+
import React, { type FC, useContext } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Button } from '@alfalab/core-components-button';
|
|
@@ -19,7 +19,7 @@ export type HintProps = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const Hint: FC<HintProps> = ({ mobile }) => {
|
|
22
|
-
const { alignContent, texts, onChangeScreen, onChangeState, breakpoint, client } =
|
|
22
|
+
const { alignContent, titleTag, texts, onChangeScreen, onChangeState, breakpoint, client } =
|
|
23
23
|
useContext(ConfirmationContext);
|
|
24
24
|
|
|
25
25
|
const { domesticPhone = '', internationalPhone = '', hintButton } = texts;
|
|
@@ -31,7 +31,9 @@ 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} titleTag={titleTag}>
|
|
35
|
+
{texts.hintTitle}
|
|
36
|
+
</Header>
|
|
35
37
|
|
|
36
38
|
<Text
|
|
37
39
|
view='primary-medium'
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import React, { FC, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { type FC, useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { ButtonMobile } from '@alfalab/core-components-button/mobile';
|
|
5
5
|
import { CodeInputDesktop } from '@alfalab/core-components-code-input/desktop';
|
|
6
6
|
import { CodeInputMobile } from '@alfalab/core-components-code-input/mobile';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
type BaseCodeInputProps,
|
|
9
|
+
type CustomInputRef,
|
|
10
|
+
} from '@alfalab/core-components-code-input/shared';
|
|
8
11
|
import { Link } from '@alfalab/core-components-link';
|
|
9
12
|
import { Text } from '@alfalab/core-components-typography';
|
|
10
13
|
import { useLayoutEffect_SAFE_FOR_SSR, usePrevious } from '@alfalab/hooks';
|
|
@@ -29,6 +32,7 @@ export const Initial: FC<InitialProps> = ({ mobile }) => {
|
|
|
29
32
|
const {
|
|
30
33
|
state,
|
|
31
34
|
alignContent,
|
|
35
|
+
titleTag,
|
|
32
36
|
texts,
|
|
33
37
|
requiredCharAmount,
|
|
34
38
|
timeLeft,
|
|
@@ -169,7 +173,9 @@ export const Initial: FC<InitialProps> = ({ mobile }) => {
|
|
|
169
173
|
|
|
170
174
|
return (
|
|
171
175
|
<div className={cn(styles.component, styles[alignContent])}>
|
|
172
|
-
<Header mobile={mobile}
|
|
176
|
+
<Header mobile={mobile} titleTag={titleTag}>
|
|
177
|
+
{texts.title}
|
|
178
|
+
</Header>
|
|
173
179
|
|
|
174
180
|
{phone ? (
|
|
175
181
|
<Text
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC, useContext, useEffect } from 'react';
|
|
1
|
+
import React, { type FC, useContext, useEffect } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Text } from '@alfalab/core-components-typography';
|
|
@@ -18,8 +18,14 @@ export type TempBlockProps = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const TempBlock: FC<TempBlockProps> = ({ mobile }) => {
|
|
21
|
-
const {
|
|
22
|
-
|
|
21
|
+
const {
|
|
22
|
+
alignContent,
|
|
23
|
+
titleTag,
|
|
24
|
+
texts,
|
|
25
|
+
tempBlockDuration,
|
|
26
|
+
onChangeScreen,
|
|
27
|
+
onTempBlockFinished,
|
|
28
|
+
} = useContext(ConfirmationContext);
|
|
23
29
|
|
|
24
30
|
const [timeLeft, startTimer] = useCountdown(tempBlockDuration);
|
|
25
31
|
|
|
@@ -35,7 +41,9 @@ export const TempBlock: FC<TempBlockProps> = ({ mobile }) => {
|
|
|
35
41
|
|
|
36
42
|
return (
|
|
37
43
|
<div className={cn(styles.component, styles[alignContent])}>
|
|
38
|
-
<Header mobile={mobile}
|
|
44
|
+
<Header mobile={mobile} titleTag={titleTag}>
|
|
45
|
+
{texts.tempBlockTitle}
|
|
46
|
+
</Header>
|
|
39
47
|
|
|
40
48
|
<Text
|
|
41
49
|
view='primary-medium'
|