@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.
Files changed (83) hide show
  1. package/bundle/bundle.umd.js +64 -37
  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/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
  7. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  8. package/dist/components/CreditCardForm/creditCardFormAspects.js +2 -1
  9. package/dist/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
  10. package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  11. package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +11 -30
  12. package/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  13. package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  14. package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
  15. package/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  16. package/dist/retail/hooks/useSendCode.d.ts +18 -0
  17. package/dist/retail/hooks/useSendCode.js +38 -0
  18. package/dist/retail/hooks/useSendCode.js.map +1 -0
  19. package/dist/retail/utils/commonAspects.js +2 -1
  20. package/dist/retail/utils/commonAspects.js.map +1 -1
  21. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
  22. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  23. package/lib/components/CreditCardForm/creditCardFormAspects.js +2 -1
  24. package/lib/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
  25. package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  26. package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +13 -32
  27. package/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  28. package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  29. package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
  30. package/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  31. package/lib/retail/hooks/useSendCode.d.ts +18 -0
  32. package/lib/retail/hooks/useSendCode.js +35 -0
  33. package/lib/retail/hooks/useSendCode.js.map +1 -0
  34. package/lib/retail/utils/commonAspects.js +2 -1
  35. package/lib/retail/utils/commonAspects.js.map +1 -1
  36. package/mobile/bundle/bundle.umd.js +64 -37
  37. package/mobile/bundle/bundle.umd.min.js +1 -1
  38. package/mobile/bundle/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  39. package/mobile/bundle/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  40. package/mobile/bundle/retail/hooks/useSendCode.d.ts +18 -0
  41. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
  42. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  43. package/mobile/dist/components/CreditCardForm/creditCardFormAspects.js +2 -1
  44. package/mobile/dist/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
  45. package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  46. package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +11 -30
  47. package/mobile/dist/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  48. package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  49. package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
  50. package/mobile/dist/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  51. package/mobile/dist/retail/hooks/useSendCode.d.ts +18 -0
  52. package/mobile/dist/retail/hooks/useSendCode.js +38 -0
  53. package/mobile/dist/retail/hooks/useSendCode.js.map +1 -0
  54. package/mobile/dist/retail/utils/commonAspects.js +2 -1
  55. package/mobile/dist/retail/utils/commonAspects.js.map +1 -1
  56. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +6 -0
  57. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  58. package/mobile/lib/components/CreditCardForm/creditCardFormAspects.js +2 -1
  59. package/mobile/lib/components/CreditCardForm/creditCardFormAspects.js.map +1 -1
  60. package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +3 -0
  61. package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js +13 -32
  62. package/mobile/lib/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.js.map +1 -1
  63. package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +4 -1
  64. package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +11 -2
  65. package/mobile/lib/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  66. package/mobile/lib/retail/hooks/useSendCode.d.ts +18 -0
  67. package/mobile/lib/retail/hooks/useSendCode.js +35 -0
  68. package/mobile/lib/retail/hooks/useSendCode.js.map +1 -0
  69. package/mobile/lib/retail/utils/commonAspects.js +2 -1
  70. package/mobile/lib/retail/utils/commonAspects.js.map +1 -1
  71. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +6 -0
  72. package/mobile/src/components/CreditCardForm/creditCardFormAspects.ts +2 -1
  73. package/mobile/src/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.tsx +17 -35
  74. package/mobile/src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +16 -1
  75. package/mobile/src/retail/hooks/useSendCode.ts +52 -0
  76. package/mobile/src/retail/utils/commonAspects.ts +2 -1
  77. package/package.json +1 -1
  78. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +6 -0
  79. package/src/components/CreditCardForm/creditCardFormAspects.ts +2 -1
  80. package/src/retail/components/VerifyPhoneDialog/VerifyPhoneDialog.tsx +17 -35
  81. package/src/retail/components/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +16 -1
  82. package/src/retail/hooks/useSendCode.ts +52 -0
  83. package/src/retail/utils/commonAspects.ts +2 -1
@@ -3931,8 +3931,8 @@
3931
3931
  const renderNextButton = (disabled, onClick) => (jsx(SubmitButton, { text: "\u0414\u0430\u043B\u0435\u0435", disabled: disabled, onClick: onClick }));
3932
3932
  const renderText$1 = (timeNextReq, handleSendCode) => timeNextReq ? (jsxs("div", { className: "flex flex-row text-l font-light text-base gap-2xs", children: [jsx("span", { children: " \u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u043A\u043E\u0434 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437" }), jsx(Timer, { seconds: timeNextReq })] })) : (jsx(Button, { embedded: true, onClick: handleSendCode, testId: "send-new-code-button", children: jsx(ButtonTitle, { children: "\u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u043A\u043E\u0434" }) }));
3933
3933
 
3934
- const TIME_TO_RESEND$2 = 180;
3935
- const getTimer = (sendTime) => TIME_TO_RESEND$2 - Math.floor((Date.now() - sendTime) / 1000);
3934
+ const TIME_TO_RESEND$1 = 180;
3935
+ const getTimer = (sendTime) => TIME_TO_RESEND$1 - Math.floor((Date.now() - sendTime) / 1000);
3936
3936
 
3937
3937
  const API$1 = LeadServiceAPI();
3938
3938
  const useVerifyPhoneDialogSubmit$1 = ({ values, onSuccess, formatData, reqId, }) => {
@@ -3981,7 +3981,7 @@
3981
3981
 
3982
3982
  const API = LeadServiceAPI();
3983
3983
  const CODE_LENGTH$1 = 4;
3984
- const TIME_TO_RESEND$1 = 180;
3984
+ const TIME_TO_RESEND = 180;
3985
3985
  const VerifyPhoneDialog$1 = JSX(({ phone, onSuccess = noop, onClose = noop, formatData = {}, reqId }) => {
3986
3986
  const [values, setValues] = useState(Array(CODE_LENGTH$1).fill(''));
3987
3987
  const [requestId, setRequestId] = useState(reqId);
@@ -3996,8 +3996,8 @@
3996
3996
  const handleSendCode = useCallback(async () => {
3997
3997
  const response = await API.sendCode({ phone: phoneNumber });
3998
3998
  if (response) {
3999
- setTimeNextReq(TIME_TO_RESEND$1);
4000
- restartTimer(TIME_TO_RESEND$1);
3999
+ setTimeNextReq(TIME_TO_RESEND);
4000
+ restartTimer(TIME_TO_RESEND);
4001
4001
  setErrorText('');
4002
4002
  setRequestId(String(response));
4003
4003
  }
@@ -6951,10 +6951,11 @@
6951
6951
  };
6952
6952
  const getAspects = (aspectType, productType) => {
6953
6953
  const aspectForType = ASPECTS_MAP[aspectType];
6954
+ const targetName = aspectForType?.[productType || 'default'] || aspectForType?.['default'];
6954
6955
  return [
6955
6956
  {
6956
6957
  aspectName: 'ymReachGoal',
6957
- params: { yandexId: YANDEX_ID, targetName: aspectForType[productType || 'default'] },
6958
+ params: { yandexId: YANDEX_ID, targetName },
6958
6959
  },
6959
6960
  ];
6960
6961
  };
@@ -7099,6 +7100,35 @@
7099
7100
  return (jsx(Dialog, { head: jsx(Logo, {}), onClose: closeAll, children: jsxs("div", { className: "flex flex-col gap-lg items-center", children: [jsxs("div", { className: "flex", children: [jsx("img", { className: "grow", src: captcha }), jsx(Button, { className: "w-8", embedded: true, onClick: handleCreateCaptcha, children: jsx(Icon, { iconVersion: "normal", name: "RefreshIcon" }) })] }), jsx(Input, { className: "w-80", onChange: setCode, value: code, placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434 \u0441 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438" }), hasError ? jsx("div", { className: "text-error", children: "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434" }) : null, jsxs("div", { className: "flex w-80 justify-between", children: [jsx(Button, { version: "secondary", onClick: closeAll, children: "\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F" }), jsx(SubmitButton$1, { version: "secondary", disabled: !code, onClick: handleCheckCaptcha, children: "\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C" })] }), isLoading ? jsx(Loader, { blur: false }) : null] }) }));
7100
7101
  });
7101
7102
 
7103
+ const getDefaultSmsCodeParams = (phoneNumber) => ({
7104
+ sendTime: Date.now(),
7105
+ attempts: 0,
7106
+ phoneNumber: phoneNumber,
7107
+ });
7108
+ const useSendCode = ({ phoneNumber, restartTimer, setTimeNextReq, setErrorText, onFail, }) => {
7109
+ const sessionStore = useSessionStore();
7110
+ const captchaDialog = useDialog(CaptchaDialog);
7111
+ const handleSendCode = useCallback(async () => {
7112
+ const response = await sendCode({
7113
+ phoneNumber,
7114
+ smsCodesSetName: { key: 'AUTHENTICATION' },
7115
+ });
7116
+ if (response.ok) {
7117
+ setTimeNextReq(TIME_TO_RESEND$1);
7118
+ restartTimer(TIME_TO_RESEND$1);
7119
+ setErrorText('');
7120
+ sessionStore.smsCode = getDefaultSmsCodeParams(phoneNumber);
7121
+ }
7122
+ else if (response.status === 429) {
7123
+ captchaDialog.open({ phoneNumber, sendCode: handleSendCode });
7124
+ }
7125
+ else {
7126
+ onFail();
7127
+ }
7128
+ }, [phoneNumber, restartTimer]);
7129
+ return { handleSendCode, sessionStore };
7130
+ };
7131
+
7102
7132
  const checkCode = async (body) => {
7103
7133
  const isNewMicroservice = checkNewMicroservice();
7104
7134
  return await doRequest(`${isNewMicroservice ? '/external/user-data' : ''}/sms/checkCode`, 'POST', {
@@ -7113,8 +7143,7 @@
7113
7143
  globalThis.sessionStorage.setItem('refreshToken', data.refresh_token);
7114
7144
  };
7115
7145
 
7116
- const TIME_TO_RESEND = 180;
7117
- const useVerifyPhoneDialogSubmit = ({ values, phoneNumber, onSuccess, onFail, }) => {
7146
+ const useVerifyPhoneDialogSubmit = ({ values, phoneNumber, onSuccess, onFail, productType, aspects, }) => {
7118
7147
  const sessionStore = useSessionStore();
7119
7148
  const attempts = sessionStore.smsCode?.attempts || 0;
7120
7149
  const timer = Math.max(getTimer(sessionStore.smsCode?.sendTime || Date.now()), 0);
@@ -7141,6 +7170,13 @@
7141
7170
  setTimeNextReq(0);
7142
7171
  resetError();
7143
7172
  sessionStore.smsCode = null;
7173
+ if (productType && aspects) {
7174
+ handleAspects({
7175
+ aspectsAttributes: getAspects('smsAuth', productType),
7176
+ aspects,
7177
+ ev: {},
7178
+ });
7179
+ }
7144
7180
  onSuccess?.(values.join(''));
7145
7181
  }
7146
7182
  else if (response.status === 403) {
@@ -7150,7 +7186,7 @@
7150
7186
  onFail();
7151
7187
  }
7152
7188
  endLoading();
7153
- }, [values, attempts]);
7189
+ }, [values, attempts, aspects]);
7154
7190
  useEffect(() => {
7155
7191
  if (isTimeExpired) {
7156
7192
  setErrorText('Код просрочен');
@@ -7172,36 +7208,25 @@
7172
7208
  };
7173
7209
 
7174
7210
  const CODE_LENGTH = 4;
7175
- const VerifyPhoneDialog = JSX(({ phone, withDescription = true, consents, onSuccess = noop, onClose = noop, onFail = noop, }) => {
7211
+ const VerifyPhoneDialog = JSX(({ phone, withDescription = true, consents, onSuccess = noop, onClose = noop, onFail = noop, productType, aspects, }) => {
7176
7212
  const [values, setValues] = useState(Array(CODE_LENGTH).fill(''));
7177
- const sessionStore = useSessionStore();
7178
7213
  const phoneNumber = formatPhone(phone);
7179
7214
  const { handleSubmit, hasError, errorText, isLoading, timeNextReq, isSubmitButtonDisabled, setTimeNextReq, setErrorText, } = useVerifyPhoneDialogSubmit({
7180
7215
  values,
7181
7216
  phoneNumber,
7182
7217
  onSuccess,
7183
7218
  onFail,
7219
+ productType,
7220
+ aspects,
7184
7221
  });
7185
- const captchaDialog = useDialog(CaptchaDialog);
7186
7222
  const restartTimer = useCountDownTimer({ seconds: timeNextReq, onTick: setTimeNextReq });
7187
- const handleSendCode = useCallback(async () => {
7188
- const response = await sendCode({
7189
- phoneNumber,
7190
- smsCodesSetName: { key: 'AUTHENTICATION' },
7191
- });
7192
- if (response.ok) {
7193
- setTimeNextReq(TIME_TO_RESEND);
7194
- restartTimer(TIME_TO_RESEND);
7195
- setErrorText('');
7196
- sessionStore.smsCode = getDefaultSmsCodeParams(phoneNumber);
7197
- }
7198
- else if (response.status === 429) {
7199
- captchaDialog.open({ phoneNumber, sendCode: handleSendCode });
7200
- }
7201
- else {
7202
- onFail();
7203
- }
7204
- }, [phoneNumber, restartTimer]);
7223
+ const { handleSendCode, sessionStore } = useSendCode({
7224
+ phoneNumber,
7225
+ restartTimer,
7226
+ setTimeNextReq,
7227
+ setErrorText,
7228
+ onFail,
7229
+ });
7205
7230
  useEffect(() => {
7206
7231
  if (!sessionStore.smsCode?.sendTime || sessionStore.smsCode?.phoneNumber !== phoneNumber) {
7207
7232
  handleSendCode();
@@ -7209,11 +7234,6 @@
7209
7234
  }, []);
7210
7235
  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$2(consents, withDescription) }));
7211
7236
  });
7212
- const getDefaultSmsCodeParams = (phoneNumber) => ({
7213
- sendTime: Date.now(),
7214
- attempts: 0,
7215
- phoneNumber: phoneNumber,
7216
- });
7217
7237
  const renderDescription$2 = (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;
7218
7238
 
7219
7239
  const defaultConsentText = {
@@ -7911,6 +7931,8 @@
7911
7931
  consents: acceptedConsents,
7912
7932
  onSuccess: handleSuccessVerify,
7913
7933
  onFail: handleFailSendForm,
7934
+ productType,
7935
+ aspects,
7914
7936
  });
7915
7937
  }
7916
7938
  catch {
@@ -7952,6 +7974,8 @@
7952
7974
  consents: acceptedConsents,
7953
7975
  onSuccess: handleSuccessVerify,
7954
7976
  onFail: handleFailSendForm,
7977
+ productType,
7978
+ aspects,
7955
7979
  });
7956
7980
  }
7957
7981
  catch {
@@ -8032,6 +8056,7 @@
8032
8056
  task,
8033
8057
  isFromLead: true,
8034
8058
  taskType: productTypeToTaskType(productType),
8059
+ isDebit: productType === 'debitCard',
8035
8060
  sendAspects,
8036
8061
  onClose: sendCurrentTask,
8037
8062
  });
@@ -8089,6 +8114,7 @@
8089
8114
  task,
8090
8115
  isFromLead: true,
8091
8116
  taskType: productTypeToTaskType(productType),
8117
+ isDebit: productType === 'debitCard',
8092
8118
  sendAspects,
8093
8119
  onClose: sendCurrentTask,
8094
8120
  });
@@ -10893,10 +10919,11 @@
10893
10919
  };
10894
10920
 
10895
10921
  const CREDIT_CARD_FORM_STEPS_ASPECTS = [
10896
- { ymTargetName: 'card_credit_calculator' },
10922
+ { ymTargetName: 'card_params' },
10897
10923
  { ymTargetName: 'card_app_personal_data' },
10898
10924
  { ymTargetName: 'card_app_work' },
10899
10925
  { ymTargetName: 'card_app_income' },
10926
+ { ymTargetName: 'card_bankrot' },
10900
10927
  { ymTargetName: 'card_app_bank_office' },
10901
10928
  ];
10902
10929
 
@@ -15129,7 +15156,7 @@
15129
15156
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
15130
15157
  });
15131
15158
 
15132
- const packageVersion = "0.14.1079";
15159
+ const packageVersion = "0.14.1080";
15133
15160
 
15134
15161
  exports.Blocks = Blocks;
15135
15162
  exports.ContentPage = ContentPage;