@redneckz/wildless-cms-uni-blocks 0.14.1080 → 0.14.1081
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 +64 -37
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
- package/bundle/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
- package/bundle/retail/hooks/useSendCode.d.ts +18 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/CreditCardForm/creditCardFormAspects.js +2 -1
- package/dist/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
- package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
- package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +11 -30
- package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
- package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
- package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/dist/retail/hooks/useSendCode.d.ts +18 -0
- package/dist/retail/hooks/useSendCode.js +38 -0
- package/dist/retail/hooks/useSendCode.js.map +1 -0
- package/dist/retail/utils/commonAspects.js +2 -1
- package/dist/retail/utils/commonAspects.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/CreditCardForm/creditCardFormAspects.js +2 -1
- package/lib/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
- package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
- package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +13 -32
- package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
- package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
- package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/lib/retail/hooks/useSendCode.d.ts +18 -0
- package/lib/retail/hooks/useSendCode.js +35 -0
- package/lib/retail/hooks/useSendCode.js.map +1 -0
- package/lib/retail/utils/commonAspects.js +2 -1
- package/lib/retail/utils/commonAspects.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +64 -37
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
- package/mobile/bundle/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
- package/mobile/bundle/retail/hooks/useSendCode.d.ts +18 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/creditCardFormAspects.js +2 -1
- package/mobile/dist/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
- package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
- package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +11 -30
- package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
- package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
- package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/mobile/dist/retail/hooks/useSendCode.d.ts +18 -0
- package/mobile/dist/retail/hooks/useSendCode.js +38 -0
- package/mobile/dist/retail/hooks/useSendCode.js.map +1 -0
- package/mobile/dist/retail/utils/commonAspects.js +2 -1
- package/mobile/dist/retail/utils/commonAspects.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/creditCardFormAspects.js +2 -1
- package/mobile/lib/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
- package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
- package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +13 -32
- package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
- package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
- package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
- package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
- package/mobile/lib/retail/hooks/useSendCode.d.ts +18 -0
- package/mobile/lib/retail/hooks/useSendCode.js +35 -0
- package/mobile/lib/retail/hooks/useSendCode.js.map +1 -0
- package/mobile/lib/retail/utils/commonAspects.js +2 -1
- package/mobile/lib/retail/utils/commonAspects.js.map +1 -1
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +6 -0
- package/mobile/src/components/CreditCardForm/creditCardFormAspects.ts +2 -1
- package/mobile/src/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.tsx +17 -35
- package/mobile/src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +16 -1
- package/mobile/src/retail/hooks/useSendCode.ts +52 -0
- package/mobile/src/retail/utils/commonAspects.ts +2 -1
- package/package.json +1 -1
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +6 -0
- package/src/components/CreditCardForm/creditCardFormAspects.ts +2 -1
- package/src/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.tsx +17 -35
- package/src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +16 -1
- package/src/retail/hooks/useSendCode.ts +52 -0
- package/src/retail/utils/commonAspects.ts +2 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
3
|
+
import { useDialog } from '../../ui-kit/DialogManager/useDialog';
|
|
4
|
+
import { TIME_TO_RESEND } from '../../utils/getTimer';
|
|
5
|
+
import { sendCode } from '../api/sendCode';
|
|
6
|
+
import { CaptchaDialog } from '../components/CaptchaDialog/CaptchaDialog';
|
|
7
|
+
import { type SmsCodeStore } from '../components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit';
|
|
8
|
+
|
|
9
|
+
interface UseSendCodeProps {
|
|
10
|
+
phoneNumber: string;
|
|
11
|
+
restartTimer: (seconds: number) => void;
|
|
12
|
+
setTimeNextReq: (time: number) => void;
|
|
13
|
+
setErrorText: (text: string) => void;
|
|
14
|
+
onFail: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const getDefaultSmsCodeParams = (phoneNumber: string) => ({
|
|
18
|
+
sendTime: Date.now(),
|
|
19
|
+
attempts: 0,
|
|
20
|
+
phoneNumber: phoneNumber,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const useSendCode = ({
|
|
24
|
+
phoneNumber,
|
|
25
|
+
restartTimer,
|
|
26
|
+
setTimeNextReq,
|
|
27
|
+
setErrorText,
|
|
28
|
+
onFail,
|
|
29
|
+
}: UseSendCodeProps) => {
|
|
30
|
+
const sessionStore = useSessionStore<SmsCodeStore>();
|
|
31
|
+
const captchaDialog = useDialog(CaptchaDialog);
|
|
32
|
+
|
|
33
|
+
const handleSendCode = useCallback(async () => {
|
|
34
|
+
const response = await sendCode({
|
|
35
|
+
phoneNumber,
|
|
36
|
+
smsCodesSetName: { key: 'AUTHENTICATION' },
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
if (response.ok) {
|
|
40
|
+
setTimeNextReq(TIME_TO_RESEND);
|
|
41
|
+
restartTimer(TIME_TO_RESEND);
|
|
42
|
+
setErrorText('');
|
|
43
|
+
sessionStore.smsCode = getDefaultSmsCodeParams(phoneNumber);
|
|
44
|
+
} else if (response.status === 429) {
|
|
45
|
+
captchaDialog.open({ phoneNumber, sendCode: handleSendCode });
|
|
46
|
+
} else {
|
|
47
|
+
onFail();
|
|
48
|
+
}
|
|
49
|
+
}, [phoneNumber, restartTimer]);
|
|
50
|
+
|
|
51
|
+
return { handleSendCode, sessionStore };
|
|
52
|
+
};
|
|
@@ -54,11 +54,12 @@ const ASPECTS_MAP: Record<string, Record<string, string>> = {
|
|
|
54
54
|
|
|
55
55
|
export const getAspects = (aspectType: string, productType?: string): AspectsDef[] => {
|
|
56
56
|
const aspectForType = ASPECTS_MAP[aspectType];
|
|
57
|
+
const targetName = aspectForType?.[productType || 'default'] || aspectForType?.['default'];
|
|
57
58
|
|
|
58
59
|
return [
|
|
59
60
|
{
|
|
60
61
|
aspectName: 'ymReachGoal',
|
|
61
|
-
params: { yandexId: YANDEX_ID, targetName
|
|
62
|
+
params: { yandexId: YANDEX_ID, targetName },
|
|
62
63
|
},
|
|
63
64
|
];
|
|
64
65
|
};
|