@redneckz/wildless-cms-uni-blocks 0.14.713 → 0.14.715
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/bundle/bundle.umd.js +47 -36
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
- package/bundle/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
- package/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/bundle/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
- package/bundle/components/CreditForm/useCreditFormAPI.d.ts +1 -1
- package/bundle/hooks/useAsyncEffect.d.ts +1 -0
- package/bundle/services/retail/mockLocalStorage.d.ts +1 -0
- package/bundle/ui-kit/Button/Button.d.ts +1 -0
- package/bundle/ui-kit/Loader/Loader.d.ts +1 -0
- package/dist/api/RetailAPI/sendCode.js +3 -4
- package/dist/api/RetailAPI/sendCode.js.map +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -2
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/dist/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/renderSubmitButton.js +1 -1
- package/dist/components/ApplicationLeadForm/renderSubmitButton.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -7
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/CreditCardForm/CreditCardFormStep.js +2 -2
- package/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
- package/dist/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
- package/dist/components/CreditCardForm/StepsNavigationButtons.js +2 -2
- package/dist/components/CreditCardForm/StepsNavigationButtons.js.map +1 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.js +7 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/dist/components/CreditForm/CreditFormStep.js +2 -2
- package/dist/components/CreditForm/CreditFormStep.js.map +1 -1
- package/dist/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
- package/dist/components/CreditForm/StepsNavigationButtons.js +2 -2
- package/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
- package/dist/components/CreditForm/useCreditFormAPI.d.ts +1 -1
- package/dist/components/CreditForm/useCreditFormAPI.js +7 -1
- package/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/dist/hooks/useAsyncEffect.d.ts +1 -0
- package/dist/hooks/useAsyncEffect.js +15 -0
- package/dist/hooks/useAsyncEffect.js.map +1 -0
- package/dist/services/retail/mockLocalStorage.d.ts +1 -0
- package/dist/services/retail/mockLocalStorage.js +35 -0
- package/dist/services/retail/mockLocalStorage.js.map +1 -0
- package/dist/setup-fixture.js +11 -0
- package/dist/setup-fixture.js.map +1 -1
- package/dist/ui-kit/Button/Button.d.ts +1 -0
- package/dist/ui-kit/Button/Button.js +6 -5
- package/dist/ui-kit/Button/Button.js.map +1 -1
- package/dist/ui-kit/Loader/Loader.d.ts +1 -0
- package/dist/ui-kit/Loader/Loader.js +2 -2
- package/dist/ui-kit/Loader/Loader.js.map +1 -1
- package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +5 -4
- package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/lib/api/RetailAPI/sendCode.js +4 -5
- package/lib/api/RetailAPI/sendCode.js.map +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -2
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/lib/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/renderSubmitButton.js +1 -1
- package/lib/components/ApplicationLeadForm/renderSubmitButton.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -7
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/CreditCardForm/CreditCardForm.fixture.d.ts +1 -1
- package/lib/components/CreditCardForm/CreditCardForm.fixture.mobile.d.ts +1 -1
- package/lib/components/CreditCardForm/CreditCardFormStep.js +2 -2
- package/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
- package/lib/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
- package/lib/components/CreditCardForm/StepsNavigationButtons.js +2 -2
- package/lib/components/CreditCardForm/StepsNavigationButtons.js.map +1 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.js +7 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/lib/components/CreditForm/CreditForm.fixture.d.ts +1 -1
- package/lib/components/CreditForm/CreditForm.fixture.mobile.d.ts +1 -1
- package/lib/components/CreditForm/CreditFormStep.js +2 -2
- package/lib/components/CreditForm/CreditFormStep.js.map +1 -1
- package/lib/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
- package/lib/components/CreditForm/StepsNavigationButtons.js +2 -2
- package/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
- package/lib/components/CreditForm/useCreditFormAPI.d.ts +1 -1
- package/lib/components/CreditForm/useCreditFormAPI.js +7 -1
- package/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/lib/hooks/useAsyncEffect.d.ts +1 -0
- package/lib/hooks/useAsyncEffect.js +12 -0
- package/lib/hooks/useAsyncEffect.js.map +1 -0
- package/lib/services/retail/mockLocalStorage.d.ts +1 -0
- package/lib/services/retail/mockLocalStorage.js +32 -0
- package/lib/services/retail/mockLocalStorage.js.map +1 -0
- package/lib/setup-fixture.js +11 -0
- package/lib/setup-fixture.js.map +1 -1
- package/lib/ui-kit/Button/Button.d.ts +1 -0
- package/lib/ui-kit/Button/Button.js +7 -6
- package/lib/ui-kit/Button/Button.js.map +1 -1
- package/lib/ui-kit/Loader/Loader.d.ts +1 -0
- package/lib/ui-kit/Loader/Loader.js +2 -2
- package/lib/ui-kit/Loader/Loader.js.map +1 -1
- package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +5 -4
- package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +47 -36
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
- package/mobile/bundle/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
- package/mobile/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
- package/mobile/bundle/components/CreditForm/useCreditFormAPI.d.ts +1 -1
- package/mobile/bundle/hooks/useAsyncEffect.d.ts +1 -0
- package/mobile/bundle/services/retail/mockLocalStorage.d.ts +1 -0
- package/mobile/bundle/ui-kit/Button/Button.d.ts +1 -0
- package/mobile/bundle/ui-kit/Loader/Loader.d.ts +1 -0
- package/mobile/dist/api/RetailAPI/sendCode.js +3 -4
- package/mobile/dist/api/RetailAPI/sendCode.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -2
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/renderSubmitButton.js +1 -1
- package/mobile/dist/components/ApplicationLeadForm/renderSubmitButton.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -7
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js +2 -2
- package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
- package/mobile/dist/components/CreditCardForm/StepsNavigationButtons.js +2 -2
- package/mobile/dist/components/CreditCardForm/StepsNavigationButtons.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js +7 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditFormStep.js +2 -2
- package/mobile/dist/components/CreditForm/CreditFormStep.js.map +1 -1
- package/mobile/dist/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
- package/mobile/dist/components/CreditForm/StepsNavigationButtons.js +2 -2
- package/mobile/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
- package/mobile/dist/components/CreditForm/useCreditFormAPI.d.ts +1 -1
- package/mobile/dist/components/CreditForm/useCreditFormAPI.js +7 -1
- package/mobile/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/mobile/dist/hooks/useAsyncEffect.d.ts +1 -0
- package/mobile/dist/hooks/useAsyncEffect.js +15 -0
- package/mobile/dist/hooks/useAsyncEffect.js.map +1 -0
- package/mobile/dist/services/retail/mockLocalStorage.d.ts +1 -0
- package/mobile/dist/services/retail/mockLocalStorage.js +35 -0
- package/mobile/dist/services/retail/mockLocalStorage.js.map +1 -0
- package/mobile/dist/setup-fixture.js +11 -0
- package/mobile/dist/setup-fixture.js.map +1 -1
- package/mobile/dist/ui-kit/Button/Button.d.ts +1 -0
- package/mobile/dist/ui-kit/Button/Button.js +6 -5
- package/mobile/dist/ui-kit/Button/Button.js.map +1 -1
- package/mobile/dist/ui-kit/Loader/Loader.d.ts +1 -0
- package/mobile/dist/ui-kit/Loader/Loader.js +2 -2
- package/mobile/dist/ui-kit/Loader/Loader.js.map +1 -1
- package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +5 -4
- package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/mobile/lib/api/RetailAPI/sendCode.js +4 -5
- package/mobile/lib/api/RetailAPI/sendCode.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -2
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/renderSubmitButton.js +1 -1
- package/mobile/lib/components/ApplicationLeadForm/renderSubmitButton.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -7
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js +2 -2
- package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
- package/mobile/lib/components/CreditCardForm/StepsNavigationButtons.js +2 -2
- package/mobile/lib/components/CreditCardForm/StepsNavigationButtons.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js +7 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditFormStep.js +2 -2
- package/mobile/lib/components/CreditForm/CreditFormStep.js.map +1 -1
- package/mobile/lib/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
- package/mobile/lib/components/CreditForm/StepsNavigationButtons.js +2 -2
- package/mobile/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
- package/mobile/lib/components/CreditForm/useCreditFormAPI.d.ts +1 -1
- package/mobile/lib/components/CreditForm/useCreditFormAPI.js +7 -1
- package/mobile/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/mobile/lib/hooks/useAsyncEffect.d.ts +1 -0
- package/mobile/lib/hooks/useAsyncEffect.js +12 -0
- package/mobile/lib/hooks/useAsyncEffect.js.map +1 -0
- package/mobile/lib/services/retail/mockLocalStorage.d.ts +1 -0
- package/mobile/lib/services/retail/mockLocalStorage.js +32 -0
- package/mobile/lib/services/retail/mockLocalStorage.js.map +1 -0
- package/mobile/lib/setup-fixture.js +11 -0
- package/mobile/lib/setup-fixture.js.map +1 -1
- package/mobile/lib/ui-kit/Button/Button.d.ts +1 -0
- package/mobile/lib/ui-kit/Button/Button.js +7 -6
- package/mobile/lib/ui-kit/Button/Button.js.map +1 -1
- package/mobile/lib/ui-kit/Loader/Loader.d.ts +1 -0
- package/mobile/lib/ui-kit/Loader/Loader.js +2 -2
- package/mobile/lib/ui-kit/Loader/Loader.js.map +1 -1
- package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +5 -4
- package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/mobile/src/api/RetailAPI/sendCode.ts +4 -15
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +2 -2
- package/mobile/src/components/ApplicationLeadForm/renderSubmitButton.tsx +2 -2
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +12 -7
- package/mobile/src/components/CreditCardForm/CreditCardFormStep.tsx +2 -2
- package/mobile/src/components/CreditCardForm/StepsNavigationButtons.tsx +17 -12
- package/mobile/src/components/CreditCardForm/useCreditCardFormAPI.tsx +7 -2
- package/mobile/src/components/CreditForm/CreditFormStep.tsx +2 -2
- package/mobile/src/components/CreditForm/StepsNavigationButtons.tsx +17 -12
- package/mobile/src/components/CreditForm/useCreditFormAPI.tsx +7 -2
- package/mobile/src/hooks/useAsyncEffect.ts +16 -0
- package/mobile/src/services/retail/mockLocalStorage.ts +40 -0
- package/mobile/src/setup-fixture.ts +12 -0
- package/mobile/src/ui-kit/Button/Button.tsx +7 -3
- package/mobile/src/ui-kit/Loader/Loader.tsx +5 -3
- package/mobile/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +5 -4
- package/package.json +1 -1
- package/src/api/RetailAPI/sendCode.ts +4 -15
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +2 -2
- package/src/components/ApplicationLeadForm/renderSubmitButton.tsx +2 -2
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +12 -7
- package/src/components/CreditCardForm/CreditCardForm.fixture.mobile.tsx +14 -18
- package/src/components/CreditCardForm/CreditCardForm.fixture.tsx +14 -18
- package/src/components/CreditCardForm/CreditCardFormStep.tsx +2 -2
- package/src/components/CreditCardForm/StepsNavigationButtons.tsx +17 -12
- package/src/components/CreditCardForm/useCreditCardFormAPI.tsx +7 -2
- package/src/components/CreditForm/CreditForm.fixture.mobile.tsx +19 -23
- package/src/components/CreditForm/CreditForm.fixture.tsx +19 -23
- package/src/components/CreditForm/CreditFormStep.tsx +2 -2
- package/src/components/CreditForm/StepsNavigationButtons.tsx +17 -12
- package/src/components/CreditForm/useCreditFormAPI.tsx +7 -2
- package/src/hooks/useAsyncEffect.ts +16 -0
- package/src/services/retail/mockLocalStorage.ts +40 -0
- package/src/setup-fixture.ts +12 -0
- package/src/ui-kit/Button/Button.tsx +7 -3
- package/src/ui-kit/Loader/Loader.tsx +5 -3
- package/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +5 -4
|
@@ -3,6 +3,7 @@ import { type ButtonVersion } from '../../model/ButtonVersion';
|
|
|
3
3
|
import { style } from '../../utils/style';
|
|
4
4
|
import { type ARIAProps } from '../ARIAProps';
|
|
5
5
|
import { type ControlStateProps } from '../ControlStateProps';
|
|
6
|
+
import { Loader } from '../Loader/Loader';
|
|
6
7
|
import { type PreventableEvent } from '../PreventableEvent';
|
|
7
8
|
import { useButton } from './useButton';
|
|
8
9
|
|
|
@@ -30,6 +31,7 @@ export interface ButtonProps extends ControlStateProps, ARIAProps {
|
|
|
30
31
|
version?: ButtonVersion;
|
|
31
32
|
type?: 'button' | 'submit' | 'reset';
|
|
32
33
|
rounded?: boolean;
|
|
34
|
+
isLoading?: boolean;
|
|
33
35
|
role?: string;
|
|
34
36
|
onClick?: (ev?: PreventableEvent) => void;
|
|
35
37
|
}
|
|
@@ -42,6 +44,7 @@ export const Button = JSX<ButtonProps>(({ children, ...props }) => {
|
|
|
42
44
|
version = 'primary',
|
|
43
45
|
active,
|
|
44
46
|
disabled,
|
|
47
|
+
isLoading,
|
|
45
48
|
type = 'button',
|
|
46
49
|
rounded = true,
|
|
47
50
|
role,
|
|
@@ -52,13 +55,13 @@ export const Button = JSX<ButtonProps>(({ children, ...props }) => {
|
|
|
52
55
|
<button
|
|
53
56
|
className={style(
|
|
54
57
|
'font-sans px-9 py-4',
|
|
55
|
-
'flex justify-center items-center gap-xs',
|
|
58
|
+
'flex justify-center items-center gap-xs relative',
|
|
56
59
|
{
|
|
57
60
|
'text-white bg-primary-active': active,
|
|
58
|
-
'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
|
|
61
|
+
'bg-main-gray text-main-disabled cursor-not-allowed': disabled || isLoading,
|
|
59
62
|
'rounded-md': rounded,
|
|
60
63
|
},
|
|
61
|
-
!active && !disabled
|
|
64
|
+
!active && !disabled && !isLoading
|
|
62
65
|
? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
|
|
63
66
|
: '',
|
|
64
67
|
className,
|
|
@@ -67,6 +70,7 @@ export const Button = JSX<ButtonProps>(({ children, ...props }) => {
|
|
|
67
70
|
role={role}
|
|
68
71
|
onClick={onClick}
|
|
69
72
|
>
|
|
73
|
+
{isLoading ? <Loader blur={true} size="small" /> : null}
|
|
70
74
|
{children}
|
|
71
75
|
</button>
|
|
72
76
|
);
|
|
@@ -6,10 +6,11 @@ interface LoaderProps {
|
|
|
6
6
|
color?: TextColor;
|
|
7
7
|
position?: 'static' | 'absolute';
|
|
8
8
|
blur?: boolean;
|
|
9
|
+
size?: 'small' | 'big';
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const Loader = JSX<LoaderProps>(
|
|
12
|
-
({ color = 'text-primary-main', position = 'absolute', blur = true }) => (
|
|
13
|
+
({ color = 'text-primary-main', position = 'absolute', blur = true, size = 'big' }) => (
|
|
13
14
|
<div
|
|
14
15
|
className={style('flex justify-center items-center h-full w-full z-50', position, {
|
|
15
16
|
'backdrop-blur': blur,
|
|
@@ -17,10 +18,11 @@ export const Loader = JSX<LoaderProps>(
|
|
|
17
18
|
>
|
|
18
19
|
<div
|
|
19
20
|
className={style(
|
|
20
|
-
'inline-block
|
|
21
|
+
'inline-block ',
|
|
21
22
|
'animate-spin rounded-full',
|
|
22
|
-
'border-
|
|
23
|
+
'border-solid border-current',
|
|
23
24
|
'border-r-transparent',
|
|
25
|
+
size === 'small' ? 'border-4 h-8 w-8' : 'border-8 h-28 w-28',
|
|
24
26
|
color,
|
|
25
27
|
)}
|
|
26
28
|
role="status"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
2
3
|
import { checkCode } from '../../api/RetailAPI/checkCode';
|
|
3
4
|
|
|
4
5
|
type useVerifyPhoneDialogSubmitProps = {
|
|
@@ -11,7 +12,7 @@ export const useVerifyPhoneDialogSubmit = ({
|
|
|
11
12
|
onSuccess,
|
|
12
13
|
}: useVerifyPhoneDialogSubmitProps) => {
|
|
13
14
|
const [errorText, setErrorText] = useState('');
|
|
14
|
-
const [isLoading,
|
|
15
|
+
const [isLoading, { setTrue: startLoading, setFalse: endLoading }] = useBool(false);
|
|
15
16
|
const [timeNextReq, setTimeNextReq] = useState(0);
|
|
16
17
|
const [isTimerStarted, setIsTimerStarted] = useState(false);
|
|
17
18
|
const [attempts, setAttempts] = useState(0);
|
|
@@ -26,17 +27,17 @@ export const useVerifyPhoneDialogSubmit = ({
|
|
|
26
27
|
setIsTimerStarted(false);
|
|
27
28
|
setTimeNextReq(0);
|
|
28
29
|
setAttempts((_) => _ + 1);
|
|
29
|
-
|
|
30
|
+
startLoading();
|
|
30
31
|
await checkCode({
|
|
31
32
|
smsText: values.join(''),
|
|
32
33
|
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
33
34
|
});
|
|
34
35
|
resetError();
|
|
35
|
-
onSuccess?.(values.join(''));
|
|
36
|
+
await onSuccess?.(values.join(''));
|
|
36
37
|
} catch {
|
|
37
38
|
setErrorText(attempts > 1 ? 'Исчерпан лимит ввода смс-кода' : 'Неверный код');
|
|
38
39
|
} finally {
|
|
39
|
-
|
|
40
|
+
endLoading();
|
|
40
41
|
}
|
|
41
42
|
}, [values, attempts]);
|
|
42
43
|
|