@redneckz/wildless-cms-uni-blocks 0.14.1080 → 0.14.1082

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.
Files changed (109) hide show
  1. package/bundle/bundle.umd.js +68 -39
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  4. package/bundle/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  5. package/bundle/retail/hooks/useSendCode.d.ts +18 -0
  6. package/bundle/retail/utils/yandexMetrika.d.ts +1 -1
  7. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
  8. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  9. package/dist/components/CreditCardForm/creditCardFormAspects.js +2 -1
  10. package/dist/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
  11. package/dist/retail/components/Fields/CurrencyField.js +3 -1
  12. package/dist/retail/components/Fields/CurrencyField.js.map +1 -1
  13. package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  14. package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +11 -30
  15. package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  16. package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  17. package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
  18. package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  19. package/dist/retail/hooks/useSendCode.d.ts +18 -0
  20. package/dist/retail/hooks/useSendCode.js +38 -0
  21. package/dist/retail/hooks/useSendCode.js.map +1 -0
  22. package/dist/retail/utils/commonAspects.js +2 -1
  23. package/dist/retail/utils/commonAspects.js.map +1 -1
  24. package/dist/retail/utils/yandexMetrika.d.ts +1 -1
  25. package/dist/retail/utils/yandexMetrika.js +1 -2
  26. package/dist/retail/utils/yandexMetrika.js.map +1 -1
  27. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
  28. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  29. package/lib/components/CreditCardForm/creditCardFormAspects.js +2 -1
  30. package/lib/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
  31. package/lib/retail/components/Fields/CurrencyField.js +3 -1
  32. package/lib/retail/components/Fields/CurrencyField.js.map +1 -1
  33. package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  34. package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +13 -32
  35. package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  36. package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  37. package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
  38. package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  39. package/lib/retail/hooks/useSendCode.d.ts +18 -0
  40. package/lib/retail/hooks/useSendCode.js +35 -0
  41. package/lib/retail/hooks/useSendCode.js.map +1 -0
  42. package/lib/retail/utils/commonAspects.js +2 -1
  43. package/lib/retail/utils/commonAspects.js.map +1 -1
  44. package/lib/retail/utils/yandexMetrika.d.ts +1 -1
  45. package/lib/retail/utils/yandexMetrika.js +1 -2
  46. package/lib/retail/utils/yandexMetrika.js.map +1 -1
  47. package/mobile/bundle/bundle.umd.js +68 -39
  48. package/mobile/bundle/bundle.umd.min.js +1 -1
  49. package/mobile/bundle/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  50. package/mobile/bundle/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  51. package/mobile/bundle/retail/hooks/useSendCode.d.ts +18 -0
  52. package/mobile/bundle/retail/utils/yandexMetrika.d.ts +1 -1
  53. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
  54. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  55. package/mobile/dist/components/CreditCardForm/creditCardFormAspects.js +2 -1
  56. package/mobile/dist/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
  57. package/mobile/dist/retail/components/Fields/CurrencyField.js +3 -1
  58. package/mobile/dist/retail/components/Fields/CurrencyField.js.map +1 -1
  59. package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  60. package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +11 -30
  61. package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  62. package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  63. package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
  64. package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  65. package/mobile/dist/retail/hooks/useSendCode.d.ts +18 -0
  66. package/mobile/dist/retail/hooks/useSendCode.js +38 -0
  67. package/mobile/dist/retail/hooks/useSendCode.js.map +1 -0
  68. package/mobile/dist/retail/utils/commonAspects.js +2 -1
  69. package/mobile/dist/retail/utils/commonAspects.js.map +1 -1
  70. package/mobile/dist/retail/utils/yandexMetrika.d.ts +1 -1
  71. package/mobile/dist/retail/utils/yandexMetrika.js +1 -2
  72. package/mobile/dist/retail/utils/yandexMetrika.js.map +1 -1
  73. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
  74. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  75. package/mobile/lib/components/CreditCardForm/creditCardFormAspects.js +2 -1
  76. package/mobile/lib/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
  77. package/mobile/lib/retail/components/Fields/CurrencyField.js +3 -1
  78. package/mobile/lib/retail/components/Fields/CurrencyField.js.map +1 -1
  79. package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  80. package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +13 -32
  81. package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  82. package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  83. package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
  84. package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  85. package/mobile/lib/retail/hooks/useSendCode.d.ts +18 -0
  86. package/mobile/lib/retail/hooks/useSendCode.js +35 -0
  87. package/mobile/lib/retail/hooks/useSendCode.js.map +1 -0
  88. package/mobile/lib/retail/utils/commonAspects.js +2 -1
  89. package/mobile/lib/retail/utils/commonAspects.js.map +1 -1
  90. package/mobile/lib/retail/utils/yandexMetrika.d.ts +1 -1
  91. package/mobile/lib/retail/utils/yandexMetrika.js +1 -2
  92. package/mobile/lib/retail/utils/yandexMetrika.js.map +1 -1
  93. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +6 -0
  94. package/mobile/src/components/CreditCardForm/creditCardFormAspects.ts +2 -1
  95. package/mobile/src/retail/components/Fields/CurrencyField.tsx +3 -1
  96. package/mobile/src/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.tsx +17 -35
  97. package/mobile/src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +16 -1
  98. package/mobile/src/retail/hooks/useSendCode.ts +52 -0
  99. package/mobile/src/retail/utils/commonAspects.ts +2 -1
  100. package/mobile/src/retail/utils/yandexMetrika.ts +1 -3
  101. package/package.json +1 -1
  102. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +6 -0
  103. package/src/components/CreditCardForm/creditCardFormAspects.ts +2 -1
  104. package/src/retail/components/Fields/CurrencyField.tsx +3 -1
  105. package/src/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.tsx +17 -35
  106. package/src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +16 -1
  107. package/src/retail/hooks/useSendCode.ts +52 -0
  108. package/src/retail/utils/commonAspects.ts +2 -1
  109. package/src/retail/utils/yandexMetrika.ts +1 -3
@@ -1,3 +1,4 @@
1
+ import { type Aspects } from '../../../hooks/useAspects/useAspects';
1
2
  import type { OnCloseProps } from '../../../model/OnCloseProps';
2
3
  export interface VerifyPhoneDialogProps extends OnCloseProps {
3
4
  phone: string;
@@ -5,5 +6,7 @@ export interface VerifyPhoneDialogProps extends OnCloseProps {
5
6
  consents?: string[];
6
7
  onSuccess?: (smsCode?: string) => void;
7
8
  onFail?: () => void;
9
+ productType?: string;
10
+ aspects?: Aspects;
8
11
  }
9
12
  export declare const VerifyPhoneDialog: import("@redneckz/uni-jsx").UNIComponent<VerifyPhoneDialogProps, any, any>;
@@ -1,47 +1,33 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
- import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
4
- import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
5
- import { useDialog } from '../../../ui-kit/DialogManager/useDialog.js';
3
+ import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
6
4
  import { RichText } from '../../../ui-kit/RichText/RichText.js';
7
5
  import { useCountDownTimer } from '../../../ui-kit/TimerCircle/useCountDownTimer.js';
8
6
  import { VerifyPhoneDialogLayout } from '../../../ui-kit/VerifyPhoneDialogLayout/VerfiyPhoneDialogLayout.js';
9
7
  import { formatPhone } from '../../../utils/formatPhone.js';
10
8
  import { noop } from '../../../utils/noop.js';
11
- import { sendCode } from '../../api/sendCode.js';
12
- import { CaptchaDialog } from '../CaptchaDialog/CaptchaDialog.js';
13
- import { TIME_TO_RESEND, useVerifyPhoneDialogSubmit, } from './useVerifyPhoneDialogSubmit.js';
9
+ import { useSendCode } from '../../hooks/useSendCode.js';
10
+ import { useVerifyPhoneDialogSubmit } from './useVerifyPhoneDialogSubmit.js';
14
11
  const CODE_LENGTH = 4;
15
- export const VerifyPhoneDialog = JSX(({ phone, withDescription = true, consents, onSuccess = noop, onClose = noop, onFail = noop, }) => {
12
+ export const VerifyPhoneDialog = JSX(({ phone, withDescription = true, consents, onSuccess = noop, onClose = noop, onFail = noop, productType, aspects, }) => {
16
13
  const [values, setValues] = useState(Array(CODE_LENGTH).fill(''));
17
- const sessionStore = useSessionStore();
18
14
  const phoneNumber = formatPhone(phone);
19
15
  const { handleSubmit, hasError, errorText, isLoading, timeNextReq, isSubmitButtonDisabled, setTimeNextReq, setErrorText, } = useVerifyPhoneDialogSubmit({
20
16
  values,
21
17
  phoneNumber,
22
18
  onSuccess,
23
19
  onFail,
20
+ productType,
21
+ aspects,
24
22
  });
25
- const captchaDialog = useDialog(CaptchaDialog);
26
23
  const restartTimer = useCountDownTimer({ seconds: timeNextReq, onTick: setTimeNextReq });
27
- const handleSendCode = useCallback(async () => {
28
- const response = await sendCode({
29
- phoneNumber,
30
- smsCodesSetName: { key: 'AUTHENTICATION' },
31
- });
32
- if (response.ok) {
33
- setTimeNextReq(TIME_TO_RESEND);
34
- restartTimer(TIME_TO_RESEND);
35
- setErrorText('');
36
- sessionStore.smsCode = getDefaultSmsCodeParams(phoneNumber);
37
- }
38
- else if (response.status === 429) {
39
- captchaDialog.open({ phoneNumber, sendCode: handleSendCode });
40
- }
41
- else {
42
- onFail();
43
- }
44
- }, [phoneNumber, restartTimer]);
24
+ const { handleSendCode, sessionStore } = useSendCode({
25
+ phoneNumber,
26
+ restartTimer,
27
+ setTimeNextReq,
28
+ setErrorText,
29
+ onFail,
30
+ });
45
31
  useEffect(() => {
46
32
  if (!sessionStore.smsCode?.sendTime || sessionStore.smsCode?.phoneNumber !== phoneNumber) {
47
33
  handleSendCode();
@@ -49,10 +35,5 @@ export const VerifyPhoneDialog = JSX(({ phone, withDescription = true, consents,
49
35
  }, []);
50
36
  return (_jsx(VerifyPhoneDialogLayout, { isSubmitButtonDisabled: isSubmitButtonDisabled, onSubmit: handleSubmit, onSendCode: handleSendCode, timeNextReq: timeNextReq, values: values, onChange: setValues, phone: phone, isLoading: isLoading, errorText: errorText, hasError: hasError, onClose: onClose, children: renderDescription(consents, withDescription) }));
51
37
  });
52
- const getDefaultSmsCodeParams = (phoneNumber) => ({
53
- sendTime: Date.now(),
54
- attempts: 0,
55
- phoneNumber: phoneNumber,
56
- });
57
38
  const renderDescription = (consents, isRender = false) => isRender ? (_jsxs(RichText, { itemSize: "list-s", children: [_jsx("span", { children: "\u0412\u0432\u043E\u0434\u044F \u043A\u043E\u0434, \u044F \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044E, \u0447\u0442\u043E \u043E\u0437\u043D\u0430\u043A\u043E\u043C\u043B\u0435\u043D \u0438 \u043F\u043E\u0434\u043F\u0438\u0441\u044B\u0432\u0430\u044E: " }), _jsx("ul", { children: consents?.map((_, i) => (_jsx("li", { children: _ }, `${_}-${i}`))) })] })) : null;
58
39
  //# sourceMappingURL=VerifyPhoneDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VerifyPhoneDialog.js","sourceRoot":"","sources":["../../../../src/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE9E,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,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OAAO,YAEf,iBAAiB,CAAC,QAAQ,EAAE,eAAe,CAAC,GACrB,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,QAAmB,EAAE,QAAQ,GAAG,KAAK,EAAE,EAAE,CAClE,QAAQ,CAAC,CAAC,CAAC,CACT,MAAC,QAAQ,IAAC,QAAQ,EAAC,QAAQ,aACzB,iTAAoE,EACpE,uBACG,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACvB,uBAAuB,CAAC,IAAf,GAAG,CAAC,IAAI,CAAC,EAAE,CAAU,CAC/B,CAAC,GACC,IACI,CACZ,CAAC,CAAC,CAAC,IAAI,CAAC"}
@@ -1,9 +1,12 @@
1
+ import { type Aspects } from '../../../hooks/useAspects/useAspects';
1
2
  export declare const TIME_TO_RESEND = 180;
2
3
  declare type useVerifyPhoneDialogSubmitProps = {
3
4
  values: string[];
4
5
  phoneNumber: string;
5
6
  onSuccess: (smsCode?: string) => void;
6
7
  onFail: () => void;
8
+ productType?: string;
9
+ aspects?: Aspects;
7
10
  };
8
11
  export interface SmsCodeStore {
9
12
  smsCode: {
@@ -12,7 +15,7 @@ export interface SmsCodeStore {
12
15
  phoneNumber?: string;
13
16
  };
14
17
  }
15
- export declare const useVerifyPhoneDialogSubmit: ({ values, phoneNumber, onSuccess, onFail, }: useVerifyPhoneDialogSubmitProps) => {
18
+ export declare const useVerifyPhoneDialogSubmit: ({ values, phoneNumber, onSuccess, onFail, productType, aspects, }: useVerifyPhoneDialogSubmitProps) => {
16
19
  handleSubmit: () => Promise<void>;
17
20
  hasError: boolean;
18
21
  errorText: string;
@@ -1,11 +1,13 @@
1
1
  import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
2
2
  import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
3
3
  import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
4
+ import { handleAspects } from '../../../hooks/useAspects/handleAspects.js';
4
5
  import { getTimer } from '../../../utils/getTimer.js';
5
6
  import { checkCode } from '../../api/checkCode.js';
7
+ import { getAspects } from '../../utils/commonAspects.js';
6
8
  import { saveToken } from '../../utils/saveToken.js';
7
9
  export const TIME_TO_RESEND = 180;
8
- export const useVerifyPhoneDialogSubmit = ({ values, phoneNumber, onSuccess, onFail, }) => {
10
+ export const useVerifyPhoneDialogSubmit = ({ values, phoneNumber, onSuccess, onFail, productType, aspects, }) => {
9
11
  const sessionStore = useSessionStore();
10
12
  const attempts = sessionStore.smsCode?.attempts || 0;
11
13
  const timer = Math.max(getTimer(sessionStore.smsCode?.sendTime || Date.now()), 0);
@@ -32,6 +34,13 @@ export const useVerifyPhoneDialogSubmit = ({ values, phoneNumber, onSuccess, onF
32
34
  setTimeNextReq(0);
33
35
  resetError();
34
36
  sessionStore.smsCode = null;
37
+ if (productType && aspects) {
38
+ handleAspects({
39
+ aspectsAttributes: getAspects('smsAuth', productType),
40
+ aspects,
41
+ ev: {},
42
+ });
43
+ }
35
44
  onSuccess?.(values.join(''));
36
45
  }
37
46
  else if (response.status === 403) {
@@ -41,7 +50,7 @@ export const useVerifyPhoneDialogSubmit = ({ values, phoneNumber, onSuccess, onF
41
50
  onFail();
42
51
  }
43
52
  endLoading();
44
- }, [values, attempts]);
53
+ }, [values, attempts, aspects]);
45
54
  useEffect(() => {
46
55
  if (isTimeExpired) {
47
56
  setErrorText('Код просрочен');
@@ -1 +1 @@
1
- {"version":3,"file":"useVerifyPhoneDialogSubmit.js","sourceRoot":"","sources":["../../../../src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO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,SAAS;QACT,WAAW;QACX,sBAAsB;QACtB,cAAc;QACd,YAAY;KACb,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"useVerifyPhoneDialogSubmit.js","sourceRoot":"","sources":["../../../../src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAGxE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAA0B,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAmBlC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACzC,MAAM,EACN,WAAW,EACX,SAAS,EACT,MAAM,EACN,WAAW,EACX,OAAO,GACyB,EAAE,EAAE;IACpC,MAAM,YAAY,GAAG,eAAe,EAAgB,CAAC;IACrD,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,IAAI,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAElF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC/C,MAAM,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,YAAY,EA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AE,EAAgC;iBACrC,CAAC,CAAC;aACJ;YACD,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;SAC9B;aAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YAClC,YAAY,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;SAC/E;aAAM;YACL,MAAM,EAAE,CAAC;SACV;QACD,UAAU,EAAE,CAAC;IACf,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAEhC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,aAAa,EAAE;YACjB,YAAY,CAAC,eAAe,CAAC,CAAC;SAC/B;aAAM,IAAI,QAAQ,GAAG,CAAC,EAAE;YACvB,YAAY,CAAC,+BAA+B,CAAC,CAAC;SAC/C;IACH,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO;QACL,YAAY;QACZ,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC;QAC5B,SAAS;QACT,SAAS;QACT,WAAW;QACX,sBAAsB;QACtB,cAAc;QACd,YAAY;KACb,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ interface UseSendCodeProps {
2
+ phoneNumber: string;
3
+ restartTimer: (seconds: number) => void;
4
+ setTimeNextReq: (time: number) => void;
5
+ setErrorText: (text: string) => void;
6
+ onFail: () => void;
7
+ }
8
+ export declare const useSendCode: ({ phoneNumber, restartTimer, setTimeNextReq, setErrorText, onFail, }: UseSendCodeProps) => {
9
+ handleSendCode: () => Promise<void>;
10
+ sessionStore: {
11
+ smsCode: {
12
+ sendTime?: number | undefined;
13
+ attempts?: number | undefined;
14
+ phoneNumber?: string | undefined;
15
+ } | null;
16
+ };
17
+ };
18
+ export {};
@@ -0,0 +1,35 @@
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.js';
4
+ import { TIME_TO_RESEND } from '../../utils/getTimer.js';
5
+ import { sendCode } from '../api/sendCode.js';
6
+ import { CaptchaDialog } from '../components/CaptchaDialog/CaptchaDialog.js';
7
+ const getDefaultSmsCodeParams = (phoneNumber) => ({
8
+ sendTime: Date.now(),
9
+ attempts: 0,
10
+ phoneNumber: phoneNumber,
11
+ });
12
+ export const useSendCode = ({ phoneNumber, restartTimer, setTimeNextReq, setErrorText, onFail, }) => {
13
+ const sessionStore = useSessionStore();
14
+ const captchaDialog = useDialog(CaptchaDialog);
15
+ const handleSendCode = useCallback(async () => {
16
+ const response = await sendCode({
17
+ phoneNumber,
18
+ smsCodesSetName: { key: 'AUTHENTICATION' },
19
+ });
20
+ if (response.ok) {
21
+ setTimeNextReq(TIME_TO_RESEND);
22
+ restartTimer(TIME_TO_RESEND);
23
+ setErrorText('');
24
+ sessionStore.smsCode = getDefaultSmsCodeParams(phoneNumber);
25
+ }
26
+ else if (response.status === 429) {
27
+ captchaDialog.open({ phoneNumber, sendCode: handleSendCode });
28
+ }
29
+ else {
30
+ onFail();
31
+ }
32
+ }, [phoneNumber, restartTimer]);
33
+ return { handleSendCode, sessionStore };
34
+ };
35
+ //# sourceMappingURL=useSendCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSendCode.js","sourceRoot":"","sources":["../../../src/retail/hooks/useSendCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE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ectType];
54
+ const targetName = aspectForType?.[productType || 'default'] || aspectForType?.['default'];
54
55
  return [
55
56
  {
56
57
  aspectName: 'ymReachGoal',
57
- params: { yandexId: YANDEX_ID, targetName: aspectForType[productType || 'default'] },
58
+ params: { yandexId: YANDEX_ID, targetName },
58
59
  },
59
60
  ];
60
61
  };
@@ -1 +1 @@
1
- {"version":3,"file":"commonAspects.js","sourceRoot":"","sources":["../../../src/retail/utils/commonAspects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,GAA2C;IAC1D,QAAQ,EAAE;QACR,SAAS,EAAE,iBAAiB;QAC5B,UAAU,EAAE,gBAAgB;QAC5B,OAAO,EAAE,WAAW;KACrB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,iBAAiB;QAC5B,UAAU,EAAE,gBAAgB;QAC5B,OAAO,EAAE,WAAW;KACrB;IACD,OAAO,EAAE;QACP,SAAS,EAAE,gBAAgB;QAC3B,UAAU,EAAE,eAAe;QAC3B,OAAO,EAAE,UAAU;KACpB;IACD,UAAU,EAAE;QACV,UAAU,EAAE,kBAAkB;QAC9B,OAAO,EAAE,aAAa;KACvB;IACD,MAAM,EAAE;QACN,UAAU,EAAE,cAAc;QAC1B,OAAO,EAAE,SAAS;KACnB;IACD,OAAO,EAAE;QACP,SAAS,EAAE,mBAAmB;QAC9B,UAAU,EAAE,kBAAkB;QAC9B,OAAO,EAAE,aAAa;KACvB;IACD,KAAK,EAAE;QACL,UAAU,EAAE,YAAY;QACxB,OAAO,EAAE,OAAO;KACjB;IACD,QAAQ,EAAE;QACR,UAAU,EAAE,gBAAgB;QAC5B,OAAO,EAAE,WAAW;KACrB;IACD,WAAW,EAAE;QACX,UAAU,EAAE,mBAAmB;QAC/B,OAAO,EAAE,cAAc;KACxB;IACD,QAAQ,EAAE;QACR,UAAU,EAAE,eAAe;QAC3B,OAAO,EAAE,UAAU;KACpB;IACD,MAAM,EAAE;QACN,UAAU,EAAE,aAAa;QACzB,OAAO,EAAE,QAAQ;KAClB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAAkB,EAAE,WAAoB,EAAgB,EAAE;IACnF,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IAE9C,OAAO;QACL;YACE,UAAU,EAAE,aAAa;YACzB,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,WAAW,IAAI,SAAS,CAAC,EAAE;SACrF;KACF,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"commonAspects.js","sourceRoot":"","sources":["../../../src/retail/utils/commonAspects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,GAA2C;IAC1D,QAAQ,EAAE;QACR,SAAS,EAAE,iBAAiB;QAC5B,UAAU,EAAE,gBAAgB;QAC5B,OAAO,EAAE,WAAW;KACrB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,iBAAiB;QAC5B,UAAU,EAAE,gBAAgB;QAC5B,OAAO,EAAE,WAAW;KACrB;IACD,OAAO,EAAE;QACP,SAAS,EAAE,gBAAgB;QAC3B,UAAU,EAAE,eAAe;QAC3B,OAAO,EAAE,UAAU;KACpB;IACD,UAAU,EAAE;QACV,UAAU,EAAE,kBAAkB;QAC9B,OAAO,EAAE,aAAa;KACvB;IACD,MAAM,EAAE;QACN,UAAU,EAAE,cAAc;QAC1B,OAAO,EAAE,SAAS;KACnB;IACD,OAAO,EAAE;QACP,SAAS,EAAE,mBAAmB;QAC9B,UAAU,EAAE,kBAAkB;QAC9B,OAAO,EAAE,aAAa;KACvB;IACD,KAAK,EAAE;QACL,UAAU,EAAE,YAAY;QACxB,OAAO,EAAE,OAAO;KACjB;IACD,QAAQ,EAAE;QACR,UAAU,EAAE,gBAAgB;QAC5B,OAAO,EAAE,WAAW;KACrB;IACD,WAAW,EAAE;QACX,UAAU,EAAE,mBAAmB;QAC/B,OAAO,EAAE,cAAc;KACxB;IACD,QAAQ,EAAE;QACR,UAAU,EAAE,eAAe;QAC3B,OAAO,EAAE,UAAU;KACpB;IACD,MAAM,EAAE;QACN,UAAU,EAAE,aAAa;QACzB,OAAO,EAAE,QAAQ;KAClB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAAkB,EAAE,WAAoB,EAAgB,EAAE;IACnF,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,aAAa,EAAE,CAAC,SAAS,CAAC,CAAC;IAE3F,OAAO;QACL;YACE,UAAU,EAAE,aAAa;YACzB,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE;SAC5C;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1 +1 @@
1
- export declare const YANDEX_ID: string;
1
+ export declare const YANDEX_ID = "92511315";
@@ -1,3 +1,2 @@
1
- import { projectSettings } from '../../ProjectSettings.js';
2
- export const YANDEX_ID = projectSettings.YANDEX_METRIKA_ID || '92511315';
1
+ export const YANDEX_ID = '92511315';
3
2
  //# sourceMappingURL=yandexMetrika.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"yandexMetrika.js","sourceRoot":"","sources":["../../../src/retail/utils/yandexMetrika.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC,iBAAiB,IAAI,UAAU,CAAC"}
1
+ {"version":3,"file":"yandexMetrika.js","sourceRoot":"","sources":["../../../src/retail/utils/yandexMetrika.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC"}
@@ -129,6 +129,8 @@ export const useApplicationLeadApi = ({
129
129
  consents: acceptedConsents,
130
130
  onSuccess: handleSuccessVerify,
131
131
  onFail: handleFailSendForm,
132
+ productType,
133
+ aspects,
132
134
  });
133
135
  } catch {
134
136
  handleFailSendForm();
@@ -174,6 +176,8 @@ export const useApplicationLeadApi = ({
174
176
  consents: acceptedConsents,
175
177
  onSuccess: handleSuccessVerify,
176
178
  onFail: handleFailSendForm,
179
+ productType,
180
+ aspects,
177
181
  });
178
182
  } catch {
179
183
  handleFailSendForm();
@@ -292,6 +296,7 @@ const createHandleSuccessVerifyNew =
292
296
  task,
293
297
  isFromLead: true,
294
298
  taskType: productTypeToTaskType(productType),
299
+ isDebit: productType === 'debitCard',
295
300
  sendAspects,
296
301
  onClose: sendCurrentTask,
297
302
  });
@@ -356,6 +361,7 @@ const createHandleSuccessVerifyOld =
356
361
  task,
357
362
  isFromLead: true,
358
363
  taskType: productTypeToTaskType(productType),
364
+ isDebit: productType === 'debitCard',
359
365
  sendAspects,
360
366
  onClose: sendCurrentTask,
361
367
  });
@@ -1,9 +1,10 @@
1
1
  import { type StepAspectsConfig } from '../../retail/utils/formAspectsConfig';
2
2
 
3
3
  export const CREDIT_CARD_FORM_STEPS_ASPECTS: StepAspectsConfig[] = [
4
- { ymTargetName: 'card_credit_calculator' },
4
+ { ymTargetName: 'card_params' },
5
5
  { ymTargetName: 'card_app_personal_data' },
6
6
  { ymTargetName: 'card_app_work' },
7
7
  { ymTargetName: 'card_app_income' },
8
+ { ymTargetName: 'card_bankrot' },
8
9
  { ymTargetName: 'card_app_bank_office' },
9
10
  ];
@@ -7,6 +7,7 @@ import { RadioButtonGroupControl } from '../../../ui-kit/RadioButtonGroup/RadioB
7
7
  import { useLeadFormData } from '../../hooks/useLeadFormData';
8
8
 
9
9
  const RUBLE = [{ id: '810', text: 'Рубли' }];
10
+ const SALARY_PROGRAM_IDS = ['38', '48', '49'];
10
11
 
11
12
  export const CurrencyField = JSX<CustomFieldProps>(({ field, input }) => {
12
13
  const { data } = useLeadFormData('CURRENCY');
@@ -14,7 +15,8 @@ export const CurrencyField = JSX<CustomFieldProps>(({ field, input }) => {
14
15
 
15
16
  const isOnlyRuble = useMemo(
16
17
  () =>
17
- !Object.keys(debitProgrammIdToCardCodesMap).includes(programId || '') || programId === '38',
18
+ !Object.keys(debitProgrammIdToCardCodesMap).includes(programId || '') ||
19
+ SALARY_PROGRAM_IDS.includes(programId ?? ''),
18
20
  [],
19
21
  );
20
22
  const currencies = useMemo(
@@ -1,20 +1,14 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
- import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
2
+ import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
+ import { type Aspects } from '../../../hooks/useAspects/useAspects';
4
4
  import type { OnCloseProps } from '../../../model/OnCloseProps';
5
- import { useDialog } from '../../../ui-kit/DialogManager/useDialog';
6
5
  import { RichText } from '../../../ui-kit/RichText/RichText';
7
6
  import { useCountDownTimer } from '../../../ui-kit/TimerCircle/useCountDownTimer';
8
7
  import { VerifyPhoneDialogLayout } from '../../../ui-kit/VerifyPhoneDialogLayout/VerfiyPhoneDialogLayout';
9
8
  import { formatPhone } from '../../../utils/formatPhone';
10
9
  import { noop } from '../../../utils/noop';
11
- import { sendCode } from '../../api/sendCode';
12
- import { CaptchaDialog } from '../CaptchaDialog/CaptchaDialog';
13
- import {
14
- TIME_TO_RESEND,
15
- useVerifyPhoneDialogSubmit,
16
- type SmsCodeStore,
17
- } from './useVerifyPhoneDialogSubmit';
10
+ import { useSendCode } from '../../hooks/useSendCode';
11
+ import { useVerifyPhoneDialogSubmit } from './useVerifyPhoneDialogSubmit';
18
12
 
19
13
  const CODE_LENGTH = 4;
20
14
 
@@ -24,6 +18,8 @@ export interface VerifyPhoneDialogProps extends OnCloseProps {
24
18
  consents?: string[];
25
19
  onSuccess?: (smsCode?: string) => void;
26
20
  onFail?: () => void;
21
+ productType?: string;
22
+ aspects?: Aspects;
27
23
  }
28
24
 
29
25
  export const VerifyPhoneDialog = JSX<VerifyPhoneDialogProps>(
@@ -34,9 +30,10 @@ export const VerifyPhoneDialog = JSX<VerifyPhoneDialogProps>(
34
30
  onSuccess = noop,
35
31
  onClose = noop,
36
32
  onFail = noop,
33
+ productType,
34
+ aspects,
37
35
  }) => {
38
36
  const [values, setValues] = useState<string[]>(Array(CODE_LENGTH).fill('') as string[]);
39
- const sessionStore = useSessionStore<SmsCodeStore>();
40
37
  const phoneNumber = formatPhone(phone);
41
38
 
42
39
  const {
@@ -53,28 +50,19 @@ export const VerifyPhoneDialog = JSX<VerifyPhoneDialogProps>(
53
50
  phoneNumber,
54
51
  onSuccess,
55
52
  onFail,
53
+ productType,
54
+ aspects,
56
55
  });
57
56
 
58
- const captchaDialog = useDialog(CaptchaDialog);
59
57
  const restartTimer = useCountDownTimer({ seconds: timeNextReq, onTick: setTimeNextReq });
60
58
 
61
- const handleSendCode = useCallback(async () => {
62
- const response = await sendCode({
63
- phoneNumber,
64
- smsCodesSetName: { key: 'AUTHENTICATION' },
65
- });
66
-
67
- if (response.ok) {
68
- setTimeNextReq(TIME_TO_RESEND);
69
- restartTimer(TIME_TO_RESEND);
70
- setErrorText('');
71
- sessionStore.smsCode = getDefaultSmsCodeParams(phoneNumber);
72
- } else if (response.status === 429) {
73
- captchaDialog.open({ phoneNumber, sendCode: handleSendCode });
74
- } else {
75
- onFail();
76
- }
77
- }, [phoneNumber, restartTimer]);
59
+ const { handleSendCode, sessionStore } = useSendCode({
60
+ phoneNumber,
61
+ restartTimer,
62
+ setTimeNextReq,
63
+ setErrorText,
64
+ onFail,
65
+ });
78
66
 
79
67
  useEffect(() => {
80
68
  if (!sessionStore.smsCode?.sendTime || sessionStore.smsCode?.phoneNumber !== phoneNumber) {
@@ -102,12 +90,6 @@ export const VerifyPhoneDialog = JSX<VerifyPhoneDialogProps>(
102
90
  },
103
91
  );
104
92
 
105
- const getDefaultSmsCodeParams = (phoneNumber: string) => ({
106
- sendTime: Date.now(),
107
- attempts: 0,
108
- phoneNumber: phoneNumber,
109
- });
110
-
111
93
  const renderDescription = (consents?: string[], isRender = false) =>
112
94
  isRender ? (
113
95
  <RichText itemSize="list-s">
@@ -1,8 +1,12 @@
1
1
  import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
2
2
  import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
3
3
  import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
4
+ import { handleAspects } from '../../../hooks/useAspects/handleAspects';
5
+ import { type Aspects } from '../../../hooks/useAspects/useAspects';
6
+ import { type PreventableEventWithTarget } from '../../../ui-kit/PreventableEvent';
4
7
  import { getTimer } from '../../../utils/getTimer';
5
8
  import { checkCode, type CheckCodeResponse } from '../../api/checkCode';
9
+ import { getAspects } from '../../utils/commonAspects';
6
10
  import { saveToken } from '../../utils/saveToken';
7
11
 
8
12
  export const TIME_TO_RESEND = 180;
@@ -12,6 +16,8 @@ type useVerifyPhoneDialogSubmitProps = {
12
16
  phoneNumber: string;
13
17
  onSuccess: (smsCode?: string) => void;
14
18
  onFail: () => void;
19
+ productType?: string;
20
+ aspects?: Aspects;
15
21
  };
16
22
 
17
23
  export interface SmsCodeStore {
@@ -27,6 +33,8 @@ export const useVerifyPhoneDialogSubmit = ({
27
33
  phoneNumber,
28
34
  onSuccess,
29
35
  onFail,
36
+ productType,
37
+ aspects,
30
38
  }: useVerifyPhoneDialogSubmitProps) => {
31
39
  const sessionStore = useSessionStore<SmsCodeStore>();
32
40
  const attempts = sessionStore.smsCode?.attempts || 0;
@@ -59,6 +67,13 @@ export const useVerifyPhoneDialogSubmit = ({
59
67
  setTimeNextReq(0);
60
68
  resetError();
61
69
  sessionStore.smsCode = null;
70
+ if (productType && aspects) {
71
+ handleAspects({
72
+ aspectsAttributes: getAspects('smsAuth', productType),
73
+ aspects,
74
+ ev: {} as PreventableEventWithTarget,
75
+ });
76
+ }
62
77
  onSuccess?.(values.join(''));
63
78
  } else if (response.status === 403) {
64
79
  setErrorText(attempts > 1 ? 'Исчерпан лимит ввода смс-кода' : 'Неверный код');
@@ -66,7 +81,7 @@ export const useVerifyPhoneDialogSubmit = ({
66
81
  onFail();
67
82
  }
68
83
  endLoading();
69
- }, [values, attempts]);
84
+ }, [values, attempts, aspects]);
70
85
 
71
86
  useEffect(() => {
72
87
  if (isTimeExpired) {
@@ -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: aspectForType[productType || 'default'] },
62
+ params: { yandexId: YANDEX_ID, targetName },
62
63
  },
63
64
  ];
64
65
  };
@@ -1,3 +1 @@
1
- import { projectSettings } from '../../ProjectSettings';
2
-
3
- export const YANDEX_ID = projectSettings.YANDEX_METRIKA_ID || '92511315';
1
+ export const YANDEX_ID = '92511315';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.1080",
3
+ "version": "0.14.1082",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -129,6 +129,8 @@ export const useApplicationLeadApi = ({
129
129
  consents: acceptedConsents,
130
130
  onSuccess: handleSuccessVerify,
131
131
  onFail: handleFailSendForm,
132
+ productType,
133
+ aspects,
132
134
  });
133
135
  } catch {
134
136
  handleFailSendForm();
@@ -174,6 +176,8 @@ export const useApplicationLeadApi = ({
174
176
  consents: acceptedConsents,
175
177
  onSuccess: handleSuccessVerify,
176
178
  onFail: handleFailSendForm,
179
+ productType,
180
+ aspects,
177
181
  });
178
182
  } catch {
179
183
  handleFailSendForm();
@@ -292,6 +296,7 @@ const createHandleSuccessVerifyNew =
292
296
  task,
293
297
  isFromLead: true,
294
298
  taskType: productTypeToTaskType(productType),
299
+ isDebit: productType === 'debitCard',
295
300
  sendAspects,
296
301
  onClose: sendCurrentTask,
297
302
  });
@@ -356,6 +361,7 @@ const createHandleSuccessVerifyOld =
356
361
  task,
357
362
  isFromLead: true,
358
363
  taskType: productTypeToTaskType(productType),
364
+ isDebit: productType === 'debitCard',
359
365
  sendAspects,
360
366
  onClose: sendCurrentTask,
361
367
  });
@@ -1,9 +1,10 @@
1
1
  import { type StepAspectsConfig } from '../../retail/utils/formAspectsConfig';
2
2
 
3
3
  export const CREDIT_CARD_FORM_STEPS_ASPECTS: StepAspectsConfig[] = [
4
- { ymTargetName: 'card_credit_calculator' },
4
+ { ymTargetName: 'card_params' },
5
5
  { ymTargetName: 'card_app_personal_data' },
6
6
  { ymTargetName: 'card_app_work' },
7
7
  { ymTargetName: 'card_app_income' },
8
+ { ymTargetName: 'card_bankrot' },
8
9
  { ymTargetName: 'card_app_bank_office' },
9
10
  ];
@@ -7,6 +7,7 @@ import { RadioButtonGroupControl } from '../../../ui-kit/RadioButtonGroup/RadioB
7
7
  import { useLeadFormData } from '../../hooks/useLeadFormData';
8
8
 
9
9
  const RUBLE = [{ id: '810', text: 'Рубли' }];
10
+ const SALARY_PROGRAM_IDS = ['38', '48', '49'];
10
11
 
11
12
  export const CurrencyField = JSX<CustomFieldProps>(({ field, input }) => {
12
13
  const { data } = useLeadFormData('CURRENCY');
@@ -14,7 +15,8 @@ export const CurrencyField = JSX<CustomFieldProps>(({ field, input }) => {
14
15
 
15
16
  const isOnlyRuble = useMemo(
16
17
  () =>
17
- !Object.keys(debitProgrammIdToCardCodesMap).includes(programId || '') || programId === '38',
18
+ !Object.keys(debitProgrammIdToCardCodesMap).includes(programId || '') ||
19
+ SALARY_PROGRAM_IDS.includes(programId ?? ''),
18
20
  [],
19
21
  );
20
22
  const currencies = useMemo(