@redneckz/wildless-cms-uni-blocks 0.14.813 → 0.14.814

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 (291) hide show
  1. package/bundle/bundle.umd.js +172 -131
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/ApplicationLeadForm/EsiaLoginBanner.d.ts +4 -0
  4. package/bundle/components/ApplicationLeadForm/applicationFormData.d.ts +0 -1
  5. package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  6. package/bundle/components/ApplicationLeadForm/parseEsiaProfile.d.ts +2 -2
  7. package/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
  8. package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
  9. package/bundle/retail/api/checkCode.d.ts +1 -0
  10. package/bundle/retail/api/{updateProfileEsia.d.ts → esiaRequestProfile.d.ts} +11 -4
  11. package/bundle/retail/api/updateUserTask.d.ts +1 -0
  12. package/bundle/retail/api/uploadFile.d.ts +1 -1
  13. package/bundle/retail/model/NameFieldDef.d.ts +1 -1
  14. package/bundle/ui-kit/FormField/shouldRenderField.d.ts +1 -1
  15. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +13 -3
  16. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  17. package/dist/components/ApplicationLeadForm/EsiaLoginBanner.d.ts +4 -0
  18. package/dist/components/ApplicationLeadForm/EsiaLoginBanner.js +23 -0
  19. package/dist/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -0
  20. package/dist/components/ApplicationLeadForm/applicationFormData.d.ts +0 -1
  21. package/dist/components/ApplicationLeadForm/applicationFormData.js +6 -31
  22. package/dist/components/ApplicationLeadForm/applicationFormData.js.map +1 -1
  23. package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  24. package/dist/components/ApplicationLeadForm/getInitialFormState.js +8 -2
  25. package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  26. package/dist/components/ApplicationLeadForm/parseEsiaProfile.d.ts +2 -2
  27. package/dist/components/ApplicationLeadForm/parseEsiaProfile.js +54 -19
  28. package/dist/components/ApplicationLeadForm/parseEsiaProfile.js.map +1 -1
  29. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
  30. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +7 -10
  31. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  32. package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
  33. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +12 -16
  34. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  35. package/dist/retail/adaptors/getFamilyStatusAndIncomeData.js +2 -2
  36. package/dist/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  37. package/dist/retail/api/checkCode.d.ts +1 -0
  38. package/dist/retail/api/checkCode.js +3 -2
  39. package/dist/retail/api/checkCode.js.map +1 -1
  40. package/{lib/retail/api/updateProfileEsia.d.ts → dist/retail/api/esiaRequestProfile.d.ts} +11 -4
  41. package/dist/retail/api/esiaRequestProfile.js +10 -0
  42. package/dist/retail/api/esiaRequestProfile.js.map +1 -0
  43. package/dist/retail/api/updateUserTask.d.ts +1 -0
  44. package/dist/retail/api/updateUserTask.js.map +1 -1
  45. package/dist/retail/api/uploadFile.d.ts +1 -1
  46. package/dist/retail/api/uploadFile.js +2 -3
  47. package/dist/retail/api/uploadFile.js.map +1 -1
  48. package/dist/retail/components/DraftDialog/parseDraftTask.js +2 -1
  49. package/dist/retail/components/DraftDialog/parseDraftTask.js.map +1 -1
  50. package/dist/retail/content.js +10 -1
  51. package/dist/retail/content.js.map +1 -1
  52. package/dist/retail/model/NameFieldDef.d.ts +1 -1
  53. package/dist/retail/utils/mainFormStateMap.js +1 -0
  54. package/dist/retail/utils/mainFormStateMap.js.map +1 -1
  55. package/dist/ui-kit/FormField/Fields/PhoneField.js +2 -1
  56. package/dist/ui-kit/FormField/Fields/PhoneField.js.map +1 -1
  57. package/dist/ui-kit/FormField/shouldRenderField.d.ts +1 -1
  58. package/dist/ui-kit/FormField/shouldRenderField.js +1 -1
  59. package/dist/ui-kit/FormField/shouldRenderField.js.map +1 -1
  60. package/lib/common.css +1 -1
  61. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +13 -3
  62. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  63. package/lib/components/ApplicationLeadForm/EsiaLoginBanner.d.ts +4 -0
  64. package/lib/components/ApplicationLeadForm/EsiaLoginBanner.js +21 -0
  65. package/lib/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -0
  66. package/lib/components/ApplicationLeadForm/applicationFormData.d.ts +0 -1
  67. package/lib/components/ApplicationLeadForm/applicationFormData.js +5 -30
  68. package/lib/components/ApplicationLeadForm/applicationFormData.js.map +1 -1
  69. package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  70. package/lib/components/ApplicationLeadForm/getInitialFormState.js +8 -2
  71. package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  72. package/lib/components/ApplicationLeadForm/parseEsiaProfile.d.ts +2 -2
  73. package/lib/components/ApplicationLeadForm/parseEsiaProfile.js +54 -19
  74. package/lib/components/ApplicationLeadForm/parseEsiaProfile.js.map +1 -1
  75. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
  76. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +7 -10
  77. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  78. package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
  79. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +12 -16
  80. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  81. package/lib/retail/adaptors/getFamilyStatusAndIncomeData.js +2 -2
  82. package/lib/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  83. package/lib/retail/api/checkCode.d.ts +1 -0
  84. package/lib/retail/api/checkCode.js +1 -1
  85. package/lib/retail/api/checkCode.js.map +1 -1
  86. package/{mobile/bundle/retail/api/updateProfileEsia.d.ts → lib/retail/api/esiaRequestProfile.d.ts} +11 -4
  87. package/lib/retail/api/esiaRequestProfile.js +7 -0
  88. package/lib/retail/api/esiaRequestProfile.js.map +1 -0
  89. package/lib/retail/api/updateUserTask.d.ts +1 -0
  90. package/lib/retail/api/updateUserTask.js.map +1 -1
  91. package/lib/retail/api/uploadFile.d.ts +1 -1
  92. package/lib/retail/api/uploadFile.js +2 -3
  93. package/lib/retail/api/uploadFile.js.map +1 -1
  94. package/lib/retail/components/DraftDialog/parseDraftTask.js +2 -1
  95. package/lib/retail/components/DraftDialog/parseDraftTask.js.map +1 -1
  96. package/lib/retail/content.js +10 -1
  97. package/lib/retail/content.js.map +1 -1
  98. package/lib/retail/model/NameFieldDef.d.ts +1 -1
  99. package/lib/retail/utils/mainFormStateMap.js +1 -0
  100. package/lib/retail/utils/mainFormStateMap.js.map +1 -1
  101. package/lib/ui-kit/FormField/Fields/PhoneField.js +2 -1
  102. package/lib/ui-kit/FormField/Fields/PhoneField.js.map +1 -1
  103. package/lib/ui-kit/FormField/shouldRenderField.d.ts +1 -1
  104. package/lib/ui-kit/FormField/shouldRenderField.js +1 -1
  105. package/lib/ui-kit/FormField/shouldRenderField.js.map +1 -1
  106. package/mobile/bundle/bundle.umd.js +172 -131
  107. package/mobile/bundle/bundle.umd.min.js +1 -1
  108. package/mobile/bundle/components/ApplicationLeadForm/EsiaLoginBanner.d.ts +4 -0
  109. package/mobile/bundle/components/ApplicationLeadForm/applicationFormData.d.ts +0 -1
  110. package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  111. package/mobile/bundle/components/ApplicationLeadForm/parseEsiaProfile.d.ts +2 -2
  112. package/mobile/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
  113. package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
  114. package/mobile/bundle/retail/api/checkCode.d.ts +1 -0
  115. package/{dist/retail/api/updateProfileEsia.d.ts → mobile/bundle/retail/api/esiaRequestProfile.d.ts} +11 -4
  116. package/mobile/bundle/retail/api/updateUserTask.d.ts +1 -0
  117. package/mobile/bundle/retail/api/uploadFile.d.ts +1 -1
  118. package/mobile/bundle/retail/model/NameFieldDef.d.ts +1 -1
  119. package/mobile/bundle/ui-kit/FormField/shouldRenderField.d.ts +1 -1
  120. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +13 -3
  121. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  122. package/mobile/dist/components/ApplicationLeadForm/EsiaLoginBanner.d.ts +4 -0
  123. package/mobile/dist/components/ApplicationLeadForm/EsiaLoginBanner.js +23 -0
  124. package/mobile/dist/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -0
  125. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.d.ts +0 -1
  126. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.js +6 -31
  127. package/mobile/dist/components/ApplicationLeadForm/applicationFormData.js.map +1 -1
  128. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  129. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +8 -2
  130. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  131. package/mobile/dist/components/ApplicationLeadForm/parseEsiaProfile.d.ts +2 -2
  132. package/mobile/dist/components/ApplicationLeadForm/parseEsiaProfile.js +54 -19
  133. package/mobile/dist/components/ApplicationLeadForm/parseEsiaProfile.js.map +1 -1
  134. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
  135. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +7 -10
  136. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  137. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
  138. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +12 -16
  139. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  140. package/mobile/dist/retail/adaptors/getFamilyStatusAndIncomeData.js +2 -2
  141. package/mobile/dist/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  142. package/mobile/dist/retail/api/checkCode.d.ts +1 -0
  143. package/mobile/dist/retail/api/checkCode.js +3 -2
  144. package/mobile/dist/retail/api/checkCode.js.map +1 -1
  145. package/mobile/dist/retail/api/esiaRequestProfile.d.ts +84 -0
  146. package/mobile/dist/retail/api/esiaRequestProfile.js +10 -0
  147. package/mobile/dist/retail/api/esiaRequestProfile.js.map +1 -0
  148. package/mobile/dist/retail/api/updateUserTask.d.ts +1 -0
  149. package/mobile/dist/retail/api/updateUserTask.js.map +1 -1
  150. package/mobile/dist/retail/api/uploadFile.d.ts +1 -1
  151. package/mobile/dist/retail/api/uploadFile.js +2 -3
  152. package/mobile/dist/retail/api/uploadFile.js.map +1 -1
  153. package/mobile/dist/retail/components/DraftDialog/parseDraftTask.js +2 -1
  154. package/mobile/dist/retail/components/DraftDialog/parseDraftTask.js.map +1 -1
  155. package/mobile/dist/retail/content.js +10 -1
  156. package/mobile/dist/retail/content.js.map +1 -1
  157. package/mobile/dist/retail/model/NameFieldDef.d.ts +1 -1
  158. package/mobile/dist/retail/utils/mainFormStateMap.js +1 -0
  159. package/mobile/dist/retail/utils/mainFormStateMap.js.map +1 -1
  160. package/mobile/dist/ui-kit/FormField/Fields/PhoneField.js +2 -1
  161. package/mobile/dist/ui-kit/FormField/Fields/PhoneField.js.map +1 -1
  162. package/mobile/dist/ui-kit/FormField/shouldRenderField.d.ts +1 -1
  163. package/mobile/dist/ui-kit/FormField/shouldRenderField.js +1 -1
  164. package/mobile/dist/ui-kit/FormField/shouldRenderField.js.map +1 -1
  165. package/mobile/lib/common.css +1 -1
  166. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +13 -3
  167. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  168. package/mobile/lib/components/ApplicationLeadForm/EsiaLoginBanner.d.ts +4 -0
  169. package/mobile/lib/components/ApplicationLeadForm/EsiaLoginBanner.js +21 -0
  170. package/mobile/lib/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -0
  171. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.d.ts +0 -1
  172. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.js +5 -30
  173. package/mobile/lib/components/ApplicationLeadForm/applicationFormData.js.map +1 -1
  174. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  175. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +8 -2
  176. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  177. package/mobile/lib/components/ApplicationLeadForm/parseEsiaProfile.d.ts +2 -2
  178. package/mobile/lib/components/ApplicationLeadForm/parseEsiaProfile.js +54 -19
  179. package/mobile/lib/components/ApplicationLeadForm/parseEsiaProfile.js.map +1 -1
  180. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +2 -2
  181. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +7 -10
  182. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  183. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +3 -1
  184. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +12 -16
  185. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  186. package/mobile/lib/retail/adaptors/getFamilyStatusAndIncomeData.js +2 -2
  187. package/mobile/lib/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
  188. package/mobile/lib/retail/api/checkCode.d.ts +1 -0
  189. package/mobile/lib/retail/api/checkCode.js +1 -1
  190. package/mobile/lib/retail/api/checkCode.js.map +1 -1
  191. package/mobile/lib/retail/api/esiaRequestProfile.d.ts +84 -0
  192. package/mobile/lib/retail/api/esiaRequestProfile.js +7 -0
  193. package/mobile/lib/retail/api/esiaRequestProfile.js.map +1 -0
  194. package/mobile/lib/retail/api/updateUserTask.d.ts +1 -0
  195. package/mobile/lib/retail/api/updateUserTask.js.map +1 -1
  196. package/mobile/lib/retail/api/uploadFile.d.ts +1 -1
  197. package/mobile/lib/retail/api/uploadFile.js +2 -3
  198. package/mobile/lib/retail/api/uploadFile.js.map +1 -1
  199. package/mobile/lib/retail/components/DraftDialog/parseDraftTask.js +2 -1
  200. package/mobile/lib/retail/components/DraftDialog/parseDraftTask.js.map +1 -1
  201. package/mobile/lib/retail/content.js +10 -1
  202. package/mobile/lib/retail/content.js.map +1 -1
  203. package/mobile/lib/retail/model/NameFieldDef.d.ts +1 -1
  204. package/mobile/lib/retail/utils/mainFormStateMap.js +1 -0
  205. package/mobile/lib/retail/utils/mainFormStateMap.js.map +1 -1
  206. package/mobile/lib/ui-kit/FormField/Fields/PhoneField.js +2 -1
  207. package/mobile/lib/ui-kit/FormField/Fields/PhoneField.js.map +1 -1
  208. package/mobile/lib/ui-kit/FormField/shouldRenderField.d.ts +1 -1
  209. package/mobile/lib/ui-kit/FormField/shouldRenderField.js +1 -1
  210. package/mobile/lib/ui-kit/FormField/shouldRenderField.js.map +1 -1
  211. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +14 -2
  212. package/mobile/src/components/ApplicationLeadForm/EsiaLoginBanner.tsx +52 -0
  213. package/mobile/src/components/ApplicationLeadForm/applicationFormData.tsx +5 -31
  214. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +8 -1
  215. package/mobile/src/components/ApplicationLeadForm/parseEsiaProfile.ts +68 -34
  216. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +58 -65
  217. package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +31 -41
  218. package/mobile/src/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -1
  219. package/mobile/src/retail/api/checkCode.ts +1 -1
  220. package/mobile/src/retail/api/{updateProfileEsia.ts → esiaRequestProfile.ts} +16 -5
  221. package/mobile/src/retail/api/updateUserTask.ts +1 -0
  222. package/mobile/src/retail/api/uploadFile.ts +2 -3
  223. package/mobile/src/retail/components/DraftDialog/parseDraftTask.ts +2 -0
  224. package/mobile/src/retail/content.tsx +10 -1
  225. package/mobile/src/retail/model/NameFieldDef.ts +1 -0
  226. package/mobile/src/retail/utils/mainFormStateMap.ts +1 -0
  227. package/mobile/src/ui-kit/FormField/Fields/PhoneField.tsx +9 -1
  228. package/mobile/src/ui-kit/FormField/shouldRenderField.tsx +2 -1
  229. package/package.json +1 -1
  230. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +14 -2
  231. package/src/components/ApplicationLeadForm/EsiaLoginBanner.tsx +52 -0
  232. package/src/components/ApplicationLeadForm/applicationFormData.tsx +5 -31
  233. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +8 -1
  234. package/src/components/ApplicationLeadForm/parseEsiaProfile.ts +68 -34
  235. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +58 -65
  236. package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +31 -41
  237. package/src/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -1
  238. package/src/retail/api/checkCode.ts +1 -1
  239. package/src/retail/api/{updateProfileEsia.ts → esiaRequestProfile.ts} +16 -5
  240. package/src/retail/api/updateUserTask.ts +1 -0
  241. package/src/retail/api/uploadFile.ts +2 -3
  242. package/src/retail/components/DraftDialog/parseDraftTask.ts +2 -0
  243. package/src/retail/content.tsx +10 -1
  244. package/src/retail/model/NameFieldDef.ts +1 -0
  245. package/src/retail/utils/mainFormStateMap.ts +1 -0
  246. package/src/ui-kit/FormField/Fields/PhoneField.tsx +9 -1
  247. package/src/ui-kit/FormField/shouldRenderField.tsx +2 -1
  248. package/bundle/retail/components/EsiaLoginDialog/EsiaLoginDialog.d.ts +0 -4
  249. package/bundle/retail/components/EsiaLoginDialog/useEsiaLoginDialog.d.ts +0 -1
  250. package/dist/retail/api/updateProfileEsia.js +0 -6
  251. package/dist/retail/api/updateProfileEsia.js.map +0 -1
  252. package/dist/retail/components/EsiaLoginDialog/EsiaLoginDialog.d.ts +0 -4
  253. package/dist/retail/components/EsiaLoginDialog/EsiaLoginDialog.js +0 -34
  254. package/dist/retail/components/EsiaLoginDialog/EsiaLoginDialog.js.map +0 -1
  255. package/dist/retail/components/EsiaLoginDialog/useEsiaLoginDialog.d.ts +0 -1
  256. package/dist/retail/components/EsiaLoginDialog/useEsiaLoginDialog.js +0 -15
  257. package/dist/retail/components/EsiaLoginDialog/useEsiaLoginDialog.js.map +0 -1
  258. package/lib/retail/api/updateProfileEsia.js +0 -3
  259. package/lib/retail/api/updateProfileEsia.js.map +0 -1
  260. package/lib/retail/components/EsiaLoginDialog/EsiaLoginDialog.d.ts +0 -4
  261. package/lib/retail/components/EsiaLoginDialog/EsiaLoginDialog.fixture.d.ts +0 -5
  262. package/lib/retail/components/EsiaLoginDialog/EsiaLoginDialog.js +0 -32
  263. package/lib/retail/components/EsiaLoginDialog/EsiaLoginDialog.js.map +0 -1
  264. package/lib/retail/components/EsiaLoginDialog/useEsiaLoginDialog.d.ts +0 -1
  265. package/lib/retail/components/EsiaLoginDialog/useEsiaLoginDialog.js +0 -12
  266. package/lib/retail/components/EsiaLoginDialog/useEsiaLoginDialog.js.map +0 -1
  267. package/mobile/bundle/retail/components/EsiaLoginDialog/EsiaLoginDialog.d.ts +0 -4
  268. package/mobile/bundle/retail/components/EsiaLoginDialog/useEsiaLoginDialog.d.ts +0 -1
  269. package/mobile/dist/retail/api/updateProfileEsia.d.ts +0 -77
  270. package/mobile/dist/retail/api/updateProfileEsia.js +0 -6
  271. package/mobile/dist/retail/api/updateProfileEsia.js.map +0 -1
  272. package/mobile/dist/retail/components/EsiaLoginDialog/EsiaLoginDialog.d.ts +0 -4
  273. package/mobile/dist/retail/components/EsiaLoginDialog/EsiaLoginDialog.js +0 -34
  274. package/mobile/dist/retail/components/EsiaLoginDialog/EsiaLoginDialog.js.map +0 -1
  275. package/mobile/dist/retail/components/EsiaLoginDialog/useEsiaLoginDialog.d.ts +0 -1
  276. package/mobile/dist/retail/components/EsiaLoginDialog/useEsiaLoginDialog.js +0 -15
  277. package/mobile/dist/retail/components/EsiaLoginDialog/useEsiaLoginDialog.js.map +0 -1
  278. package/mobile/lib/retail/api/updateProfileEsia.d.ts +0 -77
  279. package/mobile/lib/retail/api/updateProfileEsia.js +0 -3
  280. package/mobile/lib/retail/api/updateProfileEsia.js.map +0 -1
  281. package/mobile/lib/retail/components/EsiaLoginDialog/EsiaLoginDialog.d.ts +0 -4
  282. package/mobile/lib/retail/components/EsiaLoginDialog/EsiaLoginDialog.js +0 -32
  283. package/mobile/lib/retail/components/EsiaLoginDialog/EsiaLoginDialog.js.map +0 -1
  284. package/mobile/lib/retail/components/EsiaLoginDialog/useEsiaLoginDialog.d.ts +0 -1
  285. package/mobile/lib/retail/components/EsiaLoginDialog/useEsiaLoginDialog.js +0 -12
  286. package/mobile/lib/retail/components/EsiaLoginDialog/useEsiaLoginDialog.js.map +0 -1
  287. package/mobile/src/retail/components/EsiaLoginDialog/EsiaLoginDialog.tsx +0 -65
  288. package/mobile/src/retail/components/EsiaLoginDialog/useEsiaLoginDialog.tsx +0 -13
  289. package/src/retail/components/EsiaLoginDialog/EsiaLoginDialog.fixture.tsx +0 -7
  290. package/src/retail/components/EsiaLoginDialog/EsiaLoginDialog.tsx +0 -65
  291. package/src/retail/components/EsiaLoginDialog/useEsiaLoginDialog.tsx +0 -13
@@ -86,6 +86,7 @@ type NameFieldRetailDef =
86
86
  | 'calculator'
87
87
  | 'infoCard'
88
88
  | 'deliveryTime'
89
+ | 'esiaAccountTypeCd'
89
90
  | 'comment';
90
91
 
91
92
  export type NameFieldDef =
@@ -56,6 +56,7 @@ export const mainFormStateMap: Partial<LeadFormState>[] = [
56
56
  mandatoryPayments: undefined,
57
57
  snils: '',
58
58
  armyIdFlg: false,
59
+ esiaAccountTypeCd: { key: '', text: '' },
59
60
  },
60
61
  {
61
62
  bankruptcyFlg: false,
@@ -1,9 +1,17 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { isEsiaAuthorize } from '../../../retail/utils/isEsiaAuthorize';
2
3
  import { InputPhoneControl } from '../../Input/InputPhoneControl';
3
4
  import { type CustomFieldProps } from '../CustomFieldProps';
4
5
 
5
6
  export const PhoneField = JSX<CustomFieldProps>(({ field, input }) => {
6
7
  const fieldName = input?.name || 'phone';
7
8
 
8
- return <InputPhoneControl label="Телефон" {...field(fieldName)} {...input} />;
9
+ return (
10
+ <InputPhoneControl
11
+ label="Телефон"
12
+ disabled={input?.filledByEsia && isEsiaAuthorize(field, input.name ?? '')}
13
+ {...field(fieldName)}
14
+ {...input}
15
+ />
16
+ );
9
17
  });
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
1
2
  import { type FormFieldRegisterer } from '../../hooks/useForm/useForm';
2
3
  import { type BaseFieldDef } from './BaseFieldDef';
3
4
 
@@ -11,5 +12,5 @@ export function shouldRenderField<F extends BaseFieldDef>({
11
12
  const { condition } = input;
12
13
  const { value } = field(condition?.name || '');
13
14
 
14
- return !condition || condition?.values?.find((_) => _ === (value?.key ?? value));
15
+ return !condition || condition?.values?.includes(value?.key ?? value);
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.813",
3
+ "version": "0.14.814",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-lines-per-function */
1
2
  import { JSX } from '@redneckz/uni-jsx';
2
3
  import { useEffect, useMemo } from '@redneckz/uni-jsx/lib/hooks';
3
4
  import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
@@ -16,6 +17,7 @@ import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
16
17
  import { style } from '../../utils/style';
17
18
  import { getApplicationFormData } from './applicationFormData';
18
19
  import { type ApplicationLeadFormContent } from './ApplicationLeadFormContent';
20
+ import { EsiaLoginBanner } from './EsiaLoginBanner';
19
21
  import { renderInputs } from './renderInputs';
20
22
  import { renderSubmitButton } from './renderSubmitButton';
21
23
  import { useApplicationLeadApi } from './useApplicationLeadApi';
@@ -35,6 +37,7 @@ export const ApplicationLeadForm = JSX<ApplicationLeadFormProps>(
35
37
  ...rest
36
38
  }) => {
37
39
  const [esiaError, { setTrue: setEsiaError }] = useBool(false);
40
+ const [esiaAuthSuccess, { setTrue: setEsiaAuthSuccess }] = useBool(false);
38
41
  const applicationFormData = useMemo(() => getApplicationFormData(productType), [productType]);
39
42
  const inputs = useMemo(
40
43
  () => (applicationFormData?.flatMap((_) => _?.inputs) || []) as FieldRetailDef[],
@@ -48,16 +51,18 @@ export const ApplicationLeadForm = JSX<ApplicationLeadFormProps>(
48
51
  nextStepLink,
49
52
  productType,
50
53
  setEsiaError,
54
+ setEsiaAuthSuccess,
55
+ esiaAuthSuccess,
51
56
  });
52
57
  const { isSending, ok, handleSubmit } = useApplicationLeadApi({
53
58
  programId,
54
59
  nextStepLink,
55
60
  productType,
56
- esiaError,
61
+ esiaAuthSuccess,
57
62
  data,
58
63
  });
59
64
 
60
- const [, { field, onSubmit }] = useForm(initialFormState, {
65
+ const [, { field, onSubmit, reset }] = useForm(initialFormState, {
61
66
  formValidator,
62
67
  onSubmit: handleSubmit,
63
68
  });
@@ -69,12 +74,19 @@ export const ApplicationLeadForm = JSX<ApplicationLeadFormProps>(
69
74
  }
70
75
  }, [ok]);
71
76
 
77
+ useEffect(() => {
78
+ if (initialFormState?.esiaAccountTypeCd) {
79
+ reset();
80
+ }
81
+ }, [initialFormState]);
82
+
72
83
  return (
73
84
  <ApplicationFormLayout
74
85
  className={style('container space-y-m', className)}
75
86
  title={title}
76
87
  {...rest}
77
88
  >
89
+ {!esiaAuthSuccess && !esiaError ? <EsiaLoginBanner /> : null}
78
90
  <form onSubmit={onSubmit} className="space-y-m relative">
79
91
  {isLoading ? <Loader blur={false} /> : null}
80
92
  {applicationFormData.map((_, i) => (
@@ -0,0 +1,52 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
+ import { locationNavigator } from '../../external/locationNavigator';
4
+ import { getLink } from '../../retail/api/getLink';
5
+ import { Button } from '../../ui-kit/Button/Button';
6
+ import { Img } from '../../ui-kit/Img/Img';
7
+
8
+ export interface EsiaLoginBannerProps {
9
+ onClose?: () => void;
10
+ }
11
+
12
+ export const EsiaLoginBanner = JSX<EsiaLoginBannerProps>(() => {
13
+ const navigator = locationNavigator();
14
+
15
+ const handleAuth = useCallback(async () => {
16
+ const resp = await getLink({
17
+ redirectUri: globalThis.location.origin + globalThis.location.pathname,
18
+ });
19
+
20
+ if (resp?.link) {
21
+ navigator.assign(resp.link);
22
+ globalThis.location.href = resp.link;
23
+ }
24
+ }, []);
25
+
26
+ return (
27
+ <div className="flex gap-lg items-center rounded-md bg-main-gray px-4 py-6 @md:p-9">
28
+ <div className="flex flex-col justify-around w-full">
29
+ <p className="mb-4 text-xl @md:text-2xl @md:mb-6">Заполните данные через Госуслуги</p>
30
+ <ul className="list-disc list-inside mb-9">
31
+ <li>Вероятность одобрения выше</li>
32
+ <li>Без справок о доходах и трудоустройстве</li>
33
+ <li>С защитой Ваших данных</li>
34
+ </ul>
35
+ <Img
36
+ className="block mb-6 self-center @md:hidden"
37
+ image={{ icon: 'GosUslugiIcon', iconVersion: 'normal' }}
38
+ height="80"
39
+ width="80"
40
+ />
41
+ <Button type="button" onClick={handleAuth} className="w-full @md:w-fit">
42
+ Заполнить
43
+ </Button>
44
+ </div>
45
+ <Img
46
+ className="hidden @md:block"
47
+ image={{ icon: 'GosUslugiIcon', iconVersion: 'normal' }}
48
+ height="164"
49
+ />
50
+ </div>
51
+ );
52
+ });
@@ -3,32 +3,6 @@ import { type FieldRetailDef } from '../../retail/model/RetailFormContent';
3
3
  import { type ProductType } from './ApplicationLeadFormContent';
4
4
  import { productTypeToConsentsMap } from './consents';
5
5
 
6
- export const applicationFormData: SectionsRetailProps[] = [
7
- {
8
- columns: 2,
9
- inputs: [
10
- { name: 'surname', required: true, dadata: true },
11
- { name: 'name', required: true, dadata: true },
12
- { name: 'middleName', dadata: true },
13
- { name: 'limitedBirthday', required: true },
14
- { name: 'phone', required: true },
15
- { name: 'email', required: true, dadata: true },
16
- ],
17
- },
18
- {
19
- inputs: [
20
- { name: 'processPersonalDataFlg', required: true },
21
- { name: 'consentProviderFlg', required: true },
22
- { name: 'consentOthersFlg', required: true },
23
- { name: 'consentInformFlg' },
24
- { name: 'consentPfrFlg' },
25
- { name: 'consentInformMaterialsFlg' },
26
- { name: 'consentPhotoFlg' },
27
- { name: 'consentFATCA' },
28
- ],
29
- },
30
- ];
31
-
32
6
  export const getApplicationFormData = (productType: ProductType): SectionsRetailProps[] => {
33
7
  const currentProductConsents = productTypeToConsentsMap[productType];
34
8
  const allConsents: FieldRetailDef[] = [
@@ -46,11 +20,11 @@ export const getApplicationFormData = (productType: ProductType): SectionsRetail
46
20
  {
47
21
  columns: 2,
48
22
  inputs: [
49
- { name: 'surname', required: true, dadata: true },
50
- { name: 'name', required: true, dadata: true },
51
- { name: 'middleName', dadata: true },
52
- { name: 'limitedBirthday', required: true },
53
- { name: 'phone', required: true },
23
+ { name: 'surname', required: true, dadata: true, filledByEsia: true },
24
+ { name: 'name', required: true, dadata: true, filledByEsia: true },
25
+ { name: 'middleName', dadata: true, filledByEsia: true },
26
+ { name: 'limitedBirthday', required: true, filledByEsia: true },
27
+ { name: 'phone', required: true, filledByEsia: true },
54
28
  { name: 'email', required: true, dadata: true },
55
29
  ],
56
30
  },
@@ -21,9 +21,16 @@ const initialFormState = {
21
21
  export const getInitialFormState = (
22
22
  inputs: FieldRetailDef[],
23
23
  savedForm: LeadFormState | null,
24
+ esiaAuthSuccess: boolean,
24
25
  ): LeadFormState => {
25
26
  if (savedForm) {
26
- return { ...savedForm, limitedBirthday: new Date(savedForm?.limitedBirthday || 0) };
27
+ return {
28
+ ...savedForm,
29
+ limitedBirthday: new Date(savedForm?.limitedBirthday || 0),
30
+ ...(!esiaAuthSuccess && {
31
+ esiaAccountTypeCd: { key: '' },
32
+ }),
33
+ };
27
34
  }
28
35
 
29
36
  const formState = Object.fromEntries(inputs.map((_) => [_.name, initialFormState[_.name || '']]));
@@ -1,33 +1,62 @@
1
1
  /* eslint-disable max-lines */
2
- import { type UpdateProfileEsiaResponse } from '../../retail/api/updateProfileEsia';
2
+ /* eslint-disable max-lines-per-function */
3
+ import { type EsiaRequestProfileResponse } from '../../retail/api/esiaRequestProfile';
3
4
  import { uploadFile, type DocumentCategory } from '../../retail/api/uploadFile';
4
5
  import { type Address, type File, type LeadFormState } from '../../retail/model/LeadFormState';
5
6
  import { normalizePhone } from '../../ui-kit/PhoneInput/normalizePhone';
6
7
 
8
+ type Document = {
9
+ file: string;
10
+ category: DocumentCategory;
11
+ isPDF: boolean;
12
+ };
13
+
7
14
  export const parseEsiaProfile = async (
8
- esiaProfile: UpdateProfileEsiaResponse,
9
- taskId: string,
15
+ esiaProfile: EsiaRequestProfileResponse,
10
16
  isDebit: boolean,
11
17
  ): Promise<LeadFormState> => {
12
18
  isDebit ? checkEsiaDataForDebit(esiaProfile) : checkEsiaDataForCredit(esiaProfile);
13
19
 
14
20
  const { profile, addInfo, document, addressRegistration, addressFact, esiaAdditionalDocument } =
15
21
  esiaProfile;
16
- const files: File[] = [];
22
+ let files: File[] = [];
17
23
 
18
24
  if (!isDebit) {
19
- await saveDocument({
20
- document: esiaAdditionalDocument.pdfFileWorkbook,
21
- taskId,
22
- category: 'CONFIRMING_INCOME_DOC',
23
- files,
24
- });
25
- await saveDocument({
26
- document: esiaAdditionalDocument.pdfFilePayout,
27
- taskId,
28
- category: 'CONFIRMING_EMPLOYMENT_DOC',
29
- files,
30
- });
25
+ files = await saveDocuments([
26
+ {
27
+ file: esiaAdditionalDocument.pdfFileWorkbook,
28
+ category: 'CONFIRMING_INCOME_DOC',
29
+ isPDF: true,
30
+ },
31
+ {
32
+ file: esiaAdditionalDocument.pdfFilePayout,
33
+ category: 'CONFIRMING_EMPLOYMENT_DOC',
34
+ isPDF: true,
35
+ },
36
+ {
37
+ file: esiaAdditionalDocument.pdfFileSigPayout,
38
+ category: 'CONFIRMING_EMPLOYMENT_DOC',
39
+ isPDF: true,
40
+ },
41
+ {
42
+ file: esiaAdditionalDocument.xmlFilePayout,
43
+ category: 'CONFIRMING_EMPLOYMENT_DOC',
44
+ isPDF: false,
45
+ },
46
+ {
47
+ file: esiaAdditionalDocument.xmlFileSigPayout,
48
+ category: 'CONFIRMING_EMPLOYMENT_DOC',
49
+ isPDF: false,
50
+ },
51
+ {
52
+ file: esiaAdditionalDocument.xmlFileWorkbook,
53
+ category: 'CONFIRMING_INCOME_DOC',
54
+ isPDF: false,
55
+ },
56
+ //TODO: После тестирования добавить документы снизу
57
+ // {file: esiaAdditionalDocument.pdfFileSigWorkbook, category: 'CONFIRMING_INCOME_DOC', isPDF: true},
58
+ // {file: esiaAdditionalDocument.xmlFileSigWorkbook, category: 'CONFIRMING_INCOME_DOC', isPDF: false},
59
+ ]);
31
60
  }
32
61
 
33
62
  const mainData = {
@@ -74,7 +103,7 @@ const concatFullAddress = (address: Array<string | undefined>): string => {
74
103
  }, '');
75
104
  };
76
105
 
77
- const buildAddress = (fields: UpdateProfileEsiaResponse['addressRegistration']): Address => {
106
+ const buildAddress = (fields: EsiaRequestProfileResponse['addressRegistration']): Address => {
78
107
  const {
79
108
  postcode,
80
109
  region,
@@ -110,24 +139,22 @@ const buildAddress = (fields: UpdateProfileEsiaResponse['addressRegistration']):
110
139
 
111
140
  const getYearFromMonth = (month: number) => Math.floor(month / 12);
112
141
 
113
- const saveDocument = async ({
114
- document,
115
- taskId,
116
- category,
117
- files,
118
- }: {
119
- document: string;
120
- taskId: string;
121
- category: DocumentCategory;
122
- files: File[];
123
- }) => {
124
- await fetch(`data:application/pdf;base64,${document}`)
125
- .then((res) => res.blob())
126
- .then((value) => uploadFile(value, taskId, category))
127
- .then((file) => files.push(file));
142
+ const saveDocuments = async (documents: Document[]): Promise<File[]> => {
143
+ const files: File[] = [];
144
+
145
+ for (const doc of documents) {
146
+ const contentType = doc.isPDF ? 'data:application/pdf;base64' : 'data:application/xml;base64';
147
+
148
+ await fetch(`${contentType},${doc.file}`)
149
+ .then((res) => res.blob())
150
+ .then((value) => uploadFile(value, doc.category, doc.isPDF))
151
+ .then((file) => files.push(file));
152
+ }
153
+
154
+ return files;
128
155
  };
129
156
 
130
- const checkEsiaDataForCredit = (esiaProfile: UpdateProfileEsiaResponse) => {
157
+ const checkEsiaDataForCredit = (esiaProfile: EsiaRequestProfileResponse) => {
131
158
  const { profile, document, addressRegistration, esiaAdditionalDocument } = esiaProfile;
132
159
 
133
160
  const data = [
@@ -153,6 +180,13 @@ const checkEsiaDataForCredit = (esiaProfile: UpdateProfileEsiaResponse) => {
153
180
  esiaAdditionalDocument.jobsNumberInFiveYears.toString(),
154
181
  esiaAdditionalDocument.pdfFilePayout,
155
182
  esiaAdditionalDocument.pdfFileWorkbook,
183
+ esiaAdditionalDocument.pdfFileSigPayout,
184
+ esiaAdditionalDocument.xmlFilePayout,
185
+ esiaAdditionalDocument.xmlFileSigPayout,
186
+ esiaAdditionalDocument.xmlFileWorkbook,
187
+ //TODO: После тестирования добавить документы снизу
188
+ // esiaAdditionalDocument.pdfFileSigWorkbook,
189
+ // esiaAdditionalDocument.xmlFileSigWorkbook
156
190
  ];
157
191
 
158
192
  if (!data.every((_) => Boolean(_))) {
@@ -160,7 +194,7 @@ const checkEsiaDataForCredit = (esiaProfile: UpdateProfileEsiaResponse) => {
160
194
  }
161
195
  };
162
196
 
163
- const checkEsiaDataForDebit = (esiaProfile: UpdateProfileEsiaResponse) => {
197
+ const checkEsiaDataForDebit = (esiaProfile: EsiaRequestProfileResponse) => {
164
198
  const { profile, document, addressRegistration } = esiaProfile;
165
199
 
166
200
  const data = [
@@ -12,7 +12,6 @@ import { updateUserProfile } from '../../retail/api/updateUserProfile';
12
12
  import { updateUserTask } from '../../retail/api/updateUserTask';
13
13
  import { useConsentBkiDialog } from '../../retail/components/ConsentBkiDialog/useConsentBkiDialog';
14
14
  import { useDraftDialog } from '../../retail/components/DraftDialog/useDraftDialog';
15
- import { useEsiaLoginDialog } from '../../retail/components/EsiaLoginDialog/useEsiaLoginDialog';
16
15
  import { VerifyPhoneDialog } from '../../retail/components/VerifyPhoneDialog/VerifyPhoneDialog';
17
16
  import { type FormRetailConsents, type LeadFormState } from '../../retail/model/LeadFormState';
18
17
  import { getUpdateUserProfileData } from '../../retail/utils/getUpdateUserProfile';
@@ -28,7 +27,7 @@ interface ApplicationLeadApiProps extends AspectsProps {
28
27
  programId: string;
29
28
  nextStepLink: string;
30
29
  productType: ProductType;
31
- esiaError: boolean;
30
+ esiaAuthSuccess: boolean;
32
31
  }
33
32
 
34
33
  // eslint-disable-next-line max-lines-per-function
@@ -36,7 +35,6 @@ export const useApplicationLeadApi = ({
36
35
  programId,
37
36
  nextStepLink,
38
37
  productType,
39
- esiaError,
40
38
  data,
41
39
  }: ApplicationLeadApiProps) => {
42
40
  const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
@@ -45,77 +43,72 @@ export const useApplicationLeadApi = ({
45
43
  const sendAspects = useSendLeadFormAspects({ data });
46
44
  const navigator = locationNavigator();
47
45
 
48
- const openEsiaLoginDialog = useEsiaLoginDialog(nextStepLink);
49
- const consentBkiDialog = useConsentBkiDialog(openEsiaLoginDialog);
46
+ const goToNextStep = useCallback(() => {
47
+ navigator.assign(nextStepLink);
48
+ }, []);
49
+
50
+ const consentBkiDialog = useConsentBkiDialog(goToNextStep);
50
51
  const verifyPhoneDialog = useDialog(VerifyPhoneDialog);
51
52
  const draftDialog = useDraftDialog();
52
53
 
53
- const handleSubmit = useCallback(
54
- async (formData: LeadFormState) => {
55
- if (esiaError) {
56
- navigator.assign(nextStepLink);
57
-
58
- return;
59
- }
60
- try {
61
- startSending();
62
- const profileId = await createUserProfile({
63
- profile: { phone: formatPhone(formData.phone as string) },
64
- });
54
+ const handleSubmit = useCallback(async (formData: LeadFormState) => {
55
+ try {
56
+ startSending();
57
+ const profileId = await createUserProfile({
58
+ profile: { phone: formatPhone(formData.phone as string) },
59
+ });
65
60
 
66
- if (profileId && formData?.phone) {
67
- const sendCurrentTask = async () => {
68
- await updateUserData({
69
- programId,
70
- profileId,
71
- formData,
72
- productType,
73
- saveUserData,
74
- sendAspects,
75
- });
76
- verifyPhoneDialog.close();
77
- if (productType === 'debitCard') {
78
- openEsiaLoginDialog();
61
+ if (profileId && formData?.phone) {
62
+ const sendCurrentTask = async () => {
63
+ await updateUserData({
64
+ programId,
65
+ profileId,
66
+ formData,
67
+ productType,
68
+ saveUserData,
69
+ sendAspects,
70
+ });
71
+ verifyPhoneDialog.close();
72
+ if (productType === 'debitCard') {
73
+ goToNextStep();
74
+ } else {
75
+ consentBkiDialog.open(formData.phone, profileId);
76
+ }
77
+ };
78
+ const handleSuccessVerify = async () => {
79
+ try {
80
+ const lastTaskId = await getLastTaskStatus({ profileId, programId });
81
+
82
+ if (lastTaskId) {
83
+ const task = await getTaskById({ taskId: lastTaskId });
84
+ verifyPhoneDialog.close();
85
+ draftDialog.open({
86
+ task,
87
+ isFromLead: true,
88
+ sendAspects,
89
+ onClose: sendCurrentTask,
90
+ });
79
91
  } else {
80
- consentBkiDialog.open(formData.phone, profileId);
81
- }
82
- };
83
- const handleSuccessVerify = async () => {
84
- try {
85
- const lastTaskId = await getLastTaskStatus({ profileId, programId });
86
-
87
- if (lastTaskId) {
88
- const task = await getTaskById({ taskId: lastTaskId });
89
- verifyPhoneDialog.close();
90
- draftDialog.open({
91
- task,
92
- isFromLead: true,
93
- sendAspects,
94
- onClose: sendCurrentTask,
95
- });
96
- } else {
97
- await sendCurrentTask();
98
- }
99
- } catch {
100
- setOK(false);
92
+ await sendCurrentTask();
101
93
  }
102
- };
94
+ } catch {
95
+ setOK(false);
96
+ }
97
+ };
103
98
 
104
- const acceptedConsents = getAcceptedConsents(formData, productType);
99
+ const acceptedConsents = getAcceptedConsents(formData, productType);
105
100
 
106
- verifyPhoneDialog.open({
107
- phone: formData?.phone,
108
- consents: acceptedConsents,
109
- onSuccess: handleSuccessVerify,
110
- });
111
- endSending();
112
- }
113
- } catch {
114
- setOK(false);
101
+ verifyPhoneDialog.open({
102
+ phone: formData?.phone,
103
+ consents: acceptedConsents,
104
+ onSuccess: handleSuccessVerify,
105
+ });
106
+ endSending();
115
107
  }
116
- },
117
- [esiaError],
118
- );
108
+ } catch {
109
+ setOK(false);
110
+ }
111
+ }, []);
119
112
 
120
113
  return { isSending, ok, handleSubmit };
121
114
  };
@@ -1,11 +1,9 @@
1
1
  import { useCallback, useEffect, useMemo } from '@redneckz/uni-jsx/lib/hooks';
2
2
  import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
3
- import { locationNavigator } from '../../external/locationNavigator';
4
3
  import { useSetter } from '../../hooks/useSetter';
5
- import { updateProfileEsia } from '../../retail/api/updateProfileEsia';
4
+ import { esiaRequestProfile } from '../../retail/api/esiaRequestProfile';
6
5
  import { type LeadFormState } from '../../retail/model/LeadFormState';
7
6
  import { type FieldRetailDef } from '../../retail/model/RetailFormContent';
8
- import { safeJsonParse } from '../../utils/safeJsonParse';
9
7
  import { type ProductType } from './ApplicationLeadFormContent';
10
8
  import { getInitialFormState } from './getInitialFormState';
11
9
  import { parseEsiaProfile } from './parseEsiaProfile';
@@ -16,70 +14,62 @@ type InitApplicationLeadProps = {
16
14
  nextStepLink: string;
17
15
  productType: ProductType;
18
16
  setEsiaError: () => void;
17
+ setEsiaAuthSuccess: () => void;
18
+ esiaAuthSuccess: boolean;
19
19
  };
20
20
 
21
21
  export const useInitApplicationLead = ({
22
22
  inputs,
23
- nextStepLink,
24
23
  productType,
25
24
  setEsiaError,
25
+ setEsiaAuthSuccess,
26
+ esiaAuthSuccess,
26
27
  }: InitApplicationLeadProps): [LeadFormState, { isLoading: boolean }] => {
27
- const navigator = locationNavigator();
28
28
  const [isLoading, { setTrue: startLoading, setFalse: endLoading }] = useBool(false);
29
29
 
30
30
  const leadFormStore = useLeadFormStore();
31
31
  const saveForm = useSetter(leadFormStore, 'leadForm');
32
32
 
33
33
  const initialFormState = useMemo(
34
- () => getInitialFormState(inputs, leadFormStore.leadForm),
34
+ () => getInitialFormState(inputs, leadFormStore.leadForm, esiaAuthSuccess),
35
35
  [inputs, leadFormStore.leadForm],
36
36
  );
37
37
 
38
- const updateEsiaProfile = useCallback(
39
- async (profileId: string, code: string, state: string) => {
40
- startLoading();
41
- try {
42
- const data = await updateProfileEsia({
43
- profileId,
44
- code,
45
- state,
46
- redirectUri: globalThis.location?.href,
47
- });
38
+ const requestEsiaProfile = useCallback(async (code: string, state: string) => {
39
+ startLoading();
40
+ try {
41
+ const data = await esiaRequestProfile({
42
+ code,
43
+ state,
44
+ redirectUri: globalThis.location?.href,
45
+ authorize: true,
46
+ });
48
47
 
49
- if (data && leadFormStore?.taskId) {
50
- const parsedData = await parseEsiaProfile(
51
- data,
52
- leadFormStore.taskId.toString(),
53
- productType === 'debitCard',
54
- );
48
+ if (data) {
49
+ const parsedData = await parseEsiaProfile(data, productType === 'debitCard');
55
50
 
56
- saveForm((_) => ({
57
- ..._,
58
- ...parsedData,
59
- }));
60
- }
61
-
62
- navigator.assign(nextStepLink);
63
- } catch {
64
- setEsiaError();
65
- } finally {
66
- endLoading();
51
+ saveForm((_) => ({
52
+ ..._,
53
+ ...parsedData,
54
+ }));
55
+ setEsiaAuthSuccess();
67
56
  }
68
- },
69
- [nextStepLink],
70
- );
57
+ } catch {
58
+ setEsiaError();
59
+ } finally {
60
+ endLoading();
61
+ }
62
+ }, []);
71
63
 
72
64
  useEffect(() => {
73
65
  leadFormStore.productType = productType;
74
- const profileId: string = <string>(
75
- safeJsonParse(globalThis.localStorage?.getItem('profileId') ?? '')
76
- );
66
+
77
67
  const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
78
68
  const code = params.get('code');
79
69
  const state = params.get('state');
80
70
 
81
- if (profileId && code && state) {
82
- updateEsiaProfile(profileId, code, state);
71
+ if (code && state) {
72
+ requestEsiaProfile(code, state);
83
73
  } else {
84
74
  sessionStorage.removeItem('accessToken');
85
75
  sessionStorage.removeItem('refreshToken');