@redneckz/wildless-cms-uni-blocks 0.14.607 → 0.14.609

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 (143) hide show
  1. package/bundle/api/RetailAPI/updateUserProfile.d.ts +2 -0
  2. package/bundle/bundle.umd.js +101 -29
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/ui-kit/ConsentBkiDialog/ConsentBkiDialog.d.ts +5 -0
  5. package/bundle/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +3 -0
  6. package/bundle/ui-kit/DialogManager/openDocument.d.ts +2 -0
  7. package/bundle/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -1
  8. package/bundle/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.d.ts +2 -3
  9. package/bundle/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +1 -1
  10. package/dist/api/RetailAPI/updateUserProfile.d.ts +2 -0
  11. package/dist/api/RetailAPI/updateUserProfile.js +1 -1
  12. package/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
  13. package/dist/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  14. package/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  15. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  16. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  17. package/dist/ui-kit/Checkbox/CheckboxWithDoc.js +2 -7
  18. package/dist/ui-kit/Checkbox/CheckboxWithDoc.js.map +1 -1
  19. package/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.d.ts +5 -0
  20. package/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js +44 -0
  21. package/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js.map +1 -0
  22. package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +3 -0
  23. package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +49 -0
  24. package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -0
  25. package/dist/ui-kit/DialogManager/openDocument.d.ts +2 -0
  26. package/dist/ui-kit/DialogManager/openDocument.js +11 -0
  27. package/dist/ui-kit/DialogManager/openDocument.js.map +1 -0
  28. package/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -1
  29. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.d.ts +2 -3
  30. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js +2 -2
  31. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js.map +1 -1
  32. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +1 -1
  33. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +1 -1
  34. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  35. package/lib/api/RetailAPI/updateUserProfile.d.ts +2 -0
  36. package/lib/api/RetailAPI/updateUserProfile.js +1 -1
  37. package/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
  38. package/lib/common.css +1 -1
  39. package/lib/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  40. package/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  41. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  42. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  43. package/lib/ui-kit/Checkbox/CheckboxWithDoc.js +2 -7
  44. package/lib/ui-kit/Checkbox/CheckboxWithDoc.js.map +1 -1
  45. package/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.d.ts +5 -0
  46. package/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.fixture.d.ts +6 -0
  47. package/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js +42 -0
  48. package/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js.map +1 -0
  49. package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +3 -0
  50. package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +46 -0
  51. package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -0
  52. package/lib/ui-kit/DialogManager/openDocument.d.ts +2 -0
  53. package/lib/ui-kit/DialogManager/openDocument.js +8 -0
  54. package/lib/ui-kit/DialogManager/openDocument.js.map +1 -0
  55. package/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -1
  56. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.d.ts +2 -3
  57. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js +2 -2
  58. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js.map +1 -1
  59. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +1 -1
  60. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +1 -1
  61. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  62. package/mobile/bundle/api/RetailAPI/updateUserProfile.d.ts +2 -0
  63. package/mobile/bundle/bundle.umd.js +101 -29
  64. package/mobile/bundle/bundle.umd.min.js +1 -1
  65. package/mobile/bundle/ui-kit/ConsentBkiDialog/ConsentBkiDialog.d.ts +5 -0
  66. package/mobile/bundle/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +3 -0
  67. package/mobile/bundle/ui-kit/DialogManager/openDocument.d.ts +2 -0
  68. package/mobile/bundle/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -1
  69. package/mobile/bundle/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.d.ts +2 -3
  70. package/mobile/bundle/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +1 -1
  71. package/mobile/dist/api/RetailAPI/updateUserProfile.d.ts +2 -0
  72. package/mobile/dist/api/RetailAPI/updateUserProfile.js +1 -1
  73. package/mobile/dist/api/RetailAPI/updateUserProfile.js.map +1 -1
  74. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  75. package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  76. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  77. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  78. package/mobile/dist/ui-kit/Checkbox/CheckboxWithDoc.js +2 -7
  79. package/mobile/dist/ui-kit/Checkbox/CheckboxWithDoc.js.map +1 -1
  80. package/mobile/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.d.ts +5 -0
  81. package/mobile/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js +44 -0
  82. package/mobile/dist/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js.map +1 -0
  83. package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +3 -0
  84. package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +49 -0
  85. package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -0
  86. package/mobile/dist/ui-kit/DialogManager/openDocument.d.ts +2 -0
  87. package/mobile/dist/ui-kit/DialogManager/openDocument.js +11 -0
  88. package/mobile/dist/ui-kit/DialogManager/openDocument.js.map +1 -0
  89. package/mobile/dist/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -1
  90. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.d.ts +2 -3
  91. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js +2 -2
  92. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js.map +1 -1
  93. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +1 -1
  94. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +1 -1
  95. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  96. package/mobile/lib/api/RetailAPI/updateUserProfile.d.ts +2 -0
  97. package/mobile/lib/api/RetailAPI/updateUserProfile.js +1 -1
  98. package/mobile/lib/api/RetailAPI/updateUserProfile.js.map +1 -1
  99. package/mobile/lib/common.css +1 -1
  100. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js +1 -1
  101. package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
  102. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  103. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  104. package/mobile/lib/ui-kit/Checkbox/CheckboxWithDoc.js +2 -7
  105. package/mobile/lib/ui-kit/Checkbox/CheckboxWithDoc.js.map +1 -1
  106. package/mobile/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.d.ts +5 -0
  107. package/mobile/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js +42 -0
  108. package/mobile/lib/ui-kit/ConsentBkiDialog/ConsentBkiDialog.js.map +1 -0
  109. package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.d.ts +3 -0
  110. package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +46 -0
  111. package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -0
  112. package/mobile/lib/ui-kit/DialogManager/openDocument.d.ts +2 -0
  113. package/mobile/lib/ui-kit/DialogManager/openDocument.js +8 -0
  114. package/mobile/lib/ui-kit/DialogManager/openDocument.js.map +1 -0
  115. package/mobile/lib/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.d.ts +1 -1
  116. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.d.ts +2 -3
  117. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js +2 -2
  118. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.js.map +1 -1
  119. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.d.ts +1 -1
  120. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +1 -1
  121. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  122. package/mobile/src/api/RetailAPI/updateUserProfile.ts +3 -1
  123. package/mobile/src/components/ApplicationLeadForm/GroupedConsents.tsx +1 -1
  124. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +12 -7
  125. package/mobile/src/ui-kit/Checkbox/CheckboxWithDoc.tsx +2 -16
  126. package/mobile/src/ui-kit/ConsentBkiDialog/ConsentBkiDialog.tsx +73 -0
  127. package/mobile/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +58 -0
  128. package/mobile/src/ui-kit/DialogManager/openDocument.tsx +13 -0
  129. package/mobile/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.tsx +1 -1
  130. package/mobile/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.tsx +4 -4
  131. package/mobile/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +2 -2
  132. package/package.json +1 -1
  133. package/src/api/RetailAPI/updateUserProfile.ts +3 -1
  134. package/src/components/ApplicationLeadForm/GroupedConsents.tsx +1 -1
  135. package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +12 -7
  136. package/src/ui-kit/Checkbox/CheckboxWithDoc.tsx +2 -16
  137. package/src/ui-kit/ConsentBkiDialog/ConsentBkiDialog.fixture.tsx +7 -0
  138. package/src/ui-kit/ConsentBkiDialog/ConsentBkiDialog.tsx +73 -0
  139. package/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +58 -0
  140. package/src/ui-kit/DialogManager/openDocument.tsx +13 -0
  141. package/src/ui-kit/VerifyPhoneDialog/VerifyPhoneDialog.tsx +1 -1
  142. package/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialog.tsx +4 -4
  143. package/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +2 -2
@@ -1999,17 +1999,6 @@
1999
1999
  },
2000
2000
  };
2001
2001
 
2002
- const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
2003
-
2004
- const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
2005
- const { close } = useDialogManager();
2006
- const handleClose = useCallback(() => {
2007
- close();
2008
- onClose && onClose();
2009
- }, [onClose]);
2010
- return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
2011
- });
2012
-
2013
2002
  async function doRequest(url, method, body) {
2014
2003
  const response = await fetch(`${API_BASE_URI}${url}`, {
2015
2004
  method,
@@ -2039,16 +2028,28 @@
2039
2028
  return URL.createObjectURL(response);
2040
2029
  };
2041
2030
 
2042
- const OPEN_DOC_BUTTON_TEXT = 'Ознакомиться';
2043
- const CheckboxWithDoc = JSX(({ className, error, docId, ...props }) => {
2044
- const { open } = useDialogManager();
2045
- return (jsxs("div", { className: className, children: [jsxs("div", { className: "flex flex-wrap gap-x-m", children: [jsx(Checkbox, { ...props }), docId ? (jsx(LinkButton, { className: "text-primary-main", onClick: () => handleOpenDocument(docId, open), children: jsx(Text, { children: OPEN_DOC_BUTTON_TEXT }) })) : null] }), renderErrorText(error)] }));
2031
+ const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
2032
+
2033
+ const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
2034
+ const { close } = useDialogManager();
2035
+ const handleClose = useCallback(() => {
2036
+ close();
2037
+ onClose && onClose();
2038
+ }, [onClose]);
2039
+ return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
2046
2040
  });
2047
- const handleOpenDocument = async (id, open) => {
2041
+
2042
+ const openDocument = async (id, open) => {
2048
2043
  const document = await getDocument(id);
2049
2044
  open(jsx(Dialog, { className: "my-6xl max-w-4xl mx-auto px-0 min-h-0 pb-0", children: jsx("iframe", { src: `${document}#toolbar=0`, className: "w-full h-[80vh]", id: "iframe-dialog" }) }));
2050
2045
  };
2051
2046
 
2047
+ const OPEN_DOC_BUTTON_TEXT = 'Ознакомиться';
2048
+ const CheckboxWithDoc = JSX(({ className, error, docId, ...props }) => {
2049
+ const { open } = useDialogManager();
2050
+ return (jsxs("div", { className: className, children: [jsxs("div", { className: "flex flex-wrap gap-x-m", children: [jsx(Checkbox, { ...props }), docId ? (jsx(LinkButton, { className: "text-primary-main", onClick: () => openDocument(docId, open), children: jsx(Text, { children: OPEN_DOC_BUTTON_TEXT }) })) : null] }), renderErrorText(error)] }));
2051
+ });
2052
+
2052
2053
  const ConsentField = JSX(({ field, input }) => input && input.name ? (jsx(CheckboxWithDoc, { text: CONSENTS[input.name]?.text, docId: CONSENTS[input.name]?.docId, ...getValidation(field(input.name), validatorObj[input.name], input?.required) })) : null);
2053
2054
 
2054
2055
  const LABEL_TEXT =
@@ -2723,7 +2724,7 @@
2723
2724
  ?.some((_) => Boolean(withValidator(field(_?.name), validatorObj[_?.name]).error)), [inputs]);
2724
2725
  return (jsx("div", { className: "w-fit", children: jsx(Foldable, { isFoldButtonOnTop: true, unfoldedByDefault: true, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { isUnfolded: isUnfolded, className: "flex flex-col pl-2xl", children: inputs.map(getField(field, typeForm)) })), renderFoldButton: renderGeneralCheckbox(jsxs("div", { children: [jsx(Checkbox, { value: isChecked, onChange: handleGeneralToggle, text: CONSENT_ALL_DOCS_TEXT }, key), renderErrorText(hasValidationErrors ? CONSENT_REQUIRED : '')] })) }) }));
2725
2726
  });
2726
- const renderGeneralCheckbox = (generalCheckBox) => (foldableData) => (jsxs("div", { className: "flex items-start", children: [generalCheckBox, jsx("button", { onClick: foldableData.onToggle, className: "px-m py-2xs", children: jsx(Icon, { className: "text-primary-text", name: foldableData.isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" }) })] }));
2727
+ const renderGeneralCheckbox = (generalCheckBox) => (foldableData) => (jsxs("div", { className: "flex items-start", children: [generalCheckBox, jsx("button", { onClick: foldableData.onToggle, className: "px-m py-2xs", type: "button", children: jsx(Icon, { className: "text-primary-text", name: foldableData.isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" }) })] }));
2727
2728
 
2728
2729
  const renderInputs = ({ field, typeForm = '', inputs }) => {
2729
2730
  const { consentInputs, restInputs } = splitInputs(inputs || []);
@@ -2785,7 +2786,7 @@
2785
2786
 
2786
2787
  const createUserProfile = (body) => doRequest('/public-data/createUserProfile', 'POST', body);
2787
2788
 
2788
- const updateUserProfile = (body) => doRequest('/user-data/updateUserProfile', 'POST', body);
2789
+ const updateUserProfile = (body) => doRequest('/user-data/updateUserProfile', 'PUT', body);
2789
2790
 
2790
2791
  const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
2791
2792
 
@@ -3036,7 +3037,7 @@
3036
3037
  smsCodesSetName: { key: 'AUTHENTICATION' },
3037
3038
  });
3038
3039
  resetError();
3039
- close && close();
3040
+ close && close(values.join(''));
3040
3041
  }
3041
3042
  catch {
3042
3043
  setIsLoading(false);
@@ -3087,19 +3088,92 @@
3087
3088
  const renderTextButton = (textButton, isDisabled, handleSubmit) => textButton ? (jsx(SubmitButton, { isDisabled: isDisabled, onClick: handleSubmit, text: textButton })) : null;
3088
3089
  const renderText$2 = (timeNextReq, setTimeNextReq, sendCode) => timeNextReq ? (jsxs("div", { className: "flex flex-row text-l font-light text-primary-main", 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, { className: "text-primary-main ml-1", time: timeNextReq, setTime: setTimeNextReq })] })) : (jsx(LinkButton, { onClick: sendCode, className: "text-primary-main", children: "\u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u043A\u043E\u0434" }));
3089
3090
 
3090
- const useVerifyPhoneDialog = (props) => {
3091
+ const useVerifyPhoneDialog = () => {
3091
3092
  const { open, close } = useDialogManager();
3092
3093
  return {
3093
- open: (options = {}) => open(jsx(VerifyPhoneDialog, { onClose: close, ...props }), options),
3094
+ open: (handleClose, props) => open(jsx(VerifyPhoneDialog, { onClose: close, close: handleClose, ...props })),
3094
3095
  close,
3095
3096
  };
3096
3097
  };
3097
3098
 
3099
+ const defaultConsentText = {
3100
+ title: 'Подпишите согласие на запрос в БКИ',
3101
+ description: 'Согласие на запрос в Бюро кредитных историй (БКИ) ускорит решение по кредиту',
3102
+ };
3103
+ const refuseConsentText = {
3104
+ title: 'Вы уверены, что хотите отказаться от запроса в БКИ',
3105
+ description: 'Согласие на запрос в Бюро кредитных историй (БКИ) повысит вероятность одобрения',
3106
+ };
3107
+ const ConsentBkiDialog = JSX(function ({ handleSubmit = noop, onClose = noop, }) {
3108
+ const [confirmStatus, setConfirmStatus] = useState('');
3109
+ const [showRefuceContent, setShowRefuceContent] = useState(false);
3110
+ const { open, close } = useDialogManager();
3111
+ const handleClose = useCallback(() => {
3112
+ close();
3113
+ handleSubmit(confirmStatus);
3114
+ }, [confirmStatus]);
3115
+ const handleConfirmChange = useCallback((value) => {
3116
+ setConfirmStatus(value);
3117
+ if (value === 'REFUSE') {
3118
+ setShowRefuceContent(true);
3119
+ }
3120
+ }, []);
3121
+ const consentText = showRefuceContent ? refuseConsentText : defaultConsentText;
3122
+ return (jsx(Dialog, { className: "my-6xl max-w-3xl w-full min-h-fit mx-auto rounded-lg", onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center", children: [jsx("div", { role: "button", onClick: () => openDocument(CONSENT_BKI_ID, open), children: jsx(Heading, { className: "text-center text-balance", title: consentText.title }) }), jsx(Paragraph, { align: "text-center", children: consentText.description }), jsx(RadioButtonGroup, { className: "whitespace-normal", orientation: "horizontal", items: ITEMS$1, value: confirmStatus, onChange: handleConfirmChange }), jsx(Button, { disabled: !confirmStatus, type: "button", onClick: handleClose, children: "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C" })] }) }));
3123
+ });
3124
+ const ITEMS$1 = [
3125
+ { id: 'SIGNED', text: 'Подписать' },
3126
+ { id: 'REFUSE', text: 'Отказаться' },
3127
+ ];
3128
+ const CONSENT_BKI_ID = 2;
3129
+
3130
+ const useConsentBkiDialog = () => {
3131
+ const { open, closeAll } = useDialogManager();
3132
+ const verifyPhoneDialog = useVerifyPhoneDialog();
3133
+ const redirectToCreditForm = () => {
3134
+ globalThis.location.href = '/credit-lead';
3135
+ };
3136
+ const handleSuccessVerify = (profileId) => async (smsCode) => {
3137
+ if (profileId) {
3138
+ await updateUserProfile({
3139
+ profile: {
3140
+ id: profileId,
3141
+ consentBkiFlg: true,
3142
+ smsConsentBki: smsCode,
3143
+ },
3144
+ });
3145
+ }
3146
+ redirectToCreditForm();
3147
+ };
3148
+ const handleSubmitBkiConstent = (phone, profileId) => async (confirmStatus) => {
3149
+ await closeAll();
3150
+ if (confirmStatus === 'SIGNED' && phone) {
3151
+ verifyPhoneDialog.open(handleSuccessVerify(profileId), verifyPhoneContent$1(phone));
3152
+ }
3153
+ else {
3154
+ redirectToCreditForm();
3155
+ }
3156
+ };
3157
+ return {
3158
+ open: (phone, profileId) => open(jsx(ConsentBkiDialog, { handleSubmit: handleSubmitBkiConstent(phone, profileId), onClose: redirectToCreditForm })),
3159
+ };
3160
+ };
3161
+ const verifyPhoneContent$1 = (phone) => ({
3162
+ title: 'Подтвердите номер телефона',
3163
+ description: `Мы отправили код на ${phone}`,
3164
+ phoneNumber: formatPhone(phone),
3165
+ textButton: 'Отправить',
3166
+ __html: `<span>Вводя код, я подтверждаю, что ознакомлен и подписываю:</span>
3167
+ <ul><li>согласие на запрос информации в БКИ</li></ul>`,
3168
+ });
3169
+
3098
3170
  const useApplicationLeadApi = ({ inputs, programId, saveForm }) => {
3099
3171
  const [responseStatus, setResponseStatus] = useState('');
3100
3172
  const [, setTaskId] = useLocalStorage('taskId');
3101
3173
  const [, setProfileId] = useLocalStorage('profileId');
3102
3174
  const [, setParticipantId] = useLocalStorage('participantId');
3175
+ const consentBkiDialog = useConsentBkiDialog();
3176
+ const verifyPhoneDialog = useVerifyPhoneDialog();
3103
3177
  const saveUserData = useCallback((participantId, taskId, profileId) => {
3104
3178
  setParticipantId(participantId);
3105
3179
  setTaskId(taskId);
@@ -3133,21 +3207,19 @@
3133
3207
  }));
3134
3208
  saveUserData(participantId, taskId, profileId);
3135
3209
  saveForm(JSON.stringify(formData));
3136
- globalThis.location.href = '/credit-lead';
3137
3210
  }
3138
3211
  catch {
3139
3212
  setResponseStatus('Fail');
3140
3213
  }
3141
3214
  };
3215
+ const handleCloseVerify = async () => {
3216
+ await handleSuccessVerify();
3217
+ consentBkiDialog.open(formData.phone, profileId);
3218
+ };
3142
3219
  const acceptedConsents = Object.keys(CONSENTS)
3143
3220
  .filter((_) => formData[_])
3144
3221
  .map((_) => CONSENTS[_]?.text);
3145
- // eslint-disable-next-line react-hooks/rules-of-hooks
3146
- const verifyPhoneDialog = useVerifyPhoneDialog({
3147
- close: handleSuccessVerify,
3148
- ...verifyPhoneContent(formData?.phone, acceptedConsents),
3149
- });
3150
- verifyPhoneDialog.open();
3222
+ verifyPhoneDialog.open(handleCloseVerify, verifyPhoneContent(formData?.phone, acceptedConsents));
3151
3223
  }
3152
3224
  }
3153
3225
  catch {
@@ -7516,7 +7588,7 @@
7516
7588
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
7517
7589
  });
7518
7590
 
7519
- const packageVersion = "0.14.606";
7591
+ const packageVersion = "0.14.608";
7520
7592
 
7521
7593
  exports.Blocks = Blocks;
7522
7594
  exports.ContentPage = ContentPage;