@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseDraftTask.js","sourceRoot":"","sources":["../../../src/ui-kit/DraftDialog/parseDraftTask.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAU,EAAiB,EAAE;IAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAEzC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IAElF,MAAM,EACJ,YAAY,EAAE,QAAQ,EACtB,mBAAmB,EAAE,aAAa,EAClC,SAAS,EAAE,YAAY,EACvB,QAAQ,EACR,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,UAAU,EACnB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,YAAY,EAAE,iBAAiB,EAC/B,WAAW,EACX,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAAE,SAAS,EAC3B,gBAAgB,EAAE,2BAA2B,EAC7C,WAAW,EAAE,OAAO,EACpB,QAAQ,EACR,mBAAmB,GAAG,EAAE,EACxB,oBAAoB,GAAG,EAAE,EACzB,sBAAsB,EAAE,SAAS,EACjC,gBAAgB,EAAE,UAAU,EAC5B,gBAA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Q,EAAE;QAC9C,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,EAAE;QAC9C,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE;QAClC,iBAAiB,EAAE,iBAAiB,EAAE,QAAQ,EAAE;QAChD,oBAAoB,EAAE,cAAc,CAAC,oBAAoB,CAAC;QAC1D,YAAY,EAAE,cAAc,CAAC,YAAY,CAAC;QAC1C,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE;QAC9B,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE;QACxC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE;QAClC,YAAY,EAAE,cAAc,CAAC,YAAY,CAAC;QAC1C,KAAK;QACL,SAAS;QACT,aAAa;QACb,cAAc;QACd,eAAe;QACf,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC;QAC9C,UAAU,EAAE;YACV,WAAW;YACX,cAAc;YACd,UAAU;YACV,WAAW;YACX,SAAS,EAAE,aAAa,EAAE,GAAG,KAAK,SAAS;SAC5C;QACD,GAAG,qBAAqB,CAAC,kBAAkB,CAAC;QAC5C,GAAG,uBAAuB,CAAC,oBAAoB,CAAC;QAChD,GAAG,sBAAsB,CAAC,mBAAmB,CAAC;QAC9C,GAAG,oBAAoB,CAAC,QAAQ,CAAC;KAClC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type Task } from '../../api/RetailAPI/draftTasksKZO';
2
+ declare type useDraftDialogOpenProps = {
3
+ task?: Task;
4
+ isFromLead?: boolean;
5
+ onClose?: () => void;
6
+ };
7
+ export declare const useDraftDialog: () => {
8
+ open: ({ task, isFromLead, onClose }: useDraftDialogOpenProps) => void;
9
+ };
10
+ export {};
@@ -0,0 +1,13 @@
1
+ import { useDialog } from '../DialogManager/useDialog.js';
2
+ import { DraftDialog } from './DraftDialog.js';
3
+ import { EmptyDraftDialog } from './EmptyDraftDialog.js';
4
+ export const useDraftDialog = () => {
5
+ const { open: openDraftDialog } = useDialog(DraftDialog);
6
+ const { open: openEmptyDraftDialog } = useDialog(EmptyDraftDialog);
7
+ return {
8
+ open: ({ task, isFromLead, onClose }) => {
9
+ task ? openDraftDialog({ task, isFromLead, onClose }) : openEmptyDraftDialog({});
10
+ },
11
+ };
12
+ };
13
+ //# sourceMappingURL=useDraftDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDraftDialog.js","sourceRoot":"","sources":["../../../src/ui-kit/DraftDialog/useDraftDialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAQtD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAEnE,OAAO;QACL,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAA2B,EAAE,EAAE;YAC/D,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,138 @@
1
+ import { type LeadProps } from '../../api/RetailAPI/model/LeadFormData';
2
+ import { type Participant } from '../../api/RetailAPI/updateUserTask';
3
+ import { type Option } from '../Select/Option';
4
+ export declare const enum EContactType {
5
+ MainPhone = "MAIN_PHONE",
6
+ SecondPhone = "SECOND_PHONE",
7
+ HomePhoneFact = "HOME_PHONE_FACT",
8
+ HomePhoneReg = "HOME_PHONE_REG",
9
+ OrganizationPhone = "ORGANIZATION_PHONE",
10
+ EMail = "EMAIL"
11
+ }
12
+ export declare const enum EAddressType {
13
+ REGISTRATION = "REGISTRATION",
14
+ RESIDENTAL = "RESIDENTAL",
15
+ WORK = "WORK"
16
+ }
17
+ export declare const enum EIncomesType {
18
+ INCOME_AVERAGE = "INCOME_AVERAGE",
19
+ MANDATORY_PAYMENTS = "MANDATORY_PAYMENTS",
20
+ ADDITIONAL_INCOME = "ADDITIONAL_INCOME",
21
+ OTHER_INCOME = "OTHER_INCOME",
22
+ OTHER_PAYMENTS = "OTHER_PAYMENTS",
23
+ RENTAL_INCOME = "RENTAL_INCOME",
24
+ WAGES = "WAGES",
25
+ RETIREMENT_INCOME = "RETIREMENT_INCOME"
26
+ }
27
+ export declare const creditCodesToProgrammIdMap: {
28
+ credit_cash: string;
29
+ credit_cash_single_doc: string;
30
+ credit_mcx: string;
31
+ family_offer_credit: string;
32
+ gas_engine_fuel: string;
33
+ pension_credit: string;
34
+ ref_credit: string;
35
+ ref_credit_single_doc: string;
36
+ self_employed: string;
37
+ summer_cash: string;
38
+ summer_cash_pens: string;
39
+ };
40
+ export declare const cardCodesToProgrammIdMap: {
41
+ amur_card: string;
42
+ owner_card: string;
43
+ travel_card: string;
44
+ };
45
+ export declare const creditProgramCodeToProductIdMap: {
46
+ amur_card: string;
47
+ owner_card: string;
48
+ travel_card: string;
49
+ credit_cash: string;
50
+ credit_cash_single_doc: string;
51
+ credit_mcx: string;
52
+ family_offer_credit: string;
53
+ gas_engine_fuel: string;
54
+ pension_credit: string;
55
+ ref_credit: string;
56
+ ref_credit_single_doc: string;
57
+ self_employed: string;
58
+ summer_cash: string;
59
+ summer_cash_pens: string;
60
+ };
61
+ export declare const getParticipantIncomes: (participantIncomes: Participant['participantIncomes']) => {
62
+ wages: number | undefined;
63
+ mandatoryPayments: number | undefined;
64
+ incomeAverage: number | undefined;
65
+ additionalIncome: number | undefined;
66
+ otherIncome: number | undefined;
67
+ otherPayments: number | undefined;
68
+ rentalIncome: number | undefined;
69
+ retirementIncome: number | undefined;
70
+ };
71
+ export declare const getParticipantAddresses: (participantAddresses: Participant['participantAddresses']) => {
72
+ addressRegistration: {
73
+ addressType: {
74
+ key: "REGISTRATION" | "RESIDENTAL" | "WORK";
75
+ };
76
+ apartment: string;
77
+ block: string;
78
+ building: string;
79
+ city: string;
80
+ district: string;
81
+ fiasCode: string;
82
+ fullAddress: string;
83
+ house: string;
84
+ locality: string;
85
+ okatoRegionCode: string;
86
+ postcode: string;
87
+ region: string;
88
+ regionCode: string;
89
+ street: string;
90
+ } | undefined;
91
+ addressFact: {
92
+ addressType: {
93
+ key: "REGISTRATION" | "RESIDENTAL" | "WORK";
94
+ };
95
+ apartment: string;
96
+ block: string;
97
+ building: string;
98
+ city: string;
99
+ district: string;
100
+ fiasCode: string;
101
+ fullAddress: string;
102
+ house: string;
103
+ locality: string;
104
+ okatoRegionCode: string;
105
+ postcode: string;
106
+ region: string;
107
+ regionCode: string;
108
+ street: string;
109
+ } | undefined;
110
+ organizationAddress: {
111
+ addressType: {
112
+ key: "REGISTRATION" | "RESIDENTAL" | "WORK";
113
+ };
114
+ apartment: string;
115
+ block: string;
116
+ building: string;
117
+ city: string;
118
+ district: string;
119
+ fiasCode: string;
120
+ fullAddress: string;
121
+ house: string;
122
+ locality: string;
123
+ okatoRegionCode: string;
124
+ postcode: string;
125
+ region: string;
126
+ regionCode: string;
127
+ street: string;
128
+ } | undefined;
129
+ };
130
+ export declare const getParticipantContacts: (participantContacts: Participant['participantContacts']) => {
131
+ email: string | undefined;
132
+ phone: string | undefined;
133
+ organizationPhone: string | undefined;
134
+ };
135
+ export declare const getParticipantGender: (gender: Participant['genderCd']) => {
136
+ sex: string;
137
+ } | null;
138
+ export declare const getSelectValue: (option?: LeadProps) => Option | undefined;
@@ -0,0 +1,78 @@
1
+ export const creditCodesToProgrammIdMap = {
2
+ credit_cash: '10',
3
+ credit_cash_single_doc: '28',
4
+ credit_mcx: '39',
5
+ family_offer_credit: '41',
6
+ gas_engine_fuel: '33',
7
+ pension_credit: '12',
8
+ ref_credit: '11',
9
+ ref_credit_single_doc: '29',
10
+ self_employed: '34',
11
+ summer_cash: '35',
12
+ summer_cash_pens: '36',
13
+ };
14
+ export const cardCodesToProgrammIdMap = {
15
+ amur_card: '14',
16
+ owner_card: '13',
17
+ travel_card: '15',
18
+ };
19
+ export const creditProgramCodeToProductIdMap = {
20
+ ...creditCodesToProgrammIdMap,
21
+ ...cardCodesToProgrammIdMap,
22
+ };
23
+ export const getParticipantIncomes = (participantIncomes) => {
24
+ const wages = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "WAGES" /* EIncomesType.WAGES */)?.value;
25
+ const mandatoryPayments = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "MANDATORY_PAYMENTS" /* EIncomesType.MANDATORY_PAYMENTS */)?.value;
26
+ const incomeAverage = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "INCOME_AVERAGE" /* EIncomesType.INCOME_AVERAGE */)?.value;
27
+ const additionalIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "ADDITIONAL_INCOME" /* EIncomesType.ADDITIONAL_INCOME */)?.value;
28
+ const otherIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "OTHER_INCOME" /* EIncomesType.OTHER_INCOME */)?.value;
29
+ const otherPayments = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "OTHER_PAYMENTS" /* EIncomesType.OTHER_PAYMENTS */)?.value;
30
+ const rentalIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "RENTAL_INCOME" /* EIncomesType.RENTAL_INCOME */)?.value;
31
+ const retirementIncome = participantIncomes?.find((contact) => contact.incomeTypeCd.key === "RETIREMENT_INCOME" /* EIncomesType.RETIREMENT_INCOME */)?.value;
32
+ return {
33
+ wages,
34
+ mandatoryPayments,
35
+ incomeAverage,
36
+ additionalIncome,
37
+ otherIncome,
38
+ otherPayments,
39
+ rentalIncome,
40
+ retirementIncome,
41
+ };
42
+ };
43
+ export const getParticipantAddresses = (participantAddresses) => {
44
+ const addressRegistration = participantAddresses?.find((address) => address.addressType.key === "REGISTRATION" /* EAddressType.REGISTRATION */);
45
+ const addressFact = participantAddresses?.find((address) => address.addressType.key === "RESIDENTAL" /* EAddressType.RESIDENTAL */);
46
+ const organizationAddress = participantAddresses?.find((address) => address.addressType.key === "WORK" /* EAddressType.WORK */);
47
+ return {
48
+ addressRegistration,
49
+ addressFact,
50
+ organizationAddress,
51
+ };
52
+ };
53
+ export const getParticipantContacts = (participantContacts) => {
54
+ const email = participantContacts?.find((contact) => contact.contactTypeCd.key === "EMAIL" /* EContactType.EMail */)?.value;
55
+ const phone = participantContacts?.find((contact) => contact.contactTypeCd.key === "MAIN_PHONE" /* EContactType.MainPhone */)?.value;
56
+ const organizationPhone = participantContacts?.find((contact) => contact.contactTypeCd.key === "ORGANIZATION_PHONE" /* EContactType.OrganizationPhone */)?.value;
57
+ return {
58
+ email,
59
+ phone,
60
+ organizationPhone,
61
+ };
62
+ };
63
+ export const getParticipantGender = (gender) => {
64
+ return gender?.key
65
+ ? {
66
+ sex: gender.key === 'MAN' ? 'male' : 'female',
67
+ }
68
+ : null;
69
+ };
70
+ export const getSelectValue = (option) => {
71
+ return option?.key
72
+ ? {
73
+ key: option.key,
74
+ text: option.value,
75
+ }
76
+ : undefined;
77
+ };
78
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ui-kit/DraftDialog/utils.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,WAAW,EAAE,IAAI;IACjB,sBAAsB,EAAE,IAAI;IAC5B,UAAU,EAAE,IAAI;IAChB,mBAAmB,EAAE,IAAI;IACzB,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,IAAI;IAChB,qBAAqB,EAAE,IAAI;IAC3B,aAAa,EAAE,IAAI;IACnB,WAAW,EAA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,aAAa,CAAC,GAAG,8CAA2B,CAClE,EAAE,KAAK,CAAC;IACT,MAAM,iBAAiB,GAAG,mBAAmB,EAAE,IAAI,CACjD,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,8DAAmC,CAC1E,EAAE,KAAK,CAAC;IAET,OAAO;QACL,KAAK;QACL,KAAK;QACL,iBAAiB;KAClB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAA+B,EAAE,EAAE;IACtE,OAAO,MAAM,EAAE,GAAG;QAChB,CAAC,CAAC;YACE,GAAG,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;SAC9C;QACH,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAkB,EAAsB,EAAE;IACvE,OAAO,MAAM,EAAE,GAAG;QAChB,CAAC,CAAC;YACE,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,IAAI,EAAE,MAAM,CAAC,KAAK;SACnB;QACH,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { fetchRetailJSON } from './doRequest';
2
+ import { type Participant, type PaymentType } from './updateUserTask';
3
+
4
+ export type Task = {
5
+ courierDeliveryFlg?: boolean;
6
+ creditPeriod?: number;
7
+ creditProgram: {
8
+ code: string;
9
+ name: string;
10
+ };
11
+ deliveryComment?: string;
12
+ deliveryDate?: string;
13
+ deliveryTimeCd?: {
14
+ value: string;
15
+ };
16
+ id: number;
17
+ loanAmount?: number;
18
+ office?: {
19
+ id: string;
20
+ };
21
+ participants: Participant[];
22
+ paymentTypeCd?: PaymentType;
23
+ };
24
+
25
+ type DraftTaskKZOResponse = {
26
+ tasks: Array<Task>;
27
+ };
28
+
29
+ export const draftTasksKZO = async (): Promise<DraftTaskKZOResponse['tasks']> => {
30
+ const res = await fetchRetailJSON<DraftTaskKZOResponse>('/user-data/draftTasksKZO', 'GET');
31
+
32
+ return res?.tasks || [];
33
+ };
@@ -0,0 +1,21 @@
1
+ import { fetchRetailJSON } from './doRequest';
2
+
3
+ type GetLastTaskStatusBody = {
4
+ profileId: number;
5
+ programId: string;
6
+ };
7
+
8
+ type GetLastTaskStatusResponse = {
9
+ statusCd: string;
10
+ taskId: number;
11
+ };
12
+
13
+ export const getLastTaskStatus = async (body: GetLastTaskStatusBody): Promise<number | null> => {
14
+ const res = await fetchRetailJSON<GetLastTaskStatusResponse>(
15
+ '/user-data/getLastStatus',
16
+ 'POST',
17
+ body,
18
+ );
19
+
20
+ return res?.statusCd === 'DRAFT' ? res?.taskId : null;
21
+ };
@@ -0,0 +1,12 @@
1
+ import { fetchRetailJSON } from './doRequest';
2
+ import { type Task } from './draftTasksKZO';
3
+
4
+ type GetTaskByIdBody = {
5
+ taskId: number;
6
+ };
7
+
8
+ export const getTaskById = async (body: GetTaskByIdBody): Promise<Task | undefined> => {
9
+ const res = await fetchRetailJSON<Task>('/user-data/getTaskById', 'POST', body);
10
+
11
+ return res || undefined;
12
+ };
@@ -52,12 +52,12 @@ export type Participant = {
52
52
  midname?: string;
53
53
  name?: string;
54
54
  surname?: string;
55
- profile?: {
55
+ profile: {
56
56
  id: number;
57
57
  };
58
58
  armyIdFlg?: boolean;
59
59
  birthPlace?: string;
60
- childrenDependents?: number;
60
+ childrenDependents?: string;
61
61
  genderCd?: Option;
62
62
  dulIssueDate?: string;
63
63
  dulIssuedBy?: string;
@@ -68,13 +68,13 @@ export type Participant = {
68
68
  employeesNumberCd?: Option;
69
69
  employmentContractDate?: string;
70
70
  employmentTypeCd?: Option;
71
- generalSeniority?: number;
71
+ generalSeniority?: string;
72
72
  homeMatchFlg?: boolean;
73
73
  houseTypeCd?: Option;
74
74
  incomeCertificateCd?: Option;
75
75
  initiateBankruptcyFlg?: boolean;
76
- jobsNumber?: number;
77
- lastWorkDuration?: number;
76
+ jobsNumber?: string;
77
+ lastWorkDuration?: string;
78
78
  maritalStatusCd?: Option;
79
79
  militaryStatusCd?: Option;
80
80
  organizationActivityTypeCd?: Option;
@@ -82,7 +82,7 @@ export type Participant = {
82
82
  organizationKindCd?: Option;
83
83
  organizationName?: string;
84
84
  organizationTypeCd?: Option;
85
- otherDependents?: number;
85
+ otherDependents?: string;
86
86
  ownershipShare?: string;
87
87
  opf?: string;
88
88
  participantAddresses?: ParticipantAddress[];
@@ -94,14 +94,14 @@ export type Participant = {
94
94
  seniority?: string;
95
95
  seniorityInterruptionsFlg?: boolean;
96
96
  snils?: string;
97
- totalDependents?: number;
97
+ totalDependents?: string;
98
98
  bankruptcyFlg?: boolean;
99
99
  shareholderFlg?: boolean;
100
100
  nameLegalEntity?: string;
101
101
  creditInRshbCd?: Option;
102
102
  participantContacts?: Array<{
103
103
  contactTypeCd: {
104
- key: 'EMAIL' | 'MAIN_PHONE';
104
+ key: 'EMAIL' | 'MAIN_PHONE' | 'ORGANIZATION_PHONE';
105
105
  };
106
106
  value: string;
107
107
  }>;
@@ -84,9 +84,9 @@ export interface LeadFormState extends FormConsents, FormStateDeliveryType {
84
84
  legalForm?: string;
85
85
  organizationName?: string;
86
86
  generalSeniority?: string;
87
- lastJobExperience?: number;
88
- experience5Years?: number;
89
- jobsNumber?: number;
87
+ lastJobExperience?: string;
88
+ experience5Years?: string;
89
+ jobsNumber?: string;
90
90
  organizationAddress?: Address;
91
91
  beginDate?: Date | string;
92
92
  addressFact?: Address;
@@ -105,9 +105,9 @@ export interface LeadFormState extends FormConsents, FormStateDeliveryType {
105
105
  consentAssignmentClaimsFlg?: boolean;
106
106
  consentCollectionFlg?: boolean;
107
107
  familyStatus?: Option;
108
- children?: number;
109
- familyMembers?: number;
110
- dependents?: number;
108
+ children?: string;
109
+ familyMembers?: string;
110
+ dependents?: string;
111
111
  totalIncome?: number;
112
112
  expenses?: number;
113
113
  snils?: string;
@@ -1,12 +1,14 @@
1
1
  import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
2
2
  import { createDraftTask } from '../../api/RetailAPI/createDraftTask';
3
3
  import { createUserProfile } from '../../api/RetailAPI/createUserProfile';
4
+ import { getLastTaskStatus } from '../../api/RetailAPI/getLastTaskStatus';
5
+ import { getTaskById } from '../../api/RetailAPI/getTaskById';
4
6
  import { updateUserProfile } from '../../api/RetailAPI/updateUserProfile';
5
7
  import { updateUserTask } from '../../api/RetailAPI/updateUserTask';
6
8
  import { getUpdateUserProfileData } from '../../api/RetailAPI/utils/getUpdateUserProfile';
7
- import { useSetter } from '../../hooks/useSetter';
8
9
  import { useConsentBkiDialog } from '../../ui-kit/ConsentBkiDialog/useConsentBkiDialog';
9
10
  import { useDialog } from '../../ui-kit/DialogManager/useDialog';
11
+ import { useDraftDialog } from '../../ui-kit/DraftDialog/useDraftDialog';
10
12
  import { useEsiaLoginDialog } from '../../ui-kit/EsiaLoginDialog/useEsiaLoginDialog';
11
13
  import { getObjectValidator } from '../../ui-kit/FormField/getObjectValidator';
12
14
  import { VerifyPhoneDialog } from '../../ui-kit/VerifyPhoneDialog/VerifyPhoneDialog';
@@ -17,7 +19,7 @@ import { type FieldDef } from './ApplicationLeadFormContent';
17
19
  import { CONSENTS } from './consents';
18
20
  import { getLeadFormTaskData } from './getLeadFormTaskData';
19
21
  import { type LeadFormState } from './LeadFormState';
20
- import { useLeadFormStore } from './useLeadFormStore';
22
+ import { useSaveUserData, type UserData } from './useSaveUserData';
21
23
 
22
24
  interface ApplicationLeadApiProps {
23
25
  inputs: FieldDef[];
@@ -25,37 +27,19 @@ interface ApplicationLeadApiProps {
25
27
  nextStepLink: string;
26
28
  }
27
29
 
28
- interface UserData {
29
- participantId: number;
30
- taskId: number;
31
- profileId: number;
32
- programId: string;
33
- }
34
-
35
30
  export const useApplicationLeadApi = ({
36
31
  inputs,
37
32
  programId,
38
33
  nextStepLink,
39
34
  }: ApplicationLeadApiProps) => {
40
35
  const [responseStatus, setResponseStatus] = useState<'OK' | 'Fail' | ''>('');
41
- const leadFormStore = useLeadFormStore();
42
- const saveForm = useSetter(leadFormStore, 'leadForm');
36
+ const saveUserData = useSaveUserData();
43
37
 
44
38
  const openEsiaLoginDialog = useEsiaLoginDialog(nextStepLink);
45
39
  const consentBkiDialog = useConsentBkiDialog(openEsiaLoginDialog);
46
40
  const verifyPhoneDialog = useDialog(VerifyPhoneDialog);
41
+ const draftDialog = useDraftDialog();
47
42
 
48
- const saveUserData = useCallback(
49
- ({ participantId, taskId, profileId, programId: programNumber }: UserData) => {
50
- leadFormStore.participantId = participantId;
51
- leadFormStore.taskId = taskId;
52
- leadFormStore.profileId = profileId;
53
- leadFormStore.programId = programNumber;
54
- },
55
- [],
56
- );
57
-
58
- // eslint-disable-next-line consistent-return
59
43
  const handleSubmit = useCallback(async (formData: LeadFormState) => {
60
44
  const feedbackValidator = objectValidator(getObjectValidator(inputs));
61
45
  if (!isValidationSuccess(feedbackValidator(formData))) {
@@ -68,17 +52,34 @@ export const useApplicationLeadApi = ({
68
52
  });
69
53
 
70
54
  if (profileId && formData?.phone) {
55
+ const sendCurrentTask = async () => {
56
+ await updateUserData({
57
+ programId,
58
+ profileId,
59
+ formData,
60
+ saveUserData,
61
+ });
62
+ verifyPhoneDialog.close();
63
+ consentBkiDialog.open(formData.phone, profileId);
64
+ };
71
65
  const handleSuccessVerify = async () => {
72
66
  try {
73
- await updateUserData({
74
- programId,
67
+ const lastTaskId = await getLastTaskStatus({
75
68
  profileId,
76
- formData,
77
- saveUserData,
78
- saveForm,
69
+ programId,
79
70
  });
80
- verifyPhoneDialog.close();
81
- consentBkiDialog.open(formData.phone, profileId);
71
+
72
+ if (lastTaskId) {
73
+ const task = await getTaskById({ taskId: lastTaskId });
74
+ verifyPhoneDialog.close();
75
+ draftDialog.open({
76
+ task,
77
+ isFromLead: true,
78
+ onClose: sendCurrentTask,
79
+ });
80
+ } else {
81
+ await sendCurrentTask();
82
+ }
82
83
  } catch {
83
84
  setResponseStatus('Fail');
84
85
  }
@@ -110,13 +111,11 @@ const updateUserData = async ({
110
111
  profileId,
111
112
  formData,
112
113
  saveUserData,
113
- saveForm,
114
114
  }: {
115
115
  programId: string;
116
116
  profileId: number;
117
117
  formData: LeadFormState;
118
118
  saveUserData: (userData: UserData) => void;
119
- saveForm: (formData: LeadFormState) => void;
120
119
  }) => {
121
120
  const transformedForm = transformOtherConsentsField(formData);
122
121
 
@@ -140,8 +139,7 @@ const updateUserData = async ({
140
139
  console.log(ex);
141
140
  }
142
141
 
143
- saveUserData({ participantId, taskId, profileId, programId });
144
- saveForm(formData);
142
+ saveUserData({ participantId, taskId, profileId, programId, formData });
145
143
  };
146
144
 
147
145
  const transformOtherConsentsField = (formData: LeadFormState): LeadFormState => {
@@ -0,0 +1,29 @@
1
+ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useSetter } from '../../hooks/useSetter';
3
+ import { type LeadFormState } from './LeadFormState';
4
+ import { useLeadFormStore } from './useLeadFormStore';
5
+
6
+ export interface UserData {
7
+ participantId: number;
8
+ taskId: number;
9
+ profileId: number;
10
+ programId: string;
11
+ formData: LeadFormState;
12
+ }
13
+ export const useSaveUserData = () => {
14
+ const leadFormStore = useLeadFormStore();
15
+ const saveForm = useSetter(leadFormStore, 'leadForm');
16
+
17
+ const saveUserData = useCallback(
18
+ ({ participantId, taskId, profileId, formData, programId: programNumber }: UserData) => {
19
+ leadFormStore.participantId = participantId;
20
+ leadFormStore.taskId = taskId;
21
+ leadFormStore.profileId = profileId;
22
+ leadFormStore.programId = programNumber;
23
+ saveForm(formData);
24
+ },
25
+ [],
26
+ );
27
+
28
+ return saveUserData;
29
+ };
@@ -0,0 +1,32 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { noop } from '../../utils/noop';
3
+ import { Heading } from '../Heading/Heading';
4
+ import { Img } from '../Img/Img';
5
+ import { Paragraph } from '../Paragraph/Paragraph';
6
+
7
+ export interface DraftActionButtonProps {
8
+ title: string;
9
+ icon: string;
10
+ description?: string;
11
+ onClick?: () => void;
12
+ }
13
+
14
+ export const DraftActionButton = JSX<DraftActionButtonProps>(
15
+ ({ title, icon, description, onClick = noop }) => (
16
+ <button
17
+ className="flex gap-lg items-center border border-gray rounded-md cursor-pointer p-4 hover:border-green"
18
+ type="button"
19
+ onClick={onClick}
20
+ >
21
+ <Img image={{ src: icon }} width="78" height="78" />
22
+ <div>
23
+ <Heading className="text-left" title={title} headingType="h5" />
24
+ {description ? (
25
+ <Paragraph color="text-secondary-text" size="text-m">
26
+ {description}
27
+ </Paragraph>
28
+ ) : null}
29
+ </div>
30
+ </button>
31
+ ),
32
+ );