@redneckz/wildless-cms-uni-blocks 0.14.700 → 0.14.701

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 (193) hide show
  1. package/bundle/api/RetailAPI/draftTasksKZO.d.ts +26 -0
  2. package/bundle/api/RetailAPI/getLastTaskStatus.d.ts +6 -0
  3. package/bundle/api/RetailAPI/getTaskById.d.ts +6 -0
  4. package/bundle/api/RetailAPI/updateUserTask.d.ts +8 -8
  5. package/bundle/bundle.umd.js +252 -30
  6. package/bundle/bundle.umd.min.js +1 -1
  7. package/bundle/components/ApplicationLeadForm/LeadFormState.d.ts +6 -6
  8. package/bundle/components/ApplicationLeadForm/useSaveUserData.d.ts +9 -0
  9. package/bundle/ui-kit/DraftDialog/DraftActionButton.d.ts +7 -0
  10. package/bundle/ui-kit/DraftDialog/DraftDialog.d.ts +7 -0
  11. package/bundle/ui-kit/DraftDialog/EmptyDraftDialog.d.ts +4 -0
  12. package/bundle/ui-kit/DraftDialog/parseDraftTask.d.ts +3 -0
  13. package/bundle/ui-kit/DraftDialog/useDraftDialog.d.ts +10 -0
  14. package/bundle/ui-kit/DraftDialog/utils.d.ts +138 -0
  15. package/dist/api/RetailAPI/draftTasksKZO.d.ts +26 -0
  16. package/dist/api/RetailAPI/draftTasksKZO.js +9 -0
  17. package/dist/api/RetailAPI/draftTasksKZO.js.map +1 -0
  18. package/dist/api/RetailAPI/getLastTaskStatus.d.ts +6 -0
  19. package/dist/api/RetailAPI/getLastTaskStatus.js +9 -0
  20. package/dist/api/RetailAPI/getLastTaskStatus.js.map +1 -0
  21. package/dist/api/RetailAPI/getTaskById.d.ts +6 -0
  22. package/dist/api/RetailAPI/getTaskById.js +9 -0
  23. package/dist/api/RetailAPI/getTaskById.js.map +1 -0
  24. package/dist/api/RetailAPI/updateUserTask.d.ts +8 -8
  25. package/dist/components/ApplicationLeadForm/LeadFormState.d.ts +6 -6
  26. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +32 -21
  27. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  28. package/dist/components/ApplicationLeadForm/useSaveUserData.d.ts +9 -0
  29. package/dist/components/ApplicationLeadForm/useSaveUserData.js +19 -0
  30. package/dist/components/ApplicationLeadForm/useSaveUserData.js.map +1 -0
  31. package/dist/ui-kit/DraftDialog/DraftActionButton.d.ts +7 -0
  32. package/dist/ui-kit/DraftDialog/DraftActionButton.js +10 -0
  33. package/dist/ui-kit/DraftDialog/DraftActionButton.js.map +1 -0
  34. package/dist/ui-kit/DraftDialog/DraftDialog.d.ts +7 -0
  35. package/dist/ui-kit/DraftDialog/DraftDialog.js +43 -0
  36. package/dist/ui-kit/DraftDialog/DraftDialog.js.map +1 -0
  37. package/dist/ui-kit/DraftDialog/EmptyDraftDialog.d.ts +4 -0
  38. package/dist/ui-kit/DraftDialog/EmptyDraftDialog.js +22 -0
  39. package/dist/ui-kit/DraftDialog/EmptyDraftDialog.js.map +1 -0
  40. package/dist/ui-kit/DraftDialog/parseDraftTask.d.ts +3 -0
  41. package/dist/ui-kit/DraftDialog/parseDraftTask.js +65 -0
  42. package/dist/ui-kit/DraftDialog/parseDraftTask.js.map +1 -0
  43. package/dist/ui-kit/DraftDialog/useDraftDialog.d.ts +10 -0
  44. package/dist/ui-kit/DraftDialog/useDraftDialog.js +16 -0
  45. package/dist/ui-kit/DraftDialog/useDraftDialog.js.map +1 -0
  46. package/dist/ui-kit/DraftDialog/utils.d.ts +138 -0
  47. package/dist/ui-kit/DraftDialog/utils.js +85 -0
  48. package/dist/ui-kit/DraftDialog/utils.js.map +1 -0
  49. package/lib/api/RetailAPI/draftTasksKZO.d.ts +26 -0
  50. package/lib/api/RetailAPI/draftTasksKZO.js +6 -0
  51. package/lib/api/RetailAPI/draftTasksKZO.js.map +1 -0
  52. package/lib/api/RetailAPI/getLastTaskStatus.d.ts +6 -0
  53. package/lib/api/RetailAPI/getLastTaskStatus.js +6 -0
  54. package/lib/api/RetailAPI/getLastTaskStatus.js.map +1 -0
  55. package/lib/api/RetailAPI/getTaskById.d.ts +6 -0
  56. package/lib/api/RetailAPI/getTaskById.js +6 -0
  57. package/lib/api/RetailAPI/getTaskById.js.map +1 -0
  58. package/lib/api/RetailAPI/updateUserTask.d.ts +8 -8
  59. package/lib/common.css +1 -1
  60. package/lib/components/ApplicationLeadForm/LeadFormState.d.ts +6 -6
  61. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +32 -21
  62. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  63. package/lib/components/ApplicationLeadForm/useSaveUserData.d.ts +9 -0
  64. package/lib/components/ApplicationLeadForm/useSaveUserData.js +16 -0
  65. package/lib/components/ApplicationLeadForm/useSaveUserData.js.map +1 -0
  66. package/lib/ui-kit/DraftDialog/DraftActionButton.d.ts +7 -0
  67. package/lib/ui-kit/DraftDialog/DraftActionButton.js +8 -0
  68. package/lib/ui-kit/DraftDialog/DraftActionButton.js.map +1 -0
  69. package/lib/ui-kit/DraftDialog/DraftDialog.d.ts +7 -0
  70. package/lib/ui-kit/DraftDialog/DraftDialog.js +41 -0
  71. package/lib/ui-kit/DraftDialog/DraftDialog.js.map +1 -0
  72. package/lib/ui-kit/DraftDialog/EmptyDraftDialog.d.ts +4 -0
  73. package/lib/ui-kit/DraftDialog/EmptyDraftDialog.js +20 -0
  74. package/lib/ui-kit/DraftDialog/EmptyDraftDialog.js.map +1 -0
  75. package/lib/ui-kit/DraftDialog/parseDraftTask.d.ts +3 -0
  76. package/lib/ui-kit/DraftDialog/parseDraftTask.js +62 -0
  77. package/lib/ui-kit/DraftDialog/parseDraftTask.js.map +1 -0
  78. package/lib/ui-kit/DraftDialog/useDraftDialog.d.ts +10 -0
  79. package/lib/ui-kit/DraftDialog/useDraftDialog.js +13 -0
  80. package/lib/ui-kit/DraftDialog/useDraftDialog.js.map +1 -0
  81. package/lib/ui-kit/DraftDialog/utils.d.ts +138 -0
  82. package/lib/ui-kit/DraftDialog/utils.js +78 -0
  83. package/lib/ui-kit/DraftDialog/utils.js.map +1 -0
  84. package/mobile/bundle/api/RetailAPI/draftTasksKZO.d.ts +26 -0
  85. package/mobile/bundle/api/RetailAPI/getLastTaskStatus.d.ts +6 -0
  86. package/mobile/bundle/api/RetailAPI/getTaskById.d.ts +6 -0
  87. package/mobile/bundle/api/RetailAPI/updateUserTask.d.ts +8 -8
  88. package/mobile/bundle/bundle.umd.js +252 -30
  89. package/mobile/bundle/bundle.umd.min.js +1 -1
  90. package/mobile/bundle/components/ApplicationLeadForm/LeadFormState.d.ts +6 -6
  91. package/mobile/bundle/components/ApplicationLeadForm/useSaveUserData.d.ts +9 -0
  92. package/mobile/bundle/ui-kit/DraftDialog/DraftActionButton.d.ts +7 -0
  93. package/mobile/bundle/ui-kit/DraftDialog/DraftDialog.d.ts +7 -0
  94. package/mobile/bundle/ui-kit/DraftDialog/EmptyDraftDialog.d.ts +4 -0
  95. package/mobile/bundle/ui-kit/DraftDialog/parseDraftTask.d.ts +3 -0
  96. package/mobile/bundle/ui-kit/DraftDialog/useDraftDialog.d.ts +10 -0
  97. package/mobile/bundle/ui-kit/DraftDialog/utils.d.ts +138 -0
  98. package/mobile/dist/api/RetailAPI/draftTasksKZO.d.ts +26 -0
  99. package/mobile/dist/api/RetailAPI/draftTasksKZO.js +9 -0
  100. package/mobile/dist/api/RetailAPI/draftTasksKZO.js.map +1 -0
  101. package/mobile/dist/api/RetailAPI/getLastTaskStatus.d.ts +6 -0
  102. package/mobile/dist/api/RetailAPI/getLastTaskStatus.js +9 -0
  103. package/mobile/dist/api/RetailAPI/getLastTaskStatus.js.map +1 -0
  104. package/mobile/dist/api/RetailAPI/getTaskById.d.ts +6 -0
  105. package/mobile/dist/api/RetailAPI/getTaskById.js +9 -0
  106. package/mobile/dist/api/RetailAPI/getTaskById.js.map +1 -0
  107. package/mobile/dist/api/RetailAPI/updateUserTask.d.ts +8 -8
  108. package/mobile/dist/components/ApplicationLeadForm/LeadFormState.d.ts +6 -6
  109. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +32 -21
  110. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  111. package/mobile/dist/components/ApplicationLeadForm/useSaveUserData.d.ts +9 -0
  112. package/mobile/dist/components/ApplicationLeadForm/useSaveUserData.js +19 -0
  113. package/mobile/dist/components/ApplicationLeadForm/useSaveUserData.js.map +1 -0
  114. package/mobile/dist/ui-kit/DraftDialog/DraftActionButton.d.ts +7 -0
  115. package/mobile/dist/ui-kit/DraftDialog/DraftActionButton.js +10 -0
  116. package/mobile/dist/ui-kit/DraftDialog/DraftActionButton.js.map +1 -0
  117. package/mobile/dist/ui-kit/DraftDialog/DraftDialog.d.ts +7 -0
  118. package/mobile/dist/ui-kit/DraftDialog/DraftDialog.js +43 -0
  119. package/mobile/dist/ui-kit/DraftDialog/DraftDialog.js.map +1 -0
  120. package/mobile/dist/ui-kit/DraftDialog/EmptyDraftDialog.d.ts +4 -0
  121. package/mobile/dist/ui-kit/DraftDialog/EmptyDraftDialog.js +22 -0
  122. package/mobile/dist/ui-kit/DraftDialog/EmptyDraftDialog.js.map +1 -0
  123. package/mobile/dist/ui-kit/DraftDialog/parseDraftTask.d.ts +3 -0
  124. package/mobile/dist/ui-kit/DraftDialog/parseDraftTask.js +65 -0
  125. package/mobile/dist/ui-kit/DraftDialog/parseDraftTask.js.map +1 -0
  126. package/mobile/dist/ui-kit/DraftDialog/useDraftDialog.d.ts +10 -0
  127. package/mobile/dist/ui-kit/DraftDialog/useDraftDialog.js +16 -0
  128. package/mobile/dist/ui-kit/DraftDialog/useDraftDialog.js.map +1 -0
  129. package/mobile/dist/ui-kit/DraftDialog/utils.d.ts +138 -0
  130. package/mobile/dist/ui-kit/DraftDialog/utils.js +85 -0
  131. package/mobile/dist/ui-kit/DraftDialog/utils.js.map +1 -0
  132. package/mobile/lib/api/RetailAPI/draftTasksKZO.d.ts +26 -0
  133. package/mobile/lib/api/RetailAPI/draftTasksKZO.js +6 -0
  134. package/mobile/lib/api/RetailAPI/draftTasksKZO.js.map +1 -0
  135. package/mobile/lib/api/RetailAPI/getLastTaskStatus.d.ts +6 -0
  136. package/mobile/lib/api/RetailAPI/getLastTaskStatus.js +6 -0
  137. package/mobile/lib/api/RetailAPI/getLastTaskStatus.js.map +1 -0
  138. package/mobile/lib/api/RetailAPI/getTaskById.d.ts +6 -0
  139. package/mobile/lib/api/RetailAPI/getTaskById.js +6 -0
  140. package/mobile/lib/api/RetailAPI/getTaskById.js.map +1 -0
  141. package/mobile/lib/api/RetailAPI/updateUserTask.d.ts +8 -8
  142. package/mobile/lib/common.css +1 -1
  143. package/mobile/lib/components/ApplicationLeadForm/LeadFormState.d.ts +6 -6
  144. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +32 -21
  145. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  146. package/mobile/lib/components/ApplicationLeadForm/useSaveUserData.d.ts +9 -0
  147. package/mobile/lib/components/ApplicationLeadForm/useSaveUserData.js +16 -0
  148. package/mobile/lib/components/ApplicationLeadForm/useSaveUserData.js.map +1 -0
  149. package/mobile/lib/ui-kit/DraftDialog/DraftActionButton.d.ts +7 -0
  150. package/mobile/lib/ui-kit/DraftDialog/DraftActionButton.js +8 -0
  151. package/mobile/lib/ui-kit/DraftDialog/DraftActionButton.js.map +1 -0
  152. package/mobile/lib/ui-kit/DraftDialog/DraftDialog.d.ts +7 -0
  153. package/mobile/lib/ui-kit/DraftDialog/DraftDialog.js +41 -0
  154. package/mobile/lib/ui-kit/DraftDialog/DraftDialog.js.map +1 -0
  155. package/mobile/lib/ui-kit/DraftDialog/EmptyDraftDialog.d.ts +4 -0
  156. package/mobile/lib/ui-kit/DraftDialog/EmptyDraftDialog.js +20 -0
  157. package/mobile/lib/ui-kit/DraftDialog/EmptyDraftDialog.js.map +1 -0
  158. package/mobile/lib/ui-kit/DraftDialog/parseDraftTask.d.ts +3 -0
  159. package/mobile/lib/ui-kit/DraftDialog/parseDraftTask.js +62 -0
  160. package/mobile/lib/ui-kit/DraftDialog/parseDraftTask.js.map +1 -0
  161. package/mobile/lib/ui-kit/DraftDialog/useDraftDialog.d.ts +10 -0
  162. package/mobile/lib/ui-kit/DraftDialog/useDraftDialog.js +13 -0
  163. package/mobile/lib/ui-kit/DraftDialog/useDraftDialog.js.map +1 -0
  164. package/mobile/lib/ui-kit/DraftDialog/utils.d.ts +138 -0
  165. package/mobile/lib/ui-kit/DraftDialog/utils.js +78 -0
  166. package/mobile/lib/ui-kit/DraftDialog/utils.js.map +1 -0
  167. package/mobile/src/api/RetailAPI/draftTasksKZO.ts +33 -0
  168. package/mobile/src/api/RetailAPI/getLastTaskStatus.ts +21 -0
  169. package/mobile/src/api/RetailAPI/getTaskById.ts +12 -0
  170. package/mobile/src/api/RetailAPI/updateUserTask.ts +8 -8
  171. package/mobile/src/components/ApplicationLeadForm/LeadFormState.ts +6 -6
  172. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +31 -33
  173. package/mobile/src/components/ApplicationLeadForm/useSaveUserData.ts +29 -0
  174. package/mobile/src/ui-kit/DraftDialog/DraftActionButton.tsx +32 -0
  175. package/mobile/src/ui-kit/DraftDialog/DraftDialog.tsx +91 -0
  176. package/mobile/src/ui-kit/DraftDialog/EmptyDraftDialog.tsx +47 -0
  177. package/mobile/src/ui-kit/DraftDialog/parseDraftTask.ts +123 -0
  178. package/mobile/src/ui-kit/DraftDialog/useDraftDialog.tsx +21 -0
  179. package/mobile/src/ui-kit/DraftDialog/utils.ts +148 -0
  180. package/package.json +1 -1
  181. package/src/api/RetailAPI/draftTasksKZO.ts +33 -0
  182. package/src/api/RetailAPI/getLastTaskStatus.ts +21 -0
  183. package/src/api/RetailAPI/getTaskById.ts +12 -0
  184. package/src/api/RetailAPI/updateUserTask.ts +8 -8
  185. package/src/components/ApplicationLeadForm/LeadFormState.ts +6 -6
  186. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +31 -33
  187. package/src/components/ApplicationLeadForm/useSaveUserData.ts +29 -0
  188. package/src/ui-kit/DraftDialog/DraftActionButton.tsx +32 -0
  189. package/src/ui-kit/DraftDialog/DraftDialog.tsx +91 -0
  190. package/src/ui-kit/DraftDialog/EmptyDraftDialog.tsx +47 -0
  191. package/src/ui-kit/DraftDialog/parseDraftTask.ts +123 -0
  192. package/src/ui-kit/DraftDialog/useDraftDialog.tsx +21 -0
  193. package/src/ui-kit/DraftDialog/utils.ts +148 -0
@@ -4457,6 +4457,16 @@
4457
4457
 
4458
4458
  const createUserProfile = (body) => fetchRetailJSON('/public-data/createUserProfile', 'POST', body).then((res) => res?.profile?.id || null);
4459
4459
 
4460
+ const getLastTaskStatus = async (body) => {
4461
+ const res = await fetchRetailJSON('/user-data/getLastStatus', 'POST', body);
4462
+ return res?.statusCd === 'DRAFT' ? res?.taskId : null;
4463
+ };
4464
+
4465
+ const getTaskById = async (body) => {
4466
+ const res = await fetchRetailJSON('/user-data/getTaskById', 'POST', body);
4467
+ return res || undefined;
4468
+ };
4469
+
4460
4470
  const updateUserProfile = (body) => doRequest('/user-data/updateUserProfile', 'PUT', body);
4461
4471
 
4462
4472
  const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
@@ -4484,16 +4494,6 @@
4484
4494
  };
4485
4495
  };
4486
4496
 
4487
- const useSetter = (target, key) => useCallback((value) => {
4488
- const newValue = value instanceof Function ? value(target[key]) : value;
4489
- if (newValue !== null && newValue !== undefined) {
4490
- target[key] = newValue;
4491
- }
4492
- else {
4493
- delete target[key];
4494
- }
4495
- }, [target, key]);
4496
-
4497
4497
  const sendCode = (body) => fetchRetailJSON('/sms/sendCode', 'POST', body).then((res) => !isErrorResult(res, body.phoneNumber));
4498
4498
  const isErrorResult = (res, phoneNumber) => Boolean(res) &&
4499
4499
  typeof res !== 'string' &&
@@ -4767,6 +4767,208 @@
4767
4767
  };
4768
4768
  };
4769
4769
 
4770
+ const useLeadFormStore = () => useLocalStore();
4771
+
4772
+ const useSetter = (target, key) => useCallback((value) => {
4773
+ const newValue = value instanceof Function ? value(target[key]) : value;
4774
+ if (newValue !== null && newValue !== undefined) {
4775
+ target[key] = newValue;
4776
+ }
4777
+ else {
4778
+ delete target[key];
4779
+ }
4780
+ }, [target, key]);
4781
+
4782
+ const DraftActionButton = JSX(({ title, icon, description, onClick = noop }) => (jsxs("button", { className: "flex gap-lg items-center border border-gray rounded-md cursor-pointer p-4 hover:border-green", type: "button", onClick: onClick, children: [jsx(Img, { image: { src: icon }, width: "78", height: "78" }), jsxs("div", { children: [jsx(Heading, { className: "text-left", title: title, headingType: "h5" }), description ? (jsx(Paragraph, { color: "text-secondary-text", size: "text-m", children: description })) : null] })] })));
4783
+
4784
+ const creditCodesToProgrammIdMap = {
4785
+ credit_cash: '10',
4786
+ credit_cash_single_doc: '28',
4787
+ credit_mcx: '39',
4788
+ family_offer_credit: '41',
4789
+ gas_engine_fuel: '33',
4790
+ pension_credit: '12',
4791
+ ref_credit: '11',
4792
+ ref_credit_single_doc: '29',
4793
+ self_employed: '34',
4794
+ summer_cash: '35',
4795
+ summer_cash_pens: '36',
4796
+ };
4797
+ const cardCodesToProgrammIdMap = {
4798
+ amur_card: '14',
4799
+ owner_card: '13',
4800
+ travel_card: '15',
4801
+ };
4802
+ const creditProgramCodeToProductIdMap = {
4803
+ ...creditCodesToProgrammIdMap,
4804
+ ...cardCodesToProgrammIdMap,
4805
+ };
4806
+ const getParticipantIncomes$1 = (participantIncomes) => {
4807
+ const wages = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "WAGES" /* EIncomesType.WAGES */)?.value;
4808
+ const mandatoryPayments = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "MANDATORY_PAYMENTS" /* EIncomesType.MANDATORY_PAYMENTS */)?.value;
4809
+ const incomeAverage = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "INCOME_AVERAGE" /* EIncomesType.INCOME_AVERAGE */)?.value;
4810
+ const additionalIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "ADDITIONAL_INCOME" /* EIncomesType.ADDITIONAL_INCOME */)?.value;
4811
+ const otherIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "OTHER_INCOME" /* EIncomesType.OTHER_INCOME */)?.value;
4812
+ const otherPayments = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "OTHER_PAYMENTS" /* EIncomesType.OTHER_PAYMENTS */)?.value;
4813
+ const rentalIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "RENTAL_INCOME" /* EIncomesType.RENTAL_INCOME */)?.value;
4814
+ const retirementIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "RETIREMENT_INCOME" /* EIncomesType.RETIREMENT_INCOME */)?.value;
4815
+ return {
4816
+ wages,
4817
+ mandatoryPayments,
4818
+ incomeAverage,
4819
+ additionalIncome,
4820
+ otherIncome,
4821
+ otherPayments,
4822
+ rentalIncome,
4823
+ retirementIncome,
4824
+ };
4825
+ };
4826
+ const getParticipantAddresses$1 = (participantAddresses) => {
4827
+ const addressRegistration = participantAddresses?.find((address) => address.addressType.key === "REGISTRATION" /* EAddressType.REGISTRATION */);
4828
+ const addressFact = participantAddresses?.find((address) => address.addressType.key === "RESIDENTAL" /* EAddressType.RESIDENTAL */);
4829
+ const organizationAddress = participantAddresses?.find((address) => address.addressType.key === "WORK" /* EAddressType.WORK */);
4830
+ return {
4831
+ addressRegistration,
4832
+ addressFact,
4833
+ organizationAddress,
4834
+ };
4835
+ };
4836
+ const getParticipantContacts$1 = (participantContacts) => {
4837
+ const email = participantContacts?.find((contact) => contact.contactTypeCd.key === "EMAIL" /* EContactType.EMail */)?.value;
4838
+ const phone = participantContacts?.find((contact) => contact.contactTypeCd.key === "MAIN_PHONE" /* EContactType.MainPhone */)?.value;
4839
+ const organizationPhone = participantContacts?.find((contact) => contact.contactTypeCd.key === "ORGANIZATION_PHONE" /* EContactType.OrganizationPhone */)?.value;
4840
+ return {
4841
+ email,
4842
+ phone,
4843
+ organizationPhone,
4844
+ };
4845
+ };
4846
+ const getParticipantGender = (gender) => {
4847
+ return gender?.key
4848
+ ? {
4849
+ sex: gender.key === 'MAN' ? 'male' : 'female',
4850
+ }
4851
+ : null;
4852
+ };
4853
+ const getSelectValue = (option) => {
4854
+ return option?.key
4855
+ ? {
4856
+ key: option.key,
4857
+ text: option.value,
4858
+ }
4859
+ : undefined;
4860
+ };
4861
+
4862
+ const parseDraftTask = (task) => {
4863
+ const participant = task.participants[0];
4864
+ const { loanAmount: moneyValue, creditPeriod: monthsValue, paymentTypeCd } = task;
4865
+ const { currencyCode: currency, paymentSystemTypeCd: paymentSystem, classCard: cardCategory, codeWord, birthDate: limitedBirthday, midname: middleName, name, surname, birthPlace, dulIssueDate: dulIssueDateField, dulIssuedBy, dulNumber, dulSerie, dulSubdivisionCode, educationLevelCd: education, registrationDate: participantDateRegistration, houseTypeCd: housing, genderCd, participantContacts = [], participantAddresses = [], employmentContractDate: beginDate, employmentTypeCd: employment, organizationName, organizationInn: inn, organizationActivityTypeCd: employerActivities, organizationTypeCd: organization, organizationKindCd: employerOrganization, employeesNumberCd: amountWorkers, opf: legalForm, seniority: generalSeniority, generalSeniority: experience5Years, jobsNumber, lastWorkDuration: lastJobExperience, positionCd: positionOrganization, maritalStatusCd: familyStatus, childrenDependents: children, totalDependents: familyMembers, otherDependents: dependents, militaryStatusCd: conscription, participantIncomes, snils, armyIdFlg, bankruptcyFlg, shareholderFlg, nameLegalEntity: legalEntityName, creditInRshbCd, payrollCardRshbFlg: isInsurance, consentInsuranceFlg: isSalaryClient, } = participant;
4866
+ return {
4867
+ currency: currency?.key,
4868
+ paymentSystem,
4869
+ cardCategory: getSelectValue(cardCategory),
4870
+ codeWord,
4871
+ limitedBirthday,
4872
+ middleName,
4873
+ name,
4874
+ surname,
4875
+ birthPlace,
4876
+ dulIssueDateField,
4877
+ dulIssuedBy,
4878
+ dulNumber,
4879
+ dulSerie,
4880
+ dulSubdivisionCode,
4881
+ education: getSelectValue(education),
4882
+ participantDateRegistration,
4883
+ housing: getSelectValue(housing),
4884
+ beginDate,
4885
+ employment: getSelectValue(employment),
4886
+ organizationName,
4887
+ inn,
4888
+ employerActivities: getSelectValue(employerActivities),
4889
+ organization: getSelectValue(organization),
4890
+ employerOrganization: getSelectValue(employerOrganization),
4891
+ amountWorkers: getSelectValue(amountWorkers),
4892
+ legalForm,
4893
+ generalSeniority: generalSeniority?.toString(),
4894
+ experience5Years: experience5Years?.toString(),
4895
+ jobsNumber: jobsNumber?.toString(),
4896
+ lastJobExperience: lastJobExperience?.toString(),
4897
+ positionOrganization: getSelectValue(positionOrganization),
4898
+ familyStatus: getSelectValue(familyStatus),
4899
+ children: children?.toString(),
4900
+ familyMembers: familyMembers?.toString(),
4901
+ dependents: dependents?.toString(),
4902
+ conscription: getSelectValue(conscription),
4903
+ snils,
4904
+ armyIdFlg,
4905
+ bankruptcyFlg,
4906
+ shareholderFlg,
4907
+ legalEntityName,
4908
+ creditInRshbCd: getSelectValue(creditInRshbCd),
4909
+ calculator: {
4910
+ isInsurance,
4911
+ isSalaryClient,
4912
+ moneyValue,
4913
+ monthsValue,
4914
+ isAnnuity: paymentTypeCd?.key === 'ANNUITY',
4915
+ },
4916
+ ...getParticipantIncomes$1(participantIncomes),
4917
+ ...getParticipantAddresses$1(participantAddresses),
4918
+ ...getParticipantContacts$1(participantContacts),
4919
+ ...getParticipantGender(genderCd),
4920
+ };
4921
+ };
4922
+
4923
+ const DraftDialog = JSX(function ({ task, isFromLead = false, onClose = noop, }) {
4924
+ const leadFormStore = useLeadFormStore();
4925
+ const saveForm = useSetter(leadFormStore, 'leadForm');
4926
+ const navigator = locationNavigator();
4927
+ const { participants, creditProgram, id: taskId } = task;
4928
+ const programmId = creditProgramCodeToProductIdMap[creditProgram.code];
4929
+ const isCredit = Boolean(creditCodesToProgrammIdMap[creditProgram.code]);
4930
+ const nextStepLink = isCredit ? '/credit-lead' : '/credit-card-lead';
4931
+ const { name, midname, id: participantId, profile } = participants[0];
4932
+ const handleGoToDraft = useCallback(() => {
4933
+ const taskFromDraft = parseDraftTask(task);
4934
+ leadFormStore.participantId = participantId;
4935
+ leadFormStore.taskId = taskId;
4936
+ leadFormStore.profileId = profile?.id;
4937
+ leadFormStore.programId = programmId;
4938
+ saveForm(taskFromDraft);
4939
+ navigator.assign(nextStepLink);
4940
+ }, []);
4941
+ const handleGoToNewTask = useCallback(() => {
4942
+ navigator.assign(isCredit ? '/natural/loans/all-goals' : '/natural/creditcards/svoya');
4943
+ }, []);
4944
+ const handleGoToMainPage = useCallback(() => {
4945
+ navigator.assign('/');
4946
+ }, []);
4947
+ const appeal = name && midname ? `${name} ${midname}, ` : '';
4948
+ return (jsx(Dialog, { className: "my-6xl max-w-3xl w-full min-h-fit mx-auto rounded-lg py-0 px-5xl", onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg", children: [jsx(Heading, { className: "whitespace-pre-wrap", title: `${appeal}мы нашли черновик вашей заявки.\nПродолжите заполнение?`, headingType: "h5" }), jsx(DraftActionButton, { title: "\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043A \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A\u0443", icon: "api/v1/wcms-file-storage/72d06937-5d8b-4996-9503-52389b93919e/file.svg", description: "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0430\u0439\u0442\u0435 \u0437\u0430\u043F\u043E\u043B\u043D\u044F\u0442\u044C \u0437\u0430\u044F\u0432\u043A\u0443 \u0438\u0437 \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A\u0430", onClick: handleGoToDraft }), jsx(DraftActionButton, { title: isFromLead ? 'Продолжить заполнение текущей заявки' : 'Заполнить новую заявку', icon: "api/v1/wcms-file-storage/796c3e8d-341a-480b-b52f-3aa5784ed623/file.svg", onClick: isFromLead ? onClose : handleGoToNewTask }), jsx(Button, { type: "button", version: "secondary", className: "w-full text-h5", onClick: handleGoToMainPage, children: "\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E" })] }) }));
4949
+ });
4950
+
4951
+ const EmptyDraftDialog = JSX(function ({ onClose = noop }) {
4952
+ const navigator = locationNavigator();
4953
+ const handleGoNewTask = useCallback(() => {
4954
+ navigator.assign('/natural/loans/all-goals');
4955
+ }, []);
4956
+ const handleGoMainPage = useCallback(() => {
4957
+ navigator.assign('/');
4958
+ }, []);
4959
+ return (jsx(Dialog, { className: "my-6xl max-w-3xl w-full min-h-fit mx-auto rounded-lg py-0 px-5xl", onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg", children: [jsx(Heading, { className: "text-center", title: "\u0417\u0430\u044F\u0432\u043A\u0438 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B", headingType: "h3" }), jsx(Paragraph, { size: "text-l", align: "text-center", children: "\u041F\u043E \u0434\u0430\u043D\u043D\u043E\u043C\u0443 \u043D\u043E\u043C\u0435\u0440\u0443 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u043D\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043D\u044B\u0445 \u0437\u0430\u044F\u0432\u043E\u043A. \u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0437\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u043D\u043E\u0432\u0443\u044E \u0437\u0430\u044F\u0432\u043A\u0443 \u0438\u043B\u0438 \u0432\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443" }), jsx(Button, { type: "button", className: "w-full", onClick: handleGoNewTask, children: "\u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u043D\u043E\u0432\u0443\u044E \u0437\u0430\u044F\u0432\u043A\u0443" }), jsx(Button, { type: "button", version: "secondary", className: "w-full", onClick: handleGoMainPage, children: "\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E" })] }) }));
4960
+ });
4961
+
4962
+ const useDraftDialog = () => {
4963
+ const { open: openDraftDialog } = useDialog(DraftDialog);
4964
+ const { open: openEmptyDraftDialog } = useDialog(EmptyDraftDialog);
4965
+ return {
4966
+ open: ({ task, isFromLead, onClose }) => {
4967
+ task ? openDraftDialog({ task, isFromLead, onClose }) : openEmptyDraftDialog({});
4968
+ },
4969
+ };
4970
+ };
4971
+
4770
4972
  const getLink = (body) => fetchRetailJSON('/esia/getLink', 'POST', body);
4771
4973
 
4772
4974
  const EsiaLoginDialog = JSX(({ onClose }) => {
@@ -4898,22 +5100,26 @@
4898
5100
  };
4899
5101
  };
4900
5102
 
4901
- const useLeadFormStore = () => useLocalStore();
4902
-
4903
- const useApplicationLeadApi = ({ inputs, programId, nextStepLink, }) => {
4904
- const [responseStatus, setResponseStatus] = useState('');
5103
+ const useSaveUserData = () => {
4905
5104
  const leadFormStore = useLeadFormStore();
4906
5105
  const saveForm = useSetter(leadFormStore, 'leadForm');
4907
- const openEsiaLoginDialog = useEsiaLoginDialog(nextStepLink);
4908
- const consentBkiDialog = useConsentBkiDialog(openEsiaLoginDialog);
4909
- const verifyPhoneDialog = useDialog(VerifyPhoneDialog);
4910
- const saveUserData = useCallback(({ participantId, taskId, profileId, programId: programNumber }) => {
5106
+ const saveUserData = useCallback(({ participantId, taskId, profileId, formData, programId: programNumber }) => {
4911
5107
  leadFormStore.participantId = participantId;
4912
5108
  leadFormStore.taskId = taskId;
4913
5109
  leadFormStore.profileId = profileId;
4914
5110
  leadFormStore.programId = programNumber;
5111
+ saveForm(formData);
4915
5112
  }, []);
4916
- // eslint-disable-next-line consistent-return
5113
+ return saveUserData;
5114
+ };
5115
+
5116
+ const useApplicationLeadApi = ({ inputs, programId, nextStepLink, }) => {
5117
+ const [responseStatus, setResponseStatus] = useState('');
5118
+ const saveUserData = useSaveUserData();
5119
+ const openEsiaLoginDialog = useEsiaLoginDialog(nextStepLink);
5120
+ const consentBkiDialog = useConsentBkiDialog(openEsiaLoginDialog);
5121
+ const verifyPhoneDialog = useDialog(VerifyPhoneDialog);
5122
+ const draftDialog = useDraftDialog();
4917
5123
  const handleSubmit = useCallback(async (formData) => {
4918
5124
  const feedbackValidator = objectValidator(getObjectValidator(inputs));
4919
5125
  if (!isValidationSuccess(feedbackValidator(formData))) {
@@ -4924,17 +5130,34 @@
4924
5130
  profile: { phone: formatPhone(formData.phone) },
4925
5131
  });
4926
5132
  if (profileId && formData?.phone) {
5133
+ const sendCurrentTask = async () => {
5134
+ await updateUserData({
5135
+ programId,
5136
+ profileId,
5137
+ formData,
5138
+ saveUserData,
5139
+ });
5140
+ verifyPhoneDialog.close();
5141
+ consentBkiDialog.open(formData.phone, profileId);
5142
+ };
4927
5143
  const handleSuccessVerify = async () => {
4928
5144
  try {
4929
- await updateUserData({
4930
- programId,
5145
+ const lastTaskId = await getLastTaskStatus({
4931
5146
  profileId,
4932
- formData,
4933
- saveUserData,
4934
- saveForm,
5147
+ programId,
4935
5148
  });
4936
- verifyPhoneDialog.close();
4937
- consentBkiDialog.open(formData.phone, profileId);
5149
+ if (lastTaskId) {
5150
+ const task = await getTaskById({ taskId: lastTaskId });
5151
+ verifyPhoneDialog.close();
5152
+ draftDialog.open({
5153
+ task,
5154
+ isFromLead: true,
5155
+ onClose: sendCurrentTask,
5156
+ });
5157
+ }
5158
+ else {
5159
+ await sendCurrentTask();
5160
+ }
4938
5161
  }
4939
5162
  catch {
4940
5163
  setResponseStatus('Fail');
@@ -4959,7 +5182,7 @@
4959
5182
  responseStatus,
4960
5183
  };
4961
5184
  };
4962
- const updateUserData = async ({ programId, profileId, formData, saveUserData, saveForm, }) => {
5185
+ const updateUserData = async ({ programId, profileId, formData, saveUserData, }) => {
4963
5186
  const transformedForm = transformOtherConsentsField(formData);
4964
5187
  await updateUserProfile(getUpdateUserProfileData(profileId, transformedForm));
4965
5188
  const { taskId, participantId } = await createDraftTask({
@@ -4977,8 +5200,7 @@
4977
5200
  catch (ex) {
4978
5201
  console.log(ex);
4979
5202
  }
4980
- saveUserData({ participantId, taskId, profileId, programId });
4981
- saveForm(formData);
5203
+ saveUserData({ participantId, taskId, profileId, programId, formData });
4982
5204
  };
4983
5205
  const transformOtherConsentsField = (formData) => {
4984
5206
  const { consentOthersFlg, ...form } = formData;
@@ -10167,7 +10389,7 @@
10167
10389
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
10168
10390
  });
10169
10391
 
10170
- const packageVersion = "0.14.699";
10392
+ const packageVersion = "0.14.700";
10171
10393
 
10172
10394
  exports.Blocks = Blocks;
10173
10395
  exports.ContentPage = ContentPage;