@hhgtech/hhg-components 1.29.332 → 1.29.334-beta-1

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 (626) hide show
  1. package/README.md +2 -0
  2. package/build/{LastPeriod-f1221bad.js → LastPeriod-b829cab9.js} +1 -1
  3. package/build/{MobileBottomNavigationIcon-0770acc1.js → MobileBottomNavigationIcon-57554ccb.js} +3 -3
  4. package/build/{Spinner-7719819a.js → Spinner-4f558116.js} +1 -1
  5. package/build/{WhatsApp-d2628e6a.js → WhatsApp-af0830fe.js} +1 -1
  6. package/build/adapters.js +19 -19
  7. package/build/atoms.js +49 -46
  8. package/build/babyGrowth.js +83 -83
  9. package/build/cache.js +2 -2
  10. package/build/care/components/organisms/bookingSearchBar/mobileTopbar/index.styled.d.ts +1 -1
  11. package/build/care/components/organisms/bookingSearchBar/resultSection/index.styled.d.ts +1 -1
  12. package/build/care/components/organisms/bookingSearchBar/resultSectionItem/index.styled.d.ts +1 -1
  13. package/build/care.js +17 -17
  14. package/build/careBookingSearchBar.js +14 -14
  15. package/build/careBookingSearchBarV2.js +15 -15
  16. package/build/components/adapters/button/index.d.ts +3 -1
  17. package/build/components/atoms/drawerComponent/index.d.ts +8 -0
  18. package/build/components/atoms/drawerComponent/index.styled.d.ts +7 -0
  19. package/build/components/atoms/googleLocation/index.d.ts +7 -0
  20. package/build/components/atoms/index.d.ts +1 -0
  21. package/build/components/mantine/text/index.d.ts +1 -1
  22. package/build/components/mantine/theme/other.d.ts +1 -1
  23. package/build/components/mantine/theme/text.d.ts +1 -0
  24. package/build/components.js +134 -131
  25. package/build/{constants-38e0dd27.js → constants-bbcf29ec.js} +1 -1
  26. package/build/constants.js +3 -3
  27. package/build/constantsDomainLocales.js +1 -1
  28. package/build/constantsRiskScreener.js +2 -2
  29. package/build/constantsSite.js +2 -2
  30. package/build/{core-6554e5d3.js → core-ceaaff44.js} +1 -1
  31. package/build/{dataTransform-bb9d60c1.js → dataTransform-744c0776.js} +1 -1
  32. package/build/ecom.js +4 -4
  33. package/build/{editor-07b39f82.js → editor-64f2bf27.js} +12 -11
  34. package/build/embeddedHeathToolCards_babyGrowth.js +23 -23
  35. package/build/embeddedHeathToolCards_babyPoop.js +19 -19
  36. package/build/embeddedHeathToolCards_babyVaccine.js +22 -22
  37. package/build/embeddedHeathToolCards_bmi_bmi.js +25 -25
  38. package/build/embeddedHeathToolCards_bmrBmr.js +25 -25
  39. package/build/embeddedHeathToolCards_dueDate_dueDate.js +22 -22
  40. package/build/embeddedHeathToolCards_ovulation_ovulation.js +22 -22
  41. package/build/embeddedHeathToolCards_pwg_pwg.js +26 -26
  42. package/build/embeddedHeathToolCards_targetHeartRate.js +27 -27
  43. package/build/esm/{LastPeriod-3e7641e1.js → LastPeriod-fd5114dd.js} +1 -1
  44. package/build/esm/{MobileBottomNavigationIcon-77a6e5d1.js → MobileBottomNavigationIcon-4e0fbb01.js} +3 -3
  45. package/build/esm/{Spinner-4cc30c73.js → Spinner-912c6f34.js} +1 -1
  46. package/build/esm/{WhatsApp-ec0a8966.js → WhatsApp-f2d8fb5b.js} +1 -1
  47. package/build/esm/adapters.js +19 -19
  48. package/build/esm/atoms.js +48 -46
  49. package/build/esm/babyGrowth.js +83 -83
  50. package/build/esm/cache.js +2 -2
  51. package/build/esm/care/components/organisms/bookingSearchBar/mobileTopbar/index.styled.d.ts +1 -1
  52. package/build/esm/care/components/organisms/bookingSearchBar/resultSection/index.styled.d.ts +1 -1
  53. package/build/esm/care/components/organisms/bookingSearchBar/resultSectionItem/index.styled.d.ts +1 -1
  54. package/build/esm/care.js +17 -17
  55. package/build/esm/careBookingSearchBar.js +14 -14
  56. package/build/esm/careBookingSearchBarV2.js +15 -15
  57. package/build/esm/components/adapters/button/index.d.ts +3 -1
  58. package/build/esm/components/atoms/drawerComponent/index.d.ts +8 -0
  59. package/build/esm/components/atoms/drawerComponent/index.styled.d.ts +7 -0
  60. package/build/esm/components/atoms/googleLocation/index.d.ts +7 -0
  61. package/build/esm/components/atoms/index.d.ts +1 -0
  62. package/build/esm/components/mantine/text/index.d.ts +1 -1
  63. package/build/esm/components/mantine/theme/other.d.ts +1 -1
  64. package/build/esm/components/mantine/theme/text.d.ts +1 -0
  65. package/build/esm/components.js +92 -90
  66. package/build/esm/{constants-6f9893fd.js → constants-09521ace.js} +1 -1
  67. package/build/esm/constants.js +3 -3
  68. package/build/esm/constantsDomainLocales.js +1 -1
  69. package/build/esm/constantsRiskScreener.js +2 -2
  70. package/build/esm/constantsSite.js +2 -2
  71. package/build/esm/{core-ab886886.js → core-56dc0f05.js} +1 -1
  72. package/build/esm/{dataTransform-f75c268c.js → dataTransform-e01a7da8.js} +1 -1
  73. package/build/esm/ecom.js +4 -4
  74. package/build/esm/{editor-1449176b.js → editor-30eaf984.js} +12 -12
  75. package/build/esm/embeddedHeathToolCards_babyGrowth.js +23 -23
  76. package/build/esm/embeddedHeathToolCards_babyPoop.js +19 -19
  77. package/build/esm/embeddedHeathToolCards_babyVaccine.js +22 -22
  78. package/build/esm/embeddedHeathToolCards_bmi_bmi.js +25 -25
  79. package/build/esm/embeddedHeathToolCards_bmrBmr.js +25 -25
  80. package/build/esm/embeddedHeathToolCards_dueDate_dueDate.js +22 -22
  81. package/build/esm/embeddedHeathToolCards_ovulation_ovulation.js +22 -22
  82. package/build/esm/embeddedHeathToolCards_pwg_pwg.js +26 -26
  83. package/build/esm/embeddedHeathToolCards_targetHeartRate.js +27 -27
  84. package/build/esm/footer.js +21 -21
  85. package/build/esm/gAssets.js +2 -2
  86. package/build/esm/healthToolsCardWrapper.js +18 -18
  87. package/build/esm/healthToolsForm.js +33 -33
  88. package/build/esm/hooks/usePlacesAutocomplete.d.ts +2 -0
  89. package/build/esm/hooks.js +13 -13
  90. package/build/esm/i18n/translationKeys.d.ts +1 -1
  91. package/build/esm/i18n-values/en-PH.js +16 -1
  92. package/build/esm/i18n-values/hi-IN.js +16 -1
  93. package/build/esm/i18n-values/id-ID.js +16 -1
  94. package/build/esm/i18n-values/km-KH.js +20 -5
  95. package/build/esm/i18n-values/ms-MY.js +16 -1
  96. package/build/esm/i18n-values/my-MM.js +16 -1
  97. package/build/esm/i18n-values/th-TH.js +16 -1
  98. package/build/esm/i18n-values/tl-PH.js +15 -0
  99. package/build/esm/i18n-values/vi-VN.js +18 -3
  100. package/build/esm/i18n-values/vi-VN_MB.js +17 -2
  101. package/build/esm/i18n-values/zh-TW.js +16 -1
  102. package/build/esm/i18n.js +2 -2
  103. package/build/esm/i18nV2.js +2 -2
  104. package/build/esm/icons/ChatbotBg.d.ts +4 -0
  105. package/build/esm/icons/Search.d.ts +4 -0
  106. package/build/esm/icons/index.d.ts +5 -3
  107. package/build/esm/{index-9f09e594.js → index-01b0835c.js} +20 -20
  108. package/build/esm/{index-340baab5.js → index-02d06202.js} +1 -1
  109. package/build/esm/{index-551006c8.js → index-114de66f.js} +15 -15
  110. package/build/esm/{index-cf7a91f6.js → index-11d07def.js} +2 -2
  111. package/build/esm/{index-ffd06730.js → index-1b3d0fb7.js} +13 -13
  112. package/build/esm/{index-553c50fe.js → index-262b1416.js} +2 -2
  113. package/build/esm/{index-c66fecf7.js → index-26e9ffe8.js} +6 -6
  114. package/build/esm/{index-598e5fc5.js → index-2a882430.js} +24 -24
  115. package/build/esm/{index-b862cd16.js → index-2ae8c1c0.js} +14 -14
  116. package/build/esm/{index-1b8bee31.js → index-34400a59.js} +2 -2
  117. package/build/esm/{index-9d368a52.js → index-363f17cf.js} +21 -21
  118. package/build/esm/{index-38378d3d.js → index-36bec6bb.js} +3 -3
  119. package/build/esm/{index-8d9be31d.js → index-37fb0987.js} +13 -13
  120. package/build/esm/{index-85de8bc8.js → index-386e43b1.js} +13 -13
  121. package/build/esm/{index-36987931.js → index-3992c8d4.js} +17 -17
  122. package/build/esm/{index-f553164d.js → index-3a8b29b4.js} +3 -3
  123. package/build/esm/{index-c55fb0c7.js → index-3b662cf8.js} +5 -5
  124. package/build/esm/{index-e68cca13.js → index-3e4223fe.js} +10 -10
  125. package/build/esm/{index-d15a459d.js → index-44932361.js} +17 -17
  126. package/build/esm/{index-be936e72.js → index-4d6b5301.js} +2 -2
  127. package/build/esm/{index-123655ef.js → index-50127890.js} +2 -2
  128. package/build/esm/{index-2f65032f.js → index-5acd728d.js} +6 -6
  129. package/build/esm/{index-db7f7f08.js → index-60bcab63.js} +1 -1
  130. package/build/esm/{index-13293188.js → index-6245b66b.js} +2 -2
  131. package/build/esm/{index-815dc140.js → index-662db5b7.js} +24 -24
  132. package/build/esm/{index-2a338d3f.js → index-663f72f5.js} +3 -3
  133. package/build/esm/{index-1da6b8c4.js → index-6a7614d1.js} +7 -7
  134. package/build/esm/{index-e975529a.js → index-6c5a0c74.js} +2 -2
  135. package/build/esm/index-6cf33c17.js +4013 -0
  136. package/build/esm/{index-230adb31.js → index-6fa5ac76.js} +3 -3
  137. package/build/esm/{index-9c14c4af.js → index-7418a32c.js} +2 -2
  138. package/build/esm/index-77225364.js +96 -0
  139. package/build/esm/{index-d7ffec42.js → index-7908e4ff.js} +16 -16
  140. package/build/esm/{index-587dca1f.js → index-7ed54614.js} +30 -30
  141. package/build/esm/{index-0982a002.js → index-7fee70e4.js} +3 -3
  142. package/build/esm/{index-0668f85c.js → index-813b32e4.js} +17 -17
  143. package/build/esm/{index-737db3be.js → index-81772684.js} +2 -2
  144. package/build/esm/{index-452968eb.js → index-89269f7e.js} +2 -2
  145. package/build/esm/{index-9eafbe6c.js → index-8dccb669.js} +18 -18
  146. package/build/esm/{index-945d5a71.js → index-915183b3.js} +1 -1
  147. package/build/esm/{index-c4b63c56.js → index-98ef5263.js} +3 -3
  148. package/build/esm/{index-521c6a0c.js → index-993de4d6.js} +13 -13
  149. package/build/esm/{index-3330a1a5.js → index-99655cbc.js} +2 -2
  150. package/build/esm/{index-cbe8ec85.js → index-9ab041aa.js} +1 -1
  151. package/build/esm/{index-eff9f904.js → index-a38d2351.js} +16 -16
  152. package/build/esm/{index-1853a9de.js → index-bb193a95.js} +1 -1
  153. package/build/esm/{index-bd313745.js → index-bd17eb4a.js} +18 -24
  154. package/build/esm/{index-cb6671de.js → index-c2325b70.js} +32 -32
  155. package/build/esm/{index-b87a8b69.js → index-cb0a2c0d.js} +7 -7
  156. package/build/esm/{index-5a1e82b3.js → index-cff2c593.js} +5 -5
  157. package/build/esm/{index-e9816b31.js → index-d53bf495.js} +15 -15
  158. package/build/esm/{index-1e12ffe2.js → index-d57214b0.js} +23 -13
  159. package/build/esm/{index-7052c7b0.js → index-db606269.js} +1 -1
  160. package/build/esm/{index-8d9e3179.js → index-dcb2ecbc.js} +2 -2
  161. package/build/esm/{index-3e8b2ccd.js → index-df46e084.js} +3 -3
  162. package/build/esm/{index-b8ca6394.js → index-e1ef9807.js} +2 -2
  163. package/build/esm/{index-94c25537.js → index-e422ad02.js} +1 -1
  164. package/build/esm/{index-79909b08.js → index-e47632c4.js} +4 -4
  165. package/build/esm/{index-526f2b6c.js → index-e9bc7d35.js} +16 -16
  166. package/build/esm/{index-2910ca55.js → index-eca43394.js} +16 -16
  167. package/build/esm/{index-adff8c44.js → index-ef1106eb.js} +6 -6
  168. package/build/esm/{index-bc0971ee.js → index-f8daa1b0.js} +1 -1
  169. package/build/esm/index.css +1 -1
  170. package/build/esm/index.js +146 -117
  171. package/build/esm/{labelSorting-cfc7acbd.js → labelSorting-7f70ac1e.js} +4 -4
  172. package/build/esm/lead/components/context.d.ts +2 -0
  173. package/build/esm/lead/components/index.d.ts +4 -2
  174. package/build/esm/lead/index.d.ts +1 -1
  175. package/build/esm/lead/layouts/ emptyIcon.d.ts +6 -0
  176. package/build/esm/lead/layouts/lightbox/fields/textField/index.d.ts +13 -0
  177. package/build/esm/lead/layouts/lightbox/fields/textField/index.styled.d.ts +11 -0
  178. package/build/esm/lead/layouts/lightbox/index.d.ts +4 -2
  179. package/build/esm/lead/newLeadPopup.d.ts +4 -2
  180. package/build/esm/lead.css +1 -1
  181. package/build/esm/lead.js +753 -350
  182. package/build/esm/{logoIcon-024fd614.js → logoIcon-b2e3b6df.js} +2 -2
  183. package/build/esm/mantine.js +25 -25
  184. package/build/esm/misc.js +16 -16
  185. package/build/esm/miscGetDynamicHealthTool.js +4 -4
  186. package/build/esm/miscGetSocialList.js +8 -8
  187. package/build/esm/miscScreenSizeContext.js +1 -1
  188. package/build/esm/mobileBottomNavigation.js +5 -5
  189. package/build/esm/mobileBottomNavigationIcon.js +5 -5
  190. package/build/esm/molecules.js +69 -69
  191. package/build/esm/moleculesArticleCard.js +6 -6
  192. package/build/esm/moleculesArticleCardV2.js +16 -16
  193. package/build/esm/navigation.js +40 -40
  194. package/build/esm/navigationLogoutPopup.js +9 -9
  195. package/build/esm/navigationProfileButton.js +23 -23
  196. package/build/esm/onboardingV2.js +29 -29
  197. package/build/esm/organisms.js +44 -44
  198. package/build/esm/{other-f9bf3f6d.js → other-0db5dab2.js} +1 -0
  199. package/build/esm/{post-126f46d9.js → post-403e7563.js} +3 -3
  200. package/build/esm/profileNavigation.js +19 -19
  201. package/build/esm/progressBar.js +1 -1
  202. package/build/esm/pwg.js +22 -22
  203. package/build/esm/ssoV2/api/featureFlag.d.ts +1 -0
  204. package/build/esm/ssoV2/api/index.d.ts +1 -0
  205. package/build/esm/ssoV2/api/paths.d.ts +7 -0
  206. package/build/esm/ssoV2/api/whatsapp.d.ts +6 -0
  207. package/build/esm/ssoV2/screens/components/progressBar.d.ts +3 -1
  208. package/build/esm/ssoV2/screens/components/whatsapp.d.ts +5 -0
  209. package/build/esm/ssoV2/screens/first/firstBFlow.d.ts +12 -0
  210. package/build/esm/ssoV2/screens/first/policyContent.d.ts +8 -0
  211. package/build/esm/ssoV2/screens/otp.d.ts +1 -1
  212. package/build/esm/ssoV2/ssoStateManager/store.d.ts +9 -1
  213. package/build/esm/ssoV2/utils.d.ts +6 -0
  214. package/build/esm/ssoV2.js +580 -142
  215. package/build/esm/{store-937026d6.js → store-d1eca1fa.js} +114 -9
  216. package/build/esm/subot.js +33 -33
  217. package/build/esm/surveyOrPremiumBanner.js +31 -31
  218. package/build/esm/surveyQuestionCard.js +10 -10
  219. package/build/esm/{surveyThankyouCard-dddd60e0.js → surveyThankyouCard-1386cdb8.js} +5 -5
  220. package/build/esm/together/api/paths.d.ts +2 -0
  221. package/build/esm/together/api/utils.d.ts +3 -0
  222. package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/cardPostCommunity/index.d.ts +7 -0
  223. package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/cardPostCommunity/index.styled.d.ts +5 -0
  224. package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/commonCommunity/index.d.ts +15 -0
  225. package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/commonCommunity/index.styled.d.ts +13 -0
  226. package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/index.d.ts +31 -0
  227. package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/index.styled.d.ts +9 -0
  228. package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/index.styles.d.ts +12 -0
  229. package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/suggestedCommunity/index.d.ts +11 -0
  230. package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/suggestedCommunity/index.styled.d.ts +17 -0
  231. package/build/esm/together/components/molecules/createNewPostContentV2/createPostDescription/editor.d.ts +21 -0
  232. package/build/esm/together/components/molecules/createNewPostContentV2/createPostDescription/index.d.ts +21 -0
  233. package/build/esm/together/components/molecules/createNewPostContentV2/createPostDescription/index.styled.d.ts +9 -0
  234. package/build/esm/together/components/molecules/createNewPostContentV2/createPostPhotos/index.d.ts +7 -0
  235. package/build/esm/together/components/molecules/createNewPostContentV2/createPostTitle/index.d.ts +11 -0
  236. package/build/esm/together/components/molecules/createNewPostContentV2/createPostTitle/index.styled.d.ts +12 -0
  237. package/build/esm/together/components/molecules/createNewPostContentV2/index.d.ts +27 -0
  238. package/build/esm/together/components/molecules/createNewPostContentV2/index.styled.d.ts +33 -0
  239. package/build/esm/together/components/molecules/createNewPostContentV2/postPhotosReview/index.d.ts +10 -0
  240. package/build/esm/together/components/molecules/createNewPostContentV2/postPhotosReview/index.styled.d.ts +5 -0
  241. package/build/esm/together/components/molecules/createNewPostContentV2/postPhotosReview/index.styles.d.ts +12 -0
  242. package/build/esm/together/components/molecules/createNewPostContentV2/topicSelectList/index.d.ts +16 -0
  243. package/build/esm/together/components/molecules/createNewPostContentV2/topicSelectList/index.styled.d.ts +5 -0
  244. package/build/esm/together/components/molecules/createNewPostContentV2/type.d.ts +4 -0
  245. package/build/esm/together/components/molecules/createNewPostContentV2/types.d.ts +14 -0
  246. package/build/esm/together/components/molecules/index.d.ts +1 -0
  247. package/build/esm/together/components/molecules/postImagePreview/index.d.ts +2 -1
  248. package/build/esm/together/togetherComponentGlobalContext.d.ts +1 -0
  249. package/build/esm/together.js +53 -53
  250. package/build/esm/togetherApiPaths.js +4 -2
  251. package/build/esm/togetherApiUtils.js +4 -4
  252. package/build/esm/togetherAtoms.js +30 -30
  253. package/build/esm/togetherComponentGlobalContext.js +4 -4
  254. package/build/esm/togetherMolecules.js +48 -48
  255. package/build/esm/togetherMoleculesCardAuthor.js +27 -27
  256. package/build/esm/togetherMoleculesPostImagePreview.js +11 -11
  257. package/build/esm/togetherMoleculesProfileDetail.js +37 -37
  258. package/build/esm/togetherOrganisms.js +47 -47
  259. package/build/esm/togetherRichTextEditor.js +17 -17
  260. package/build/esm/togetherShareBox.js +11 -26
  261. package/build/esm/{treePopoverMenu-6d3392c6.js → treePopoverMenu-f031a29b.js} +19 -19
  262. package/build/esm/{types-787fdf6c.js → types-2fc793a8.js} +2 -2
  263. package/build/esm/types.js +2 -2
  264. package/build/esm/{useCategory-a0fa12e8.js → useCategory-ad6a4d34.js} +5 -5
  265. package/build/esm/{useHealthToolCache-7cf19f32.js → useHealthToolCache-28a49075.js} +1 -1
  266. package/build/esm/{useMantineLocale-5fd08281.js → useMantineLocale-1c095a66.js} +6 -6
  267. package/build/esm/{usePlacesAutocomplete-c942413f.js → usePlacesAutocomplete-1e1bf12f.js} +2 -1
  268. package/build/esm/{useScreenSize-11bcbfcc.js → useScreenSize-3a80d6c1.js} +2 -2
  269. package/build/esm/useTogetherAuthRequiredAction.js +9 -9
  270. package/build/esm/{utils-af3e4870.js → utils-2c532973.js} +2 -2
  271. package/build/esm/{utils-8b70a691.js → utils-d0d4f26f.js} +2 -2
  272. package/build/esm/{utils-b417174f.js → utils-d3ab24c2.js} +13 -4
  273. package/build/esm/vaccination.js +21 -21
  274. package/build/footer.js +21 -21
  275. package/build/gAssets.js +2 -2
  276. package/build/healthToolsCardWrapper.js +18 -18
  277. package/build/healthToolsForm.js +33 -33
  278. package/build/hooks/usePlacesAutocomplete.d.ts +2 -0
  279. package/build/hooks.js +13 -13
  280. package/build/i18n/translationKeys.d.ts +1 -1
  281. package/build/i18n-values/en-PH.js +16 -1
  282. package/build/i18n-values/hi-IN.js +16 -1
  283. package/build/i18n-values/id-ID.js +16 -1
  284. package/build/i18n-values/km-KH.js +20 -5
  285. package/build/i18n-values/ms-MY.js +16 -1
  286. package/build/i18n-values/my-MM.js +16 -1
  287. package/build/i18n-values/th-TH.js +16 -1
  288. package/build/i18n-values/tl-PH.js +15 -0
  289. package/build/i18n-values/vi-VN.js +18 -3
  290. package/build/i18n-values/vi-VN_MB.js +17 -2
  291. package/build/i18n-values/zh-TW.js +16 -1
  292. package/build/i18n.js +1 -1
  293. package/build/i18nV2.js +1 -1
  294. package/build/icons/ChatbotBg.d.ts +4 -0
  295. package/build/icons/Search.d.ts +4 -0
  296. package/build/icons/index.d.ts +5 -3
  297. package/build/{index-eb99216b.js → index-0130a454.js} +2 -2
  298. package/build/{index-7ea932b9.js → index-0b1c5835.js} +17 -17
  299. package/build/{index-9ff1bb36.js → index-14ae8248.js} +3 -3
  300. package/build/{index-8c16bd1f.js → index-15a499ed.js} +2 -2
  301. package/build/{index-3432b1c6.js → index-162cf5ec.js} +13 -13
  302. package/build/{index-c297b1f0.js → index-168cb23c.js} +20 -20
  303. package/build/{index-d1c81e81.js → index-193192d9.js} +1 -1
  304. package/build/{index-4fc7edb3.js → index-1a1895dc.js} +6 -6
  305. package/build/{index-18f346d7.js → index-235ee6a4.js} +1 -1
  306. package/build/{index-4bf4104b.js → index-24744e1d.js} +2 -2
  307. package/build/{index-3ebe1824.js → index-24ad1f42.js} +13 -13
  308. package/build/{index-e82361de.js → index-24dc48d7.js} +3 -3
  309. package/build/{index-ecd3b645.js → index-29a53d3c.js} +2 -2
  310. package/build/{index-cf29a8cb.js → index-38aa9aae.js} +1 -1
  311. package/build/{index-beeded5c.js → index-393e9124.js} +2 -2
  312. package/build/{index-4f94ee57.js → index-396aca20.js} +3 -3
  313. package/build/{index-9c5bf014.js → index-3ec47f62.js} +1 -1
  314. package/build/{index-49c62b30.js → index-40a47778.js} +10 -10
  315. package/build/{index-b664e501.js → index-48ead17e.js} +3 -3
  316. package/build/{index-1f6f7242.js → index-4c063acd.js} +6 -6
  317. package/build/{index-7b9dff6f.js → index-50394ff2.js} +16 -16
  318. package/build/{index-3af36119.js → index-591ad0ca.js} +1 -1
  319. package/build/{index-ccb74872.js → index-5d8baaf6.js} +1 -1
  320. package/build/{index-81a129cd.js → index-5ddf7e2d.js} +1 -1
  321. package/build/{index-a9c442d7.js → index-62fbd1d0.js} +2 -2
  322. package/build/{index-68f35f42.js → index-6ea74eeb.js} +24 -24
  323. package/build/{index-b0471cfe.js → index-7017d901.js} +5 -5
  324. package/build/{index-559021c0.js → index-7ca5e861.js} +3 -3
  325. package/build/{index-7a0d23fd.js → index-7d255c7b.js} +7 -7
  326. package/build/{index-0ef028da.js → index-7d868903.js} +3 -3
  327. package/build/{index-37407423.js → index-7dc1bc92.js} +2 -2
  328. package/build/{index-532b1cd6.js → index-814045ef.js} +2 -2
  329. package/build/{index-192e338c.js → index-82632b4a.js} +17 -17
  330. package/build/{index-145fe27d.js → index-8976b33e.js} +18 -18
  331. package/build/{index-0b869059.js → index-8e25c967.js} +2 -2
  332. package/build/{index-0c875dfb.js → index-94a58e2b.js} +17 -17
  333. package/build/{index-01d1fcca.js → index-997d3769.js} +3 -3
  334. package/build/{index-68d28651.js → index-9a11ed37.js} +32 -32
  335. package/build/{index-a8e7297d.js → index-9e9a9169.js} +15 -15
  336. package/build/{index-b4169dcd.js → index-9fb3018a.js} +18 -24
  337. package/build/{index-b6555da2.js → index-a2924e1e.js} +6 -6
  338. package/build/{index-2cfe485f.js → index-a9722b58.js} +4 -4
  339. package/build/{index-4e3d0ce7.js → index-aa89a022.js} +13 -13
  340. package/build/{index-f194fe0a.js → index-b0c5d4ef.js} +16 -16
  341. package/build/{index-31e8674f.js → index-b3e0585e.js} +23 -12
  342. package/build/{index-7a077f5a.js → index-b3fb752f.js} +16 -16
  343. package/build/{index-af7ec0fa.js → index-b51c88e2.js} +14 -14
  344. package/build/{index-cd1c7203.js → index-b5cd6a21.js} +5 -5
  345. package/build/{index-a336f953.js → index-b6847418.js} +2 -2
  346. package/build/index-c10d9832.js +4047 -0
  347. package/build/{index-d8846871.js → index-c5376e9c.js} +16 -16
  348. package/build/index-d699cb98.js +103 -0
  349. package/build/{index-cf488262.js → index-dc3ef09a.js} +2 -2
  350. package/build/{index-d4ff6de4.js → index-e294968d.js} +1 -1
  351. package/build/{index-08ed5b29.js → index-e8ad0b71.js} +30 -30
  352. package/build/{index-7097786d.js → index-e8b1a161.js} +15 -15
  353. package/build/{index-0f12f189.js → index-ec184323.js} +21 -21
  354. package/build/{index-b35e6f64.js → index-ec9f092e.js} +24 -24
  355. package/build/{index-02ceb781.js → index-ef816e26.js} +7 -7
  356. package/build/{index-e55fc286.js → index-f5666a40.js} +2 -2
  357. package/build/{index-64199471.js → index-f888f598.js} +13 -13
  358. package/build/{index-e3c1a688.js → index-fd3183da.js} +2 -2
  359. package/build/index.css +1 -1
  360. package/build/index.js +211 -178
  361. package/build/{labelSorting-59b40f42.js → labelSorting-469fb53d.js} +4 -4
  362. package/build/lead/components/context.d.ts +2 -0
  363. package/build/lead/components/index.d.ts +4 -2
  364. package/build/lead/index.d.ts +1 -1
  365. package/build/lead/layouts/ emptyIcon.d.ts +6 -0
  366. package/build/lead/layouts/lightbox/fields/textField/index.d.ts +13 -0
  367. package/build/lead/layouts/lightbox/fields/textField/index.styled.d.ts +11 -0
  368. package/build/lead/layouts/lightbox/index.d.ts +4 -2
  369. package/build/lead/newLeadPopup.d.ts +4 -2
  370. package/build/lead.css +1 -1
  371. package/build/lead.js +753 -349
  372. package/build/{logoIcon-07538b4d.js → logoIcon-f8693e15.js} +2 -2
  373. package/build/mantine.js +22 -22
  374. package/build/misc.js +16 -16
  375. package/build/miscGetDynamicHealthTool.js +4 -4
  376. package/build/miscGetSocialList.js +8 -8
  377. package/build/miscScreenSizeContext.js +1 -1
  378. package/build/mobileBottomNavigation.js +5 -5
  379. package/build/mobileBottomNavigationIcon.js +5 -5
  380. package/build/molecules.js +69 -69
  381. package/build/moleculesArticleCard.js +6 -6
  382. package/build/moleculesArticleCardV2.js +16 -16
  383. package/build/navigation.js +40 -40
  384. package/build/navigationLogoutPopup.js +9 -9
  385. package/build/navigationProfileButton.js +23 -23
  386. package/build/onboardingV2.js +28 -28
  387. package/build/organisms.js +44 -44
  388. package/build/{other-8c01b366.js → other-50a0b3de.js} +1 -0
  389. package/build/{post-1e4e6b72.js → post-cd6c6c29.js} +2 -2
  390. package/build/profileNavigation.js +19 -19
  391. package/build/progressBar.js +1 -1
  392. package/build/pwg.js +22 -22
  393. package/build/ssoV2/api/featureFlag.d.ts +1 -0
  394. package/build/ssoV2/api/index.d.ts +1 -0
  395. package/build/ssoV2/api/paths.d.ts +7 -0
  396. package/build/ssoV2/api/whatsapp.d.ts +6 -0
  397. package/build/ssoV2/screens/components/progressBar.d.ts +3 -1
  398. package/build/ssoV2/screens/components/whatsapp.d.ts +5 -0
  399. package/build/ssoV2/screens/first/firstBFlow.d.ts +12 -0
  400. package/build/ssoV2/screens/first/policyContent.d.ts +8 -0
  401. package/build/ssoV2/screens/otp.d.ts +1 -1
  402. package/build/ssoV2/ssoStateManager/store.d.ts +9 -1
  403. package/build/ssoV2/utils.d.ts +6 -0
  404. package/build/ssoV2.js +591 -153
  405. package/build/{store-d0c4a5e4.js → store-a713b63a.js} +114 -8
  406. package/build/subot.js +32 -32
  407. package/build/surveyOrPremiumBanner.js +31 -31
  408. package/build/surveyQuestionCard.js +10 -10
  409. package/build/{surveyThankyouCard-93c2b9e1.js → surveyThankyouCard-80794b25.js} +5 -5
  410. package/build/together/api/paths.d.ts +2 -0
  411. package/build/together/api/utils.d.ts +3 -0
  412. package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/cardPostCommunity/index.d.ts +7 -0
  413. package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/cardPostCommunity/index.styled.d.ts +5 -0
  414. package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/commonCommunity/index.d.ts +15 -0
  415. package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/commonCommunity/index.styled.d.ts +13 -0
  416. package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/index.d.ts +31 -0
  417. package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/index.styled.d.ts +9 -0
  418. package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/index.styles.d.ts +12 -0
  419. package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/suggestedCommunity/index.d.ts +11 -0
  420. package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/suggestedCommunity/index.styled.d.ts +17 -0
  421. package/build/together/components/molecules/createNewPostContentV2/createPostDescription/editor.d.ts +21 -0
  422. package/build/together/components/molecules/createNewPostContentV2/createPostDescription/index.d.ts +21 -0
  423. package/build/together/components/molecules/createNewPostContentV2/createPostDescription/index.styled.d.ts +9 -0
  424. package/build/together/components/molecules/createNewPostContentV2/createPostPhotos/index.d.ts +7 -0
  425. package/build/together/components/molecules/createNewPostContentV2/createPostTitle/index.d.ts +11 -0
  426. package/build/together/components/molecules/createNewPostContentV2/createPostTitle/index.styled.d.ts +12 -0
  427. package/build/together/components/molecules/createNewPostContentV2/index.d.ts +27 -0
  428. package/build/together/components/molecules/createNewPostContentV2/index.styled.d.ts +33 -0
  429. package/build/together/components/molecules/createNewPostContentV2/postPhotosReview/index.d.ts +10 -0
  430. package/build/together/components/molecules/createNewPostContentV2/postPhotosReview/index.styled.d.ts +5 -0
  431. package/build/together/components/molecules/createNewPostContentV2/postPhotosReview/index.styles.d.ts +12 -0
  432. package/build/together/components/molecules/createNewPostContentV2/topicSelectList/index.d.ts +16 -0
  433. package/build/together/components/molecules/createNewPostContentV2/topicSelectList/index.styled.d.ts +5 -0
  434. package/build/together/components/molecules/createNewPostContentV2/type.d.ts +4 -0
  435. package/build/together/components/molecules/createNewPostContentV2/types.d.ts +14 -0
  436. package/build/together/components/molecules/index.d.ts +1 -0
  437. package/build/together/components/molecules/postImagePreview/index.d.ts +2 -1
  438. package/build/together/togetherComponentGlobalContext.d.ts +1 -0
  439. package/build/together.js +54 -53
  440. package/build/togetherApiPaths.js +4 -2
  441. package/build/togetherApiUtils.js +5 -4
  442. package/build/togetherAtoms.js +30 -30
  443. package/build/togetherComponentGlobalContext.js +4 -4
  444. package/build/togetherMolecules.js +49 -48
  445. package/build/togetherMoleculesCardAuthor.js +27 -27
  446. package/build/togetherMoleculesPostImagePreview.js +11 -11
  447. package/build/togetherMoleculesProfileDetail.js +37 -37
  448. package/build/togetherOrganisms.js +47 -47
  449. package/build/togetherRichTextEditor.js +17 -17
  450. package/build/togetherShareBox.js +11 -26
  451. package/build/{treePopoverMenu-9c6f299f.js → treePopoverMenu-889d80ba.js} +19 -19
  452. package/build/{types-98e7c3a2.js → types-0c05791e.js} +2 -2
  453. package/build/types.js +2 -2
  454. package/build/{useCategory-7a1ab711.js → useCategory-55a423cc.js} +5 -5
  455. package/build/{useHealthToolCache-82b1911f.js → useHealthToolCache-84921b9b.js} +1 -1
  456. package/build/{useMantineLocale-d9ecaa5f.js → useMantineLocale-0cc2d977.js} +6 -6
  457. package/build/{usePlacesAutocomplete-67fa9759.js → usePlacesAutocomplete-07762c76.js} +2 -1
  458. package/build/{useScreenSize-b40e4305.js → useScreenSize-c85a7f01.js} +2 -2
  459. package/build/useTogetherAuthRequiredAction.js +9 -9
  460. package/build/{utils-4c1a6793.js → utils-44d3d6e7.js} +2 -2
  461. package/build/{utils-6761a983.js → utils-872abd64.js} +2 -2
  462. package/build/{utils-c69ec5e6.js → utils-c1ec3cc4.js} +13 -3
  463. package/build/vaccination.js +21 -21
  464. package/package.json +1 -1
  465. package/build/esm/index-c21e43f7.js +0 -1533
  466. package/build/index-1596c959.js +0 -1547
  467. /package/build/{BMI_BOYS.percentile.monthly-2f2f928d.js → BMI_BOYS.percentile.monthly-6337a2c7.js} +0 -0
  468. /package/build/{BMI_BOYS.percentile.weekly-7e24810c.js → BMI_BOYS.percentile.weekly-fa39b2e6.js} +0 -0
  469. /package/build/{BMI_BOYS.percentile.yearly-81f8dac9.js → BMI_BOYS.percentile.yearly-1eaf306b.js} +0 -0
  470. /package/build/{BMI_BOYS.zscore.monthly-a1363b20.js → BMI_BOYS.zscore.monthly-851088df.js} +0 -0
  471. /package/build/{BMI_BOYS.zscore.weekly-ba2583ff.js → BMI_BOYS.zscore.weekly-175cdc97.js} +0 -0
  472. /package/build/{BMI_BOYS.zscore.yearly-62c54183.js → BMI_BOYS.zscore.yearly-5937ecfa.js} +0 -0
  473. /package/build/{BMI_GIRLS.percentile.monthly-98bfbad1.js → BMI_GIRLS.percentile.monthly-8073e552.js} +0 -0
  474. /package/build/{BMI_GIRLS.percentile.weekly-036ea7b6.js → BMI_GIRLS.percentile.weekly-5c7a9b5f.js} +0 -0
  475. /package/build/{BMI_GIRLS.percentile.yearly-23c106af.js → BMI_GIRLS.percentile.yearly-7462e3cf.js} +0 -0
  476. /package/build/{BMI_GIRLS.zscore.monthly-b355926b.js → BMI_GIRLS.zscore.monthly-2e1abf01.js} +0 -0
  477. /package/build/{BMI_GIRLS.zscore.weekly-7f660a6e.js → BMI_GIRLS.zscore.weekly-a27d90ae.js} +0 -0
  478. /package/build/{BMI_GIRLS.zscore.yearly-dcd261ee.js → BMI_GIRLS.zscore.yearly-199d33bc.js} +0 -0
  479. /package/build/{ChevronDown-9d3d7b9c.js → ChevronDown-6646fd47.js} +0 -0
  480. /package/build/{Close-088d8ac5.js → Close-acfa8c86.js} +0 -0
  481. /package/build/{Google-25f7be94.js → Google-3e0ecf57.js} +0 -0
  482. /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-ffbc283d.js → HEAD CIRCUM_BOYS.percentile.monthly-c39e84b8.js} +0 -0
  483. /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-eb80ed27.js → HEAD CIRCUM_BOYS.percentile.weekly-17a9f67f.js} +0 -0
  484. /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-cfd524be.js → HEAD CIRCUM_BOYS.percentile.yearly-53db10b8.js} +0 -0
  485. /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-9c834e4c.js → HEAD CIRCUM_BOYS.zscore.monthly-9024b5f9.js} +0 -0
  486. /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-bf24e14d.js → HEAD CIRCUM_BOYS.zscore.weekly-93e16617.js} +0 -0
  487. /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-33244c0b.js → HEAD CIRCUM_BOYS.zscore.yearly-32adcfa6.js} +0 -0
  488. /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-2119f263.js → HEAD CIRCUM_GIRLS.percentile.monthly-4ee6667f.js} +0 -0
  489. /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-76f04daa.js → HEAD CIRCUM_GIRLS.percentile.weekly-ddf49204.js} +0 -0
  490. /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-80b14bf5.js → HEAD CIRCUM_GIRLS.percentile.yearly-6d6a8456.js} +0 -0
  491. /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-0dc71b80.js → HEAD CIRCUM_GIRLS.zscore.monthly-5de917f7.js} +0 -0
  492. /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-b179533a.js → HEAD CIRCUM_GIRLS.zscore.weekly-716eac35.js} +0 -0
  493. /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-6c2c43d7.js → HEAD CIRCUM_GIRLS.zscore.yearly-b6b319cb.js} +0 -0
  494. /package/build/{HEIGHT_BOYS.percentile.monthly-fd53ff3a.js → HEIGHT_BOYS.percentile.monthly-0b9355cf.js} +0 -0
  495. /package/build/{HEIGHT_BOYS.percentile.weekly-bea10e78.js → HEIGHT_BOYS.percentile.weekly-91f90514.js} +0 -0
  496. /package/build/{HEIGHT_BOYS.percentile.yearly-d005441d.js → HEIGHT_BOYS.percentile.yearly-a6be39f1.js} +0 -0
  497. /package/build/{HEIGHT_BOYS.zscore.monthly-d5871f7f.js → HEIGHT_BOYS.zscore.monthly-5c280bcc.js} +0 -0
  498. /package/build/{HEIGHT_BOYS.zscore.weekly-c7a971d5.js → HEIGHT_BOYS.zscore.weekly-8892a3e2.js} +0 -0
  499. /package/build/{HEIGHT_BOYS.zscore.yearly-e0daca1d.js → HEIGHT_BOYS.zscore.yearly-e22fdc89.js} +0 -0
  500. /package/build/{HEIGHT_GIRLS.percentile.monthly-16a28494.js → HEIGHT_GIRLS.percentile.monthly-203d80e4.js} +0 -0
  501. /package/build/{HEIGHT_GIRLS.percentile.weekly-f72c6498.js → HEIGHT_GIRLS.percentile.weekly-b70110c1.js} +0 -0
  502. /package/build/{HEIGHT_GIRLS.percentile.yearly-e639e06e.js → HEIGHT_GIRLS.percentile.yearly-4673ac32.js} +0 -0
  503. /package/build/{HEIGHT_GIRLS.zscore.monthly-49ee3f65.js → HEIGHT_GIRLS.zscore.monthly-04a15496.js} +0 -0
  504. /package/build/{HEIGHT_GIRLS.zscore.weekly-75b6db14.js → HEIGHT_GIRLS.zscore.weekly-f2a6e2f3.js} +0 -0
  505. /package/build/{HEIGHT_GIRLS.zscore.yearly-7f170e82.js → HEIGHT_GIRLS.zscore.yearly-146a83ba.js} +0 -0
  506. /package/build/{Locale-9d76089c.js → Locale-46500920.js} +0 -0
  507. /package/build/{Visible-f7357dea.js → Visible-b2ca2811.js} +0 -0
  508. /package/build/{WEIGHT_BOYS.percentile.monthly-09c9209a.js → WEIGHT_BOYS.percentile.monthly-ce64c00f.js} +0 -0
  509. /package/build/{WEIGHT_BOYS.percentile.weekly-13f6c1fa.js → WEIGHT_BOYS.percentile.weekly-d8b54060.js} +0 -0
  510. /package/build/{WEIGHT_BOYS.percentile.yearly-cf517b5f.js → WEIGHT_BOYS.percentile.yearly-b1a691e5.js} +0 -0
  511. /package/build/{WEIGHT_BOYS.zscore.monthly-3af2f51a.js → WEIGHT_BOYS.zscore.monthly-b8180ab3.js} +0 -0
  512. /package/build/{WEIGHT_BOYS.zscore.weekly-ec101877.js → WEIGHT_BOYS.zscore.weekly-6efaa547.js} +0 -0
  513. /package/build/{WEIGHT_BOYS.zscore.yearly-dd575af7.js → WEIGHT_BOYS.zscore.yearly-ff104f70.js} +0 -0
  514. /package/build/{WEIGHT_GIRLS.percentile.monthly-106e896d.js → WEIGHT_GIRLS.percentile.monthly-ffe5fb55.js} +0 -0
  515. /package/build/{WEIGHT_GIRLS.percentile.weekly-53154421.js → WEIGHT_GIRLS.percentile.weekly-7f9490d0.js} +0 -0
  516. /package/build/{WEIGHT_GIRLS.percentile.yearly-3e01a7ca.js → WEIGHT_GIRLS.percentile.yearly-99f26592.js} +0 -0
  517. /package/build/{WEIGHT_GIRLS.zscore.monthly-035a8445.js → WEIGHT_GIRLS.zscore.monthly-7ef27570.js} +0 -0
  518. /package/build/{WEIGHT_GIRLS.zscore.weekly-de0848cb.js → WEIGHT_GIRLS.zscore.weekly-4b489c3f.js} +0 -0
  519. /package/build/{WEIGHT_GIRLS.zscore.yearly-34e0310d.js → WEIGHT_GIRLS.zscore.yearly-25f8790b.js} +0 -0
  520. /package/build/{animation-b679f087.js → animation-ed541692.js} +0 -0
  521. /package/build/{constants-a9df2dc4.js → constants-3b2ad03d.js} +0 -0
  522. /package/build/{constants-c590c60e.js → constants-7fc2f0d3.js} +0 -0
  523. /package/build/{constants-1b37a00c.js → constants-eb2323ad.js} +0 -0
  524. /package/build/{dataTransform-946e1e43.js → dataTransform-ed9d25b3.js} +0 -0
  525. /package/build/{doctor-e7e731d5.js → doctor-45a98dfc.js} +0 -0
  526. /package/build/esm/{BMI_BOYS.percentile.monthly-749f4ff1.js → BMI_BOYS.percentile.monthly-f2cf5eae.js} +0 -0
  527. /package/build/esm/{BMI_BOYS.percentile.weekly-1b0d8d77.js → BMI_BOYS.percentile.weekly-0145a904.js} +0 -0
  528. /package/build/esm/{BMI_BOYS.percentile.yearly-2d99a39a.js → BMI_BOYS.percentile.yearly-67c360ab.js} +0 -0
  529. /package/build/esm/{BMI_BOYS.zscore.monthly-3aa69438.js → BMI_BOYS.zscore.monthly-4016078d.js} +0 -0
  530. /package/build/esm/{BMI_BOYS.zscore.weekly-da93e931.js → BMI_BOYS.zscore.weekly-f40a0cf4.js} +0 -0
  531. /package/build/esm/{BMI_BOYS.zscore.yearly-b0c89cae.js → BMI_BOYS.zscore.yearly-9784ed8c.js} +0 -0
  532. /package/build/esm/{BMI_GIRLS.percentile.monthly-92457f2e.js → BMI_GIRLS.percentile.monthly-bd8a858b.js} +0 -0
  533. /package/build/esm/{BMI_GIRLS.percentile.weekly-73b416b8.js → BMI_GIRLS.percentile.weekly-0629c8ac.js} +0 -0
  534. /package/build/esm/{BMI_GIRLS.percentile.yearly-02cd164f.js → BMI_GIRLS.percentile.yearly-31ec01f4.js} +0 -0
  535. /package/build/esm/{BMI_GIRLS.zscore.monthly-43e43cfd.js → BMI_GIRLS.zscore.monthly-3c941b8a.js} +0 -0
  536. /package/build/esm/{BMI_GIRLS.zscore.weekly-f4bfe5f4.js → BMI_GIRLS.zscore.weekly-67d9e952.js} +0 -0
  537. /package/build/esm/{BMI_GIRLS.zscore.yearly-6a2ad249.js → BMI_GIRLS.zscore.yearly-39bb1163.js} +0 -0
  538. /package/build/esm/{ChevronDown-b8d5b3a6.js → ChevronDown-0a237fe1.js} +0 -0
  539. /package/build/esm/{Close-29383bc8.js → Close-8ec53854.js} +0 -0
  540. /package/build/esm/{Google-8ccb1c86.js → Google-2abb6d1e.js} +0 -0
  541. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-6dcfff5c.js → HEAD CIRCUM_BOYS.percentile.monthly-5af4c0cf.js} +0 -0
  542. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-ba419b4a.js → HEAD CIRCUM_BOYS.percentile.weekly-8b55aea6.js} +0 -0
  543. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-20a6e1d1.js → HEAD CIRCUM_BOYS.percentile.yearly-00c4cd86.js} +0 -0
  544. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-8d4a3ac8.js → HEAD CIRCUM_BOYS.zscore.monthly-fa7f6d17.js} +0 -0
  545. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-975f4471.js → HEAD CIRCUM_BOYS.zscore.weekly-412720ed.js} +0 -0
  546. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-8ad8ad71.js → HEAD CIRCUM_BOYS.zscore.yearly-933cf312.js} +0 -0
  547. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-71269cc3.js → HEAD CIRCUM_GIRLS.percentile.monthly-7dbd4c64.js} +0 -0
  548. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-186275c1.js → HEAD CIRCUM_GIRLS.percentile.weekly-145fae5a.js} +0 -0
  549. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-ce02adcd.js → HEAD CIRCUM_GIRLS.percentile.yearly-ed8721c1.js} +0 -0
  550. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-ab37a6bd.js → HEAD CIRCUM_GIRLS.zscore.monthly-6270e769.js} +0 -0
  551. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-1c138752.js → HEAD CIRCUM_GIRLS.zscore.weekly-68dfc85f.js} +0 -0
  552. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-e9f86886.js → HEAD CIRCUM_GIRLS.zscore.yearly-bad5818a.js} +0 -0
  553. /package/build/esm/{HEIGHT_BOYS.percentile.monthly-34ed5c0d.js → HEIGHT_BOYS.percentile.monthly-409700e6.js} +0 -0
  554. /package/build/esm/{HEIGHT_BOYS.percentile.weekly-829700ee.js → HEIGHT_BOYS.percentile.weekly-a3239541.js} +0 -0
  555. /package/build/esm/{HEIGHT_BOYS.percentile.yearly-ec71a3fa.js → HEIGHT_BOYS.percentile.yearly-9b7c3292.js} +0 -0
  556. /package/build/esm/{HEIGHT_BOYS.zscore.monthly-8b4e2a97.js → HEIGHT_BOYS.zscore.monthly-384eb890.js} +0 -0
  557. /package/build/esm/{HEIGHT_BOYS.zscore.weekly-86b61e9a.js → HEIGHT_BOYS.zscore.weekly-f11a3f12.js} +0 -0
  558. /package/build/esm/{HEIGHT_BOYS.zscore.yearly-602fddbe.js → HEIGHT_BOYS.zscore.yearly-cf037809.js} +0 -0
  559. /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-d2ecb80e.js → HEIGHT_GIRLS.percentile.monthly-e6a77a33.js} +0 -0
  560. /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-a3f105d3.js → HEIGHT_GIRLS.percentile.weekly-dfd33b25.js} +0 -0
  561. /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-9f1734f2.js → HEIGHT_GIRLS.percentile.yearly-9c893db0.js} +0 -0
  562. /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-e44d78d7.js → HEIGHT_GIRLS.zscore.monthly-db8fff55.js} +0 -0
  563. /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-92a73070.js → HEIGHT_GIRLS.zscore.weekly-8698b559.js} +0 -0
  564. /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-9fbb071d.js → HEIGHT_GIRLS.zscore.yearly-a8818df0.js} +0 -0
  565. /package/build/esm/{Locale-22ec3908.js → Locale-00bfd7ae.js} +0 -0
  566. /package/build/esm/{Visible-bb919e6d.js → Visible-ea326bdf.js} +0 -0
  567. /package/build/esm/{WEIGHT_BOYS.percentile.monthly-0aa80f60.js → WEIGHT_BOYS.percentile.monthly-ed97a016.js} +0 -0
  568. /package/build/esm/{WEIGHT_BOYS.percentile.weekly-cd67b3db.js → WEIGHT_BOYS.percentile.weekly-52b2ba8f.js} +0 -0
  569. /package/build/esm/{WEIGHT_BOYS.percentile.yearly-c424241d.js → WEIGHT_BOYS.percentile.yearly-938fb5ab.js} +0 -0
  570. /package/build/esm/{WEIGHT_BOYS.zscore.monthly-699042b7.js → WEIGHT_BOYS.zscore.monthly-9cedf9fe.js} +0 -0
  571. /package/build/esm/{WEIGHT_BOYS.zscore.weekly-29afee99.js → WEIGHT_BOYS.zscore.weekly-5661c740.js} +0 -0
  572. /package/build/esm/{WEIGHT_BOYS.zscore.yearly-c611c753.js → WEIGHT_BOYS.zscore.yearly-553b054d.js} +0 -0
  573. /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-319b82bc.js → WEIGHT_GIRLS.percentile.monthly-db164c0b.js} +0 -0
  574. /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-17db85b6.js → WEIGHT_GIRLS.percentile.weekly-f6bf7418.js} +0 -0
  575. /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-95ad118d.js → WEIGHT_GIRLS.percentile.yearly-014f7957.js} +0 -0
  576. /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-f1d157a9.js → WEIGHT_GIRLS.zscore.monthly-fda7dd74.js} +0 -0
  577. /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-847a6e3b.js → WEIGHT_GIRLS.zscore.weekly-136807df.js} +0 -0
  578. /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-3a824923.js → WEIGHT_GIRLS.zscore.yearly-2e586fff.js} +0 -0
  579. /package/build/esm/{animation-9d4336ef.js → animation-07c05d28.js} +0 -0
  580. /package/build/esm/{constants-6b039ef7.js → constants-7afbacd8.js} +0 -0
  581. /package/build/esm/{constants-c3212847.js → constants-8fbe2670.js} +0 -0
  582. /package/build/esm/{constants-2e19be73.js → constants-dc697937.js} +0 -0
  583. /package/build/esm/{dataTransform-d0cf26c9.js → dataTransform-ecd54e69.js} +0 -0
  584. /package/build/esm/{doctor-3cc8fc7d.js → doctor-17090568.js} +0 -0
  585. /package/build/esm/{index-d247dffe.js → index-000e0e9e.js} +0 -0
  586. /package/build/esm/{index-f7ad233d.js → index-0942d379.js} +0 -0
  587. /package/build/esm/{index-87e4c6b1.js → index-1befcee7.js} +0 -0
  588. /package/build/esm/{index-acef2a62.js → index-2e55cfda.js} +0 -0
  589. /package/build/esm/{index-5182c746.js → index-5cec6573.js} +0 -0
  590. /package/build/esm/{index-6e29e7f0.js → index-a0303055.js} +0 -0
  591. /package/build/esm/{index-b199d103.js → index-a232379f.js} +0 -0
  592. /package/build/esm/{index-10cef35f.js → index-d0f53887.js} +0 -0
  593. /package/build/esm/{index-1a5534b7.js → index-fdc14c24.js} +0 -0
  594. /package/build/esm/{index.styles-4e255421.js → index.styles-d02c3a5a.js} +0 -0
  595. /package/build/esm/{localizeNumberFormat-d6346829.js → localizeNumberFormat-6de5a75e.js} +0 -0
  596. /package/build/esm/{normalizeLink-5406e34c.js → normalizeLink-43a86413.js} +0 -0
  597. /package/build/esm/{paths-e6e0ed3e.js → paths-035cff11.js} +0 -0
  598. /package/build/esm/{translationsContext-7f3cb10c.js → translationsContext-10772791.js} +0 -0
  599. /package/build/esm/{tslib.es6-8b49e916.js → tslib.es6-e23bfd26.js} +0 -0
  600. /package/build/esm/{types-207cd2ab.js → types-34201c73.js} +0 -0
  601. /package/build/esm/{useIsInit-73176efd.js → useIsInit-6477f3a4.js} +0 -0
  602. /package/build/esm/{useOutsideClick-cdf878ef.js → useOutsideClick-6c9cf98a.js} +0 -0
  603. /package/build/esm/{useScrollbarSize-e0da9043.js → useScrollbarSize-6473c2fd.js} +0 -0
  604. /package/build/esm/{useUniqueId-30da00de.js → useUniqueId-5817d5a2.js} +0 -0
  605. /package/build/esm/{utils-8921b115.js → utils-cdbd3de5.js} +0 -0
  606. /package/build/{index-972f0263.js → index-098fed08.js} +0 -0
  607. /package/build/{index-05dda990.js → index-0d70f22c.js} +0 -0
  608. /package/build/{index-12dcc550.js → index-0dc126e4.js} +0 -0
  609. /package/build/{index-3b7bc531.js → index-3231a973.js} +0 -0
  610. /package/build/{index-ac33274a.js → index-3ae84344.js} +0 -0
  611. /package/build/{index-db8e29db.js → index-71c3d68d.js} +0 -0
  612. /package/build/{index-9fc5a7e8.js → index-741c96d4.js} +0 -0
  613. /package/build/{index-a8aaf35d.js → index-7541c6b0.js} +0 -0
  614. /package/build/{index-b1eb912c.js → index-a19550a4.js} +0 -0
  615. /package/build/{index.styles-92031143.js → index.styles-4b68abeb.js} +0 -0
  616. /package/build/{localizeNumberFormat-064f9c12.js → localizeNumberFormat-59035008.js} +0 -0
  617. /package/build/{normalizeLink-79a136d4.js → normalizeLink-28829417.js} +0 -0
  618. /package/build/{paths-db1ac919.js → paths-4921d775.js} +0 -0
  619. /package/build/{translationsContext-4f392f72.js → translationsContext-eb09f732.js} +0 -0
  620. /package/build/{tslib.es6-39b96c18.js → tslib.es6-19c55cc8.js} +0 -0
  621. /package/build/{types-4efa0b4d.js → types-3cfdfed1.js} +0 -0
  622. /package/build/{useIsInit-b3f040cc.js → useIsInit-bee13c08.js} +0 -0
  623. /package/build/{useOutsideClick-4ab98215.js → useOutsideClick-f77588fe.js} +0 -0
  624. /package/build/{useScrollbarSize-ec9ed0a7.js → useScrollbarSize-12f1eea9.js} +0 -0
  625. /package/build/{useUniqueId-b9cbf69c.js → useUniqueId-98ff449d.js} +0 -0
  626. /package/build/{utils-2fec8698.js → utils-ca036bb9.js} +0 -0
@@ -0,0 +1,4047 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('./tslib.es6-19c55cc8.js');
4
+ var React = require('react');
5
+ var other = require('@hhgtech/icons/other');
6
+ var index$8 = require('./index-0d70f22c.js');
7
+ var index = require('./index-193192d9.js');
8
+ var innertext = require('innertext');
9
+ var miscTheme = require('./miscTheme.js');
10
+ var index$5 = require('./index-b51c88e2.js');
11
+ var core = require('@mantine/core');
12
+ require('@mantine/dates');
13
+ require('./index-29a53d3c.js');
14
+ require('./index-591ad0ca.js');
15
+ require('./index-3ae84344.js');
16
+ require('./useMantineLocale-0cc2d977.js');
17
+ var index$2 = require('./index-15a499ed.js');
18
+ var index$1 = require('./index-fd3183da.js');
19
+ require('./index.styles-4b68abeb.js');
20
+ require('@mantine/hooks');
21
+ var utils = require('./utils-ca036bb9.js');
22
+ require('./other-50a0b3de.js');
23
+ require('./index-997d3769.js');
24
+ var index$3 = require('./index-9fb3018a.js');
25
+ var togetherComponentGlobalContext = require('./utils-c1ec3cc4.js');
26
+ var styled = require('@emotion/styled');
27
+ var dataTransform = require('./dataTransform-744c0776.js');
28
+ var constants = require('./constants-3b2ad03d.js');
29
+ var post = require('./post-cd6c6c29.js');
30
+ var togetherMoleculesCardAuthor = require('./index-9e9a9169.js');
31
+ var togetherRichTextEditor = require('./editor-64f2bf27.js');
32
+ var index$4 = require('./index-8e25c967.js');
33
+ var debounce = require('lodash/debounce');
34
+ var ContentEditable = require('react-contenteditable');
35
+ var togetherApiPaths = require('./togetherApiPaths.js');
36
+ var index$6 = require('./index-0130a454.js');
37
+ var index$7 = require('./index-b5cd6a21.js');
38
+ var index$9 = require('./index-5d8baaf6.js');
39
+ var Locale = require('./Locale-46500920.js');
40
+ var ReactDOM = require('react-dom');
41
+ var togetherMoleculesPostImagePreview = require('./index-b3e0585e.js');
42
+ var index$c = require('./index-62fbd1d0.js');
43
+ var miscCookieHelper = require('./miscCookieHelper.js');
44
+ var useUniqueId = require('./useUniqueId-98ff449d.js');
45
+ var index$a = require('./index-814045ef.js');
46
+ var index$b = require('./index-f5666a40.js');
47
+ var core$1 = require('@hhgtech/icons/core');
48
+
49
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
50
+
51
+ function _interopNamespace(e) {
52
+ if (e && e.__esModule) return e;
53
+ var n = Object.create(null);
54
+ if (e) {
55
+ Object.keys(e).forEach(function (k) {
56
+ if (k !== 'default') {
57
+ var d = Object.getOwnPropertyDescriptor(e, k);
58
+ Object.defineProperty(n, k, d.get ? d : {
59
+ enumerable: true,
60
+ get: function () { return e[k]; }
61
+ });
62
+ }
63
+ });
64
+ }
65
+ n["default"] = e;
66
+ return Object.freeze(n);
67
+ }
68
+
69
+ var React__default = /*#__PURE__*/_interopDefault(React);
70
+ var innertext__default = /*#__PURE__*/_interopDefault(innertext);
71
+ var styled__default = /*#__PURE__*/_interopDefault(styled);
72
+ var debounce__default = /*#__PURE__*/_interopDefault(debounce);
73
+ var ContentEditable__default = /*#__PURE__*/_interopDefault(ContentEditable);
74
+ var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
75
+
76
+ const StyledCreateNewPost$1 = styled__default["default"].div `
77
+ position: relative;
78
+ display: flex;
79
+ height: 100%;
80
+ flex-direction: column;
81
+ padding: 16px 24px;
82
+
83
+ ${utils.MediaQueries.mbDown} {
84
+ padding: 16px 16px;
85
+ }
86
+
87
+ .input-group-container {
88
+ flex: 1;
89
+ padding-right: 2px;
90
+ padding-left: 2px;
91
+ margin-bottom: 24px;
92
+ -ms-overflow-style: none; /* IE and Edge */
93
+ overflow-y: auto;
94
+ scrollbar-width: none; /* Firefox */
95
+ &::-webkit-scrollbar {
96
+ display: none;
97
+ }
98
+ }
99
+
100
+ .input-group {
101
+ :not(:last-child) {
102
+ margin-bottom: 0.6rem;
103
+ }
104
+
105
+ input:focus,
106
+ textarea:focus,
107
+ [contenteditable='true'] {
108
+ outline: none;
109
+ }
110
+
111
+ label {
112
+ margin-bottom: 5px;
113
+ color: ${miscTheme.theme.colors.gray600};
114
+ /* font-family: 'Open Sans', sans-serif; */
115
+ font-size: 13px;
116
+ font-weight: bold;
117
+ }
118
+
119
+ .input-group-label {
120
+ margin-bottom: 5px;
121
+ color: ${miscTheme.theme.colors.gray600};
122
+ /* font-family: 'Open Sans', sans-serif; */
123
+ font-size: 13px;
124
+ font-weight: bold;
125
+ }
126
+
127
+ .input-notification {
128
+ display: flex;
129
+
130
+ & > img {
131
+ width: 16px;
132
+ height: 16px;
133
+ margin-top: 1.5px;
134
+ margin-right: 8px;
135
+ }
136
+ }
137
+
138
+ .tag-list {
139
+ }
140
+ }
141
+
142
+ .warning {
143
+ margin-top: 16px;
144
+ }
145
+
146
+ .submit-btn {
147
+ width: 100%;
148
+ }
149
+
150
+ .switch-label {
151
+ display: flex;
152
+ align-items: center;
153
+ }
154
+
155
+ .swich-input-group {
156
+ padding: 12px 16px;
157
+ border-radius: 8px;
158
+ background: ${miscTheme.theme.colors.neutral50};
159
+
160
+ &.askdoctor-switch {
161
+ background: ${miscTheme.theme.colors.primary50};
162
+ &.mb-color {
163
+ background: ${miscTheme.theme.mbColors.tonePink};
164
+ }
165
+ }
166
+
167
+ .mantine-Switch-labelWrapper {
168
+ flex-grow: 1;
169
+ }
170
+ .mantine-Checkbox-body {
171
+ display: flex;
172
+ width: 100%;
173
+ align-items: center;
174
+ justify-content: space-between;
175
+ }
176
+ .mantine-Switch-track {
177
+ margin-bottom: 0;
178
+ }
179
+ .label-txt {
180
+ font-weight: normal;
181
+ font-size: 14px;
182
+ color: ${miscTheme.theme.colors.gray800};
183
+ margin-left: 10px;
184
+ }
185
+ }
186
+ `;
187
+ const StyledIsQuestion$1 = styled__default["default"].div `
188
+ display: flex;
189
+ width: 100%;
190
+ align-items: center;
191
+ justify-content: space-between;
192
+ padding: 8px 12px;
193
+ border-radius: 0 0 8px 8px;
194
+ background: ${miscTheme.theme.colors.neutral50};
195
+ border: 1px solid ${miscTheme.theme.colors.gray200};
196
+ gap: 12px;
197
+
198
+ &.has-error {
199
+ border: 1px solid ${miscTheme.theme.colors.red600};
200
+ }
201
+ &.error-description {
202
+ border: 1px solid ${miscTheme.theme.colors.red600};
203
+ border-top: none;
204
+ }
205
+
206
+ &[data-is-marry-baby='true'] {
207
+ background: ${miscTheme.theme.mbColors.tonePink};
208
+ }
209
+
210
+ .switch-label {
211
+ display: flex;
212
+ gap: 4px;
213
+ align-items: flex-start;
214
+
215
+ svg {
216
+ margin-top: 2px;
217
+ }
218
+
219
+ .wrapper-text {
220
+ .label-txt {
221
+ color: ${miscTheme.theme.colors.gray800};
222
+ font-size: 14px;
223
+ font-weight: 600;
224
+ line-height: 22px;
225
+ }
226
+ .description-txt {
227
+ color: ${miscTheme.theme.colors.gray700};
228
+ font-size: 12px;
229
+ font-weight: 400;
230
+ line-height: 18px;
231
+ }
232
+ }
233
+ }
234
+
235
+ button {
236
+ height: 40px;
237
+ &:hover,
238
+ &.primary {
239
+ border-radius: 16px;
240
+ border: 1px solid ${miscTheme.theme.colors.blue100};
241
+ background: ${miscTheme.theme.colors.blue50};
242
+ color: ${miscTheme.theme.colors.primaryBase};
243
+ }
244
+ }
245
+ `;
246
+ const StyledError$1 = styled__default["default"].div `
247
+ margin-bottom: 12px;
248
+ color: ${miscTheme.theme.colors.red700};
249
+ svg {
250
+ margin-right: 5px;
251
+ }
252
+ svg,
253
+ span {
254
+ vertical-align: middle;
255
+ }
256
+ `;
257
+ const StyledFormGroupInner$1 = styled__default["default"].div `
258
+ .swich-input-group {
259
+ padding: 12px 16px;
260
+ border-radius: 8px;
261
+ background: ${miscTheme.theme.colors.neutral50};
262
+
263
+ &.askdoctor-switch {
264
+ background: ${miscTheme.theme.colors.blue50};
265
+ }
266
+
267
+ .switch-label {
268
+ display: flex;
269
+ align-items: center;
270
+ }
271
+ .mantine-Switch-labelWrapper {
272
+ flex-grow: 1;
273
+ }
274
+ .mantine-Checkbox-body {
275
+ display: flex;
276
+ width: 100%;
277
+ align-items: center;
278
+ justify-content: space-between;
279
+ }
280
+ .mantine-Switch-track {
281
+ margin-bottom: 0;
282
+ }
283
+ .label-txt {
284
+ font-weight: normal;
285
+ font-size: 14px;
286
+ color: ${miscTheme.theme.colors.gray800};
287
+ margin-left: 14px;
288
+ }
289
+ }
290
+ `;
291
+ const StylePostAction$1 = styled__default["default"].div `
292
+ display: flex;
293
+ gap: 12px;
294
+ .avatar {
295
+ width: 40px;
296
+ height: 40px;
297
+ border-radius: 100%;
298
+
299
+ img {
300
+ border-radius: 100%;
301
+ }
302
+
303
+ .author-avatar {
304
+ .col-left {
305
+ display: none;
306
+ }
307
+ }
308
+ }
309
+
310
+ .post-action-form {
311
+ display: flex;
312
+ flex-direction: column;
313
+ gap: 4px;
314
+ }
315
+
316
+ .post-action-by {
317
+ color: ${miscTheme.theme.colors.gray800};
318
+ font-size: 16px;
319
+ font-weight: 600;
320
+ line-height: 24px;
321
+ }
322
+
323
+ .post-action-result {
324
+ display: flex;
325
+ position: relative;
326
+ &:after {
327
+ content: '';
328
+ display: inline-block;
329
+ width: 5px;
330
+ height: 5px;
331
+ background-color: ${miscTheme.theme.colors.error};
332
+ border-radius: 100%;
333
+ position: absolute;
334
+ right: 7px;
335
+ }
336
+ }
337
+
338
+ .dropdown-post-action {
339
+ background: ${miscTheme.theme.colors.white} !important;
340
+ border-radius: 2px;
341
+ border: 1px solid ${miscTheme.theme.colors.neutral200} !important;
342
+
343
+ > div {
344
+ padding: 3px 8px;
345
+ }
346
+
347
+ span {
348
+ flex: 1;
349
+ color: ${miscTheme.theme.colors.gray600};
350
+ font-size: 12px;
351
+ font-weight: 600;
352
+ line-height: 18px;
353
+ }
354
+
355
+ ul {
356
+ width: 130px;
357
+ li {
358
+ img {
359
+ flex: 0 0 16px;
360
+ width: 16px;
361
+ }
362
+ }
363
+ }
364
+ }
365
+ `;
366
+ const StyleSessionRow$1 = styled__default["default"].div `
367
+ display: inline-flex;
368
+ gap: 8px;
369
+ align-items: center;
370
+ cursor: pointer;
371
+
372
+ .session-title {
373
+ color: ${miscTheme.theme.colors.gray700};
374
+ font-size: 14px;
375
+ font-weight: 400;
376
+ line-height: 22px;
377
+ flex: 1;
378
+ }
379
+ `;
380
+
381
+ var img$7 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3e%3cpath d='M8.78785 10.7863H7.21084C5.77572 10.237 4.20739 10.237 2.77223 10.7863H1.55404V11.6457H2.41467V11.6537C2.41802 13.0707 3.57408 14.2238 4.99111 14.2238C6.4069 14.2238 7.56293 13.072 7.56797 11.6566L7.56803 11.6457H8.4303V11.6537C8.43365 13.0707 9.58971 14.2238 11.0067 14.2238C12.4225 14.2238 13.5786 13.072 13.5836 11.6566L13.5837 11.6457H14.4447V10.7863H13.2265C11.7913 10.237 10.223 10.237 8.78785 10.7863Z' fill='%238C8C8C'/%3e%3cpath d='M0.666016 6.48926V6.91895C0.666016 8.10354 1.62986 9.06738 2.81445 9.06738H13.1842C14.3688 9.06738 15.3327 8.10354 15.3327 6.91895V6.48926H0.666016Z' fill='%238C8C8C'/%3e%3cpath d='M12.36 3.18227C11.9916 2.07614 10.961 1.33301 9.7953 1.33301C9.13524 1.33301 8.48902 1.58185 7.99935 2.01991C7.50965 1.58185 6.86346 1.33301 6.2034 1.33301C5.03772 1.33301 4.00712 2.07614 3.63871 3.18184L2.8207 5.62988H13.1779L12.36 3.18227Z' fill='%238C8C8C'/%3e%3c/svg%3e";
382
+ var IconAnonymous = img$7;
383
+
384
+ var img$6 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3e%3cpath d='M8.00045 14.3336C7.12449 14.3336 6.30114 14.1674 5.53038 13.835C4.75962 13.5025 4.08916 13.0513 3.51902 12.4815C2.94886 11.9116 2.49749 11.2414 2.1649 10.471C1.83231 9.70056 1.66602 8.87738 1.66602 8.00143C1.66602 7.12547 1.83224 6.30211 2.16468 5.53136C2.49713 4.76059 2.94829 4.09014 3.51818 3.51999C4.08808 2.94984 4.75824 2.49847 5.52867 2.16588C6.29908 1.83329 7.12226 1.66699 7.99822 1.66699C8.87417 1.66699 9.69753 1.83322 10.4683 2.16566C11.239 2.4981 11.9095 2.94927 12.4796 3.51916C13.0498 4.08906 13.5012 4.75922 13.8338 5.52964C14.1664 6.30005 14.3327 7.12324 14.3327 7.99919C14.3327 8.87515 14.1664 9.6985 13.834 10.4693C13.5015 11.24 13.0504 11.9105 12.4805 12.4806C11.9106 13.0508 11.2404 13.5022 10.47 13.8347C9.69959 14.1673 8.8764 14.3336 8.00045 14.3336ZM7.99933 13.3336C9.48822 13.3336 10.7493 12.817 11.7827 11.7836C12.816 10.7503 13.3327 9.4892 13.3327 8.00031C13.3327 7.92253 13.331 7.84304 13.3275 7.76184C13.3241 7.68065 13.3203 7.608 13.316 7.54389C13.2733 7.85329 13.1393 8.10928 12.9141 8.31184C12.6889 8.51441 12.4181 8.61569 12.1019 8.61569H10.5891C10.2506 8.61569 9.96087 8.49527 9.71985 8.25441C9.47883 8.01357 9.35832 7.72403 9.35832 7.38581V6.77088H6.89678V5.54099C6.89678 5.20277 7.01729 4.91272 7.25832 4.67084C7.49935 4.42896 7.78909 4.30803 8.12755 4.30803H8.74293V4.05159C8.74293 3.76185 8.83054 3.52189 9.00575 3.33173C9.18097 3.14155 9.39209 3.00885 9.6391 2.93364C9.37841 2.84818 9.11262 2.78236 8.84173 2.73621C8.57084 2.69005 8.29004 2.66698 7.99933 2.66698C6.51044 2.66698 5.24933 3.18364 4.216 4.21698C3.18267 5.25031 2.666 6.51142 2.666 8.00031V8.09648C2.666 8.12639 2.66814 8.15844 2.67242 8.19263H5.83265C6.5147 8.19263 7.09547 8.43237 7.57495 8.91186C8.05444 9.39134 8.29418 9.97114 8.29418 10.6513V11.2695H6.44803V13.0965C6.6959 13.1734 6.94847 13.2321 7.20573 13.2727C7.463 13.3133 7.72753 13.3336 7.99933 13.3336Z' fill='%238C8C8C'/%3e%3c/svg%3e";
385
+ var IconPublic = img$6;
386
+
387
+ styled__default["default"].div `
388
+ background-color: white;
389
+ z-index: 1000;
390
+ top: 0;
391
+ left: 0;
392
+ height: 100%;
393
+ position: absolute;
394
+ width: 100%;
395
+
396
+ .drawer-header {
397
+ display: flex;
398
+ gap: 12px;
399
+ align-items: center;
400
+ padding: 12px 16px;
401
+ border-bottom: 1px solid ${miscTheme.theme.colors.gray200};
402
+
403
+ .input-group-label {
404
+ flex: 1;
405
+ }
406
+
407
+ img {
408
+ cursor: pointer;
409
+ }
410
+
411
+ p {
412
+ flex: 1;
413
+ }
414
+ }
415
+
416
+ .drawer-content {
417
+ padding: 16px;
418
+ display: flex;
419
+ flex-direction: column;
420
+ gap: 16px;
421
+ overflow-y: auto;
422
+ height: calc(100% - 49px);
423
+
424
+ .input-field-label {
425
+ margin-bottom: 8px;
426
+ }
427
+
428
+ &.drawer-content-full-screen {
429
+ max-width: 680px;
430
+ margin: 0 auto;
431
+ padding: 16px 24px;
432
+ }
433
+ }
434
+ `;
435
+ const StyleCommunityReivew = styled__default["default"].div `
436
+ display: flex;
437
+ flex-direction: column;
438
+ gap: 8px;
439
+ margin-top: 8px;
440
+
441
+ .topic-review {
442
+ display: flex;
443
+ gap: 4px;
444
+ flex-wrap: wrap;
445
+ }
446
+
447
+ .community-review {
448
+ .tag-item {
449
+ background-color: ${miscTheme.theme.colors.neutral50};
450
+
451
+ img {
452
+ border-radius: 50%;
453
+ margin-right: 8px;
454
+ }
455
+ }
456
+ }
457
+ `;
458
+
459
+ var img$5 = "data:image/svg+xml,%3csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.86019 13.3957C4.98735 13.5229 5.14492 13.5865 5.33291 13.5865H13.3233L15.9771 16.2403V5.91343C15.9771 5.72546 15.9135 5.56789 15.7864 5.44072C15.6592 5.31356 15.5016 5.24998 15.3136 5.24998H14.1887V12.036L13.9507 11.798H4.66944V12.923C4.66944 13.111 4.73302 13.2686 4.86019 13.3957ZM2.01562 3.28847V12.9519L4.66944 10.298H12.0252C12.2132 10.298 12.3708 10.2345 12.4979 10.1073C12.6251 9.98014 12.6887 9.82257 12.6887 9.63459V3.28847C12.6887 3.10048 12.6251 2.94291 12.4979 2.81574C12.3708 2.68858 12.2132 2.625 12.0252 2.625H2.67909C2.49111 2.625 2.33353 2.68858 2.20637 2.81574C2.07921 2.94291 2.01562 3.10048 2.01562 3.28847Z' fill='%232D87F3'/%3e%3c/svg%3e";
460
+ var IconCommunity = img$5;
461
+
462
+ const PostCommunityReview = ({ selectedTopics, currentCommunity }) => {
463
+ return (React__default["default"].createElement(StyleCommunityReivew, null,
464
+ React__default["default"].createElement("div", { className: "community-review" },
465
+ React__default["default"].createElement(index$1.Button, { skipHover: true, size: "md", radius: "xl", className: "tag-item", variant: "tertiary" },
466
+ React__default["default"].createElement(index$2.Text, { size: "p4", as: "span", color: "inherit" }, currentCommunity.name))),
467
+ React__default["default"].createElement("div", { className: "topic-review", style: { display: 'none' } }, selectedTopics.map((topic) => {
468
+ return (React__default["default"].createElement(index$1.Button, { skipHover: true, size: "sm", radius: "xl", className: "tag-item", key: topic.id, variant: "tertiary" },
469
+ React__default["default"].createElement(index$2.Text, { size: "p4", as: "span", color: "inherit" }, topic.name)));
470
+ }))));
471
+ };
472
+ const CreatePostCommunity$1 = ({ communitiesList, currentCommunity, selectedTopics, forceTopics, communityValue,
473
+ // error,
474
+ isFullscreen, isInEditMode, setSelectedTopics, setCommunityValue, removeKeyError, }) => {
475
+ const { t } = index.useTranslations();
476
+ const props = {
477
+ communitiesList,
478
+ currentCommunity,
479
+ selectedTopics,
480
+ communityValue,
481
+ isFullscreen,
482
+ isInEditMode,
483
+ forceTopics,
484
+ setSelectedTopics,
485
+ setCommunityValue,
486
+ removeKeyError,
487
+ };
488
+ console.log(props);
489
+ return (React__default["default"].createElement("div", { className: "input-group" },
490
+ React__default["default"].createElement(StyleSessionRow$1, null,
491
+ React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconCommunity, style: {
492
+ width: '18px',
493
+ height: '18px',
494
+ objectFit: 'contain',
495
+ marginLeft: 'auto',
496
+ } }),
497
+ React__default["default"].createElement("div", { className: "session-title" }, t('createPost.communityAndTopic'))),
498
+ React__default["default"].createElement(PostCommunityReview, { selectedTopics: selectedTopics, currentCommunity: currentCommunity })));
499
+ };
500
+
501
+ const CreatePostDescription$1 = ({ className, style, bannedWords = [], value, onChange, onPreviewUrlChange, onInvalidUrlsChange,
502
+ // onImageFilesChange,
503
+ // imageFiles: imageFilesProp,
504
+ isReplying, footerEditor, }) => {
505
+ const { t } = index.useTranslations();
506
+ const [previewUrl, setPreviewUrl] = React.useState(null);
507
+ const imagePicker = React.useRef(null);
508
+ // const {
509
+ // onSelectImages,
510
+ // onRemoveImage,
511
+ // imageSrcs,
512
+ // // imageFiles,
513
+ // } = useImagePicker(imageFilesProp, onImageFilesChange)
514
+ React.useEffect(() => {
515
+ if (onPreviewUrlChange) {
516
+ if (previewUrl === null || previewUrl === void 0 ? void 0 : previewUrl.url)
517
+ onPreviewUrlChange({
518
+ title: previewUrl.title || '',
519
+ url: previewUrl.url || '',
520
+ image: previewUrl.image || '',
521
+ description: previewUrl.description || '',
522
+ });
523
+ else
524
+ onPreviewUrlChange(null);
525
+ }
526
+ }, [previewUrl]);
527
+ return (React__default["default"].createElement(togetherRichTextEditor.StyledCreatePostDescription, { className: className, style: style },
528
+ React__default["default"].createElement(index$2.Text, { size: "p4", className: "description-label" }, t('createPost.popup.description')),
529
+ React__default["default"].createElement("div", { className: `textarea-control` },
530
+ React__default["default"].createElement("div", { className: "textarea-wrapper" },
531
+ React__default["default"].createElement(togetherRichTextEditor.RichTextEditor, { html: value || '', onChange: onChange, bannedWords: bannedWords, onImagePickerClick: () => { var _a; return (_a = imagePicker.current) === null || _a === void 0 ? void 0 : _a.click(); }, onPreviewUrlChange: setPreviewUrl, onInvalidUrlsChange: onInvalidUrlsChange, isReplying: isReplying }))),
532
+ footerEditor,
533
+ React__default["default"].createElement(index$2.Text, { size: "p4", className: "count-string" },
534
+ t('character'),
535
+ ": ",
536
+ innertext__default["default"](value || '').length)));
537
+ };
538
+
539
+ var img$4 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3e%3cpath d='M5.3077 20.5C4.80257 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.3077C3.5 4.80257 3.675 4.375 4.025 4.025C4.375 3.675 4.80257 3.5 5.3077 3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80257 20.5 5.3077V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.3077ZM7.65388 16.75H16.423C16.6038 16.75 16.7377 16.6679 16.8249 16.5038C16.9121 16.3397 16.8987 16.1807 16.7845 16.0269L14.4 12.8327C14.3064 12.7122 14.1859 12.6519 14.0384 12.6519C13.891 12.6519 13.7705 12.7122 13.6769 12.8327L11.2308 16.0192L9.5923 13.9192C9.49872 13.8051 9.37981 13.7481 9.23558 13.7481C9.09134 13.7481 8.97243 13.8083 8.87885 13.9289L7.30195 16.0269C7.18143 16.1807 7.16477 16.3397 7.25195 16.5038C7.33913 16.6679 7.47311 16.75 7.65388 16.75Z' fill='%232D87F3'/%3e%3c/svg%3e";
540
+ var IconPhone = img$4;
541
+
542
+ const CreatePostPhotos$1 = ({ imageFiles: imageFilesInit, setImageFiles, }) => {
543
+ const imageRef = React.useRef(null);
544
+ const { t } = index.useTranslations();
545
+ const { onSelectImages } = index$3.useImagePicker(imageFilesInit, setImageFiles);
546
+ const handleClick = () => {
547
+ var _a;
548
+ (_a = imageRef === null || imageRef === void 0 ? void 0 : imageRef.current) === null || _a === void 0 ? void 0 : _a.click();
549
+ };
550
+ return (React__default["default"].createElement("div", { className: "input-group" },
551
+ React__default["default"].createElement(StyleSessionRow$1, { onClick: handleClick },
552
+ React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconPhone, style: {
553
+ width: '18px',
554
+ height: '18px',
555
+ objectFit: 'contain',
556
+ marginLeft: 'auto',
557
+ } }),
558
+ React__default["default"].createElement("div", { className: "session-title" }, t('createPost.photos'))),
559
+ React__default["default"].createElement("input", { ref: imageRef, type: "file", accept: "image/png, image/gif, image/jpeg", multiple: true, style: { display: 'none' }, onChange: (e) => onSelectImages(e) })));
560
+ };
561
+
562
+ const StyledCreatePostTitle$1 = styled__default["default"].div `
563
+ input:focus,
564
+ textarea:focus,
565
+ [contenteditable='true'] {
566
+ outline: none;
567
+ }
568
+
569
+ .title-input {
570
+ overflow: hidden;
571
+ width: 100%;
572
+ padding: 12px 16px;
573
+ border: solid 1px #d9d9d9;
574
+ border-radius: ${miscTheme.theme.borderRadius};
575
+ font-size: 16px;
576
+ line-height: 1.2;
577
+ white-space: nowrap;
578
+ :focus {
579
+ border-color: ${(props) => props.color};
580
+ box-shadow: 0px 0px 2px 2px ${(props) => props.colorShadow};
581
+ }
582
+ br {
583
+ display: none;
584
+ }
585
+ * {
586
+ display: inline;
587
+ white-space: nowrap;
588
+ }
589
+ mocka {
590
+ padding: 2px 6px;
591
+ border-radius: 1rem;
592
+ &[data-error='true'] {
593
+ background-color: #ffeeee;
594
+ color: red;
595
+ text-decoration: underline;
596
+ font-style: bold;
597
+ }
598
+ }
599
+ ol,
600
+ ul {
601
+ padding-left: 1rem;
602
+ }
603
+ }
604
+
605
+ label {
606
+ display: block;
607
+ margin-bottom: 5px;
608
+ color: ${miscTheme.theme.colors.gray600};
609
+ font-size: 13px;
610
+ font-weight: bold;
611
+ }
612
+
613
+ .count-string {
614
+ margin-top: 5px;
615
+ color: ${miscTheme.theme.colors.gray500};
616
+ font-size: 11px;
617
+ text-align: right;
618
+ }
619
+ `;
620
+
621
+ const TITLE_LIMIT$1 = 120;
622
+ const inputModify$3 = (value, opts) => {
623
+ if (!opts)
624
+ return value;
625
+ const { limit, bannedWords = [] } = opts;
626
+ const shorten = typeof limit === 'number' && limit >= 0 ? value.substring(0, limit) : value;
627
+ const processedValue = post.highlightBadWords(shorten, bannedWords);
628
+ return processedValue;
629
+ };
630
+ const CreatePostTitle$1 = ({ className, style, bannedWords = [], value, onChange, }) => {
631
+ var _a;
632
+ const _theme = core.useMantineTheme();
633
+ const { t } = index.useTranslations();
634
+ const [titleValue, setTitleValue] = React.useState('');
635
+ const titleRef = React.useRef(null);
636
+ React.useEffect(() => {
637
+ if (titleRef.current) {
638
+ const pasteHandler = (e) => {
639
+ var _a;
640
+ e.preventDefault();
641
+ const text = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/plain');
642
+ document.execCommand('insertHTML', false, text);
643
+ };
644
+ const contentDiv = titleRef.current;
645
+ contentDiv.addEventListener('paste', pasteHandler, {
646
+ passive: true,
647
+ });
648
+ return () => contentDiv.removeEventListener('paste', pasteHandler);
649
+ }
650
+ }, [titleRef]);
651
+ const bannedString = (bannedWords === null || bannedWords === void 0 ? void 0 : bannedWords.join(',')) || '';
652
+ React.useEffect(() => {
653
+ var _a;
654
+ if (bannedString) {
655
+ const titleText = (_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.innerText;
656
+ if (titleText) {
657
+ const titleValueWithBanned = post.highlightBadWords(titleText, bannedWords);
658
+ if (titleValueWithBanned !== titleText) {
659
+ onChange && onChange(titleValueWithBanned);
660
+ setTitleValue(titleValueWithBanned);
661
+ }
662
+ }
663
+ }
664
+ }, [bannedString]);
665
+ const debounceInputModify = React.useCallback(debounce__default["default"](() => {
666
+ if (titleRef.current) {
667
+ const shortenString = inputModify$3(titleRef.current.innerText, {
668
+ limit: TITLE_LIMIT$1,
669
+ bannedWords,
670
+ });
671
+ onChange && onChange(shortenString);
672
+ setTitleValue(shortenString);
673
+ }
674
+ }, 300), []);
675
+ React.useEffect(() => {
676
+ setTimeout(() => {
677
+ var _a;
678
+ (_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.focus();
679
+ }, 500);
680
+ }, []);
681
+ return (React__default["default"].createElement(StyledCreatePostTitle$1, { className: className, style: style, color: _theme.colors[_theme.primaryColor][0], colorShadow: _theme.colors[_theme.primaryColor][2] },
682
+ React__default["default"].createElement(index$4.Input, { name: "title", value: value || titleValue, size: "md", label: t('createPost.title'), CustomInput: React__default["default"].createElement(ContentEditable__default["default"], { innerRef: titleRef, html: value || titleValue, onChange: () => {
683
+ if (titleRef.current &&
684
+ titleRef.current.innerText !== (value || titleValue)) {
685
+ const initialValue = inputModify$3(titleRef.current.innerText, {
686
+ bannedWords,
687
+ });
688
+ onChange && onChange(initialValue);
689
+ setTitleValue(initialValue);
690
+ debounceInputModify();
691
+ }
692
+ }, className: "title-input" }) }),
693
+ React__default["default"].createElement(index$2.Text, { size: "p4", className: "count-string" }, t('createPost.popup.wordCount', {
694
+ count: ((_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.innerText.length) || 0,
695
+ max: TITLE_LIMIT$1,
696
+ }))));
697
+ };
698
+
699
+ const StyledPopupFrame = styled__default["default"](index$3.PopupFrame) `
700
+ & > div[data-open]:first-child {
701
+ z-index: 1000;
702
+ height: auto;
703
+ max-width: 448px;
704
+ }
705
+ .custom-media-dialog {
706
+ padding: 1rem;
707
+ .image-gallery {
708
+ display: none;
709
+ .image-item {
710
+ &.no-image {
711
+ cursor: pointer;
712
+ }
713
+ .camera-btn {
714
+ position: absolute;
715
+ top: calc(100% - 32px);
716
+ right: 8px;
717
+ left: unset;
718
+ width: 24px;
719
+ height: 24px;
720
+ }
721
+ }
722
+ }
723
+ .custom-media-add-btn {
724
+ margin-left: auto;
725
+ display: block;
726
+ }
727
+ }
728
+ `;
729
+ const StyledInput = styled__default["default"](index$5.Input) `
730
+ margin-bottom: 10px;
731
+ `;
732
+ const StyleWrapperInfo = styled__default["default"].div `
733
+ display: flex;
734
+ gap: 4px;
735
+ align-items: flex-start;
736
+ margin-bottom: 14px;
737
+
738
+ img {
739
+ margin-top: 2px;
740
+ max-width: 16px;
741
+ }
742
+ `;
743
+
744
+ var img$3 = "data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8.0026 1.33334C4.3206 1.33334 1.33594 4.31801 1.33594 8.00001C1.33594 11.682 4.3206 14.6667 8.0026 14.6667C11.6846 14.6667 14.6693 11.682 14.6693 8.00001C14.6693 4.31801 11.6846 1.33334 8.0026 1.33334ZM8.0026 11.3333C7.6346 11.3333 7.33594 11.0347 7.33594 10.6667V8.00001C7.33594 7.63201 7.6346 7.33334 8.0026 7.33334C8.3706 7.33334 8.66927 7.63201 8.66927 8.00001V10.6667C8.66927 11.0347 8.3706 11.3333 8.0026 11.3333ZM8.33594 6.00001H7.66927C7.48527 6.00001 7.33594 5.85068 7.33594 5.66668V5.00001C7.33594 4.81601 7.48527 4.66668 7.66927 4.66668H8.33594C8.51994 4.66668 8.66927 4.81601 8.66927 5.00001V5.66668C8.66927 5.85068 8.51994 6.00001 8.33594 6.00001Z' fill='%232D87F3'/%3e%3c/svg%3e";
745
+ var IconInfo = img$3;
746
+
747
+ const SocialLinkPopup = ({ isOpen, onClose, onSocialLinkChanged, socialLinkData, }) => {
748
+ const { t } = index.useTranslations();
749
+ const imagePickerRef = React.useRef(null);
750
+ const [socialLink, setSocialLinkUrl] = React.useState('');
751
+ const { onSelectImages, onRemoveImage, imageSrcs, imageFiles } = index$3.useImagePicker();
752
+ React.useEffect(() => {
753
+ if (isOpen) {
754
+ setSocialLinkUrl((socialLinkData === null || socialLinkData === void 0 ? void 0 : socialLinkData.url) || '');
755
+ }
756
+ }, [isOpen]);
757
+ const isAcceptedLink = socialLink.includes('youtu.be') ||
758
+ socialLink.includes('youtube.com') ||
759
+ socialLink.includes('facebook.com') ||
760
+ socialLink.includes('fb.watch') ||
761
+ socialLink.includes('tiktok.com');
762
+ const isValid = !!socialLink && isAcceptedLink;
763
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
764
+ React__default["default"].createElement("input", { ref: imagePickerRef, type: "file", accept: "image/png, image/gif, image/jpeg", style: { display: 'none' }, onChange: onSelectImages }),
765
+ React__default["default"].createElement(StyledPopupFrame, { isOpen: isOpen, onClose: onClose, heading: "Insert", style: {
766
+ zIndex: 3,
767
+ } },
768
+ React__default["default"].createElement("div", { className: "custom-media-dialog", onClick: (e) => e.stopPropagation() },
769
+ React__default["default"].createElement(StyledInput, { size: "md", name: "custom-media-url", placeholder: "URL", value: socialLink, onChange: (v) => setSocialLinkUrl(v), label: "" }),
770
+ React__default["default"].createElement(StyleWrapperInfo, null,
771
+ React__default["default"].createElement("img", { src: IconInfo, alt: "" }),
772
+ React__default["default"].createElement(index$2.Text, { size: "c2", color: "#737373" }, t('editor.addSocialLink.warningDomain'))),
773
+ !imageSrcs[0] ? (React__default["default"].createElement("div", { className: "image-gallery" },
774
+ React__default["default"].createElement("div", { className: "image-item no-image", onClick: () => { var _a; return (_a = imagePickerRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }))) : (React__default["default"].createElement("div", { className: "image-gallery" },
775
+ React__default["default"].createElement("div", { className: "image-item" },
776
+ React__default["default"].createElement("img", { src: imageSrcs[0], alt: "" }),
777
+ React__default["default"].createElement("img", { className: "close-btn", alt: "", onClick: () => onRemoveImage(0) })))),
778
+ React__default["default"].createElement(index$1.Button, { color: "primary", size: "md", variant: "primary", type: "button", className: "custom-media-add-btn", onClick: (e) => {
779
+ e === null || e === void 0 ? void 0 : e.preventDefault();
780
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
781
+ if (isValid) {
782
+ onSocialLinkChanged === null || onSocialLinkChanged === void 0 ? void 0 : onSocialLinkChanged({
783
+ url: !socialLink.includes('http')
784
+ ? 'https://' + socialLink
785
+ : socialLink,
786
+ banner: imageFiles[0],
787
+ });
788
+ onClose === null || onClose === void 0 ? void 0 : onClose();
789
+ }
790
+ }, disabled: !isValid }, t('editor.addSocialLink.addLink'))))));
791
+ };
792
+
793
+ var img$2 = "data:image/svg+xml,%3csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M3.23078 14.625C2.85193 14.625 2.53125 14.4937 2.26875 14.2312C2.00625 13.9687 1.875 13.648 1.875 13.2692V4.73078C1.875 4.35193 2.00625 4.03125 2.26875 3.76875C2.53125 3.50625 2.85193 3.375 3.23078 3.375H14.7692C15.148 3.375 15.4687 3.50625 15.7312 3.76875C15.9937 4.03125 16.125 4.35193 16.125 4.73078V10.315C15.8029 10.1922 15.4534 10.125 15.0882 10.125H11.9117C10.3036 10.125 8.99998 11.4286 8.99998 13.0368C8.99998 13.6227 9.17304 14.1682 9.47085 14.625H3.23078ZM7.83606 11.6899L11.5846 9.28988C11.6875 9.21969 11.7389 9.12306 11.7389 8.99998C11.7389 8.87691 11.6875 8.78028 11.5846 8.71009L7.83606 6.31011C7.72067 6.23222 7.60456 6.22597 7.48774 6.29136C7.37091 6.35673 7.3125 6.45721 7.3125 6.59278V11.4072C7.3125 11.5428 7.37091 11.6432 7.48774 11.7086C7.60456 11.774 7.72067 11.7677 7.83606 11.6899ZM10.7181 14.6953C11.1136 15.0907 11.5889 15.2884 12.1442 15.2884H12.8099C12.9325 15.2884 13.0352 15.247 13.1182 15.1642C13.2011 15.0813 13.2426 14.9786 13.2426 14.856C13.2426 14.7333 13.2011 14.6305 13.1182 14.5475C13.0352 14.4646 12.9325 14.4231 12.8099 14.4231H12.1442C11.8269 14.4231 11.5553 14.3101 11.3293 14.0841C11.1033 13.8582 10.9903 13.5865 10.9903 13.2692C10.9903 12.9519 11.1033 12.6803 11.3293 12.4543C11.5553 12.2284 11.8269 12.1154 12.1442 12.1154H12.8099C12.9325 12.1154 13.0352 12.074 13.1182 11.9911C13.2011 11.9083 13.2426 11.8055 13.2426 11.6829C13.2426 11.5602 13.2011 11.4574 13.1182 11.3745C13.0352 11.2915 12.9325 11.25 12.8099 11.25H12.1442C11.5889 11.25 11.1136 11.4477 10.7181 11.8432C10.3227 12.2386 10.125 12.7139 10.125 13.2692C10.125 13.8245 10.3227 14.2999 10.7181 14.6953ZM12.2686 13.5775C12.3515 13.6604 12.4543 13.7019 12.5769 13.7019H15.1731C15.2957 13.7019 15.3984 13.6605 15.4814 13.5776C15.5643 13.4948 15.6058 13.3921 15.6058 13.2694C15.6058 13.1468 15.5643 13.044 15.4814 12.961C15.3984 12.878 15.2957 12.8365 15.1731 12.8365H12.5769C12.4543 12.8365 12.3515 12.878 12.2686 12.9608C12.1857 13.0436 12.1442 13.1464 12.1442 13.269C12.1442 13.3917 12.1857 13.4945 12.2686 13.5775ZM14.9401 15.2884H15.6058C16.161 15.2884 16.6364 15.0911 17.0318 14.6966C17.4273 14.3019 17.625 13.8268 17.625 13.271C17.625 12.7068 17.4273 12.2289 17.0318 11.8374C16.6364 11.4458 16.161 11.25 15.6058 11.25H14.9401C14.8175 11.25 14.7147 11.2914 14.6318 11.3743C14.5488 11.4571 14.5074 11.5598 14.5074 11.6825C14.5074 11.8051 14.5488 11.908 14.6318 11.9909C14.7147 12.0739 14.8175 12.1154 14.9401 12.1154H15.6058C15.9231 12.1154 16.1947 12.2284 16.4207 12.4543C16.6466 12.6803 16.7596 12.9519 16.7596 13.2692C16.7596 13.5865 16.6466 13.8582 16.4207 14.0841C16.1947 14.3101 15.9231 14.4231 15.6058 14.4231H14.9401C14.8175 14.4231 14.7147 14.4645 14.6318 14.5473C14.5488 14.6302 14.5074 14.7329 14.5074 14.8556C14.5074 14.9782 14.5488 15.081 14.6318 15.164C14.7147 15.247 14.8175 15.2884 14.9401 15.2884Z' fill='%23F44D2C'/%3e%3c/svg%3e";
794
+ var IconVideo = img$2;
795
+
796
+ const CreatePostVideo = ({ socialLinkData, setSocialLinkData, }) => {
797
+ const { t } = index.useTranslations();
798
+ const [activeModal, setActiveModal] = React.useState(false);
799
+ const handleClick = () => {
800
+ setActiveModal(true);
801
+ };
802
+ return (React__default["default"].createElement("div", { className: "input-group" },
803
+ React__default["default"].createElement(StyleSessionRow$1, { onClick: handleClick },
804
+ React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconVideo, style: {
805
+ width: '18px',
806
+ height: '18px',
807
+ objectFit: 'contain',
808
+ marginLeft: 'auto',
809
+ } }),
810
+ React__default["default"].createElement("div", { className: "session-title" }, t('createPost.videoOrLink'))),
811
+ React__default["default"].createElement(SocialLinkPopup, { isOpen: activeModal, onClose: () => setActiveModal(false), onSocialLinkChanged: setSocialLinkData, socialLinkData: socialLinkData })));
812
+ };
813
+
814
+ const StyleReviewPhoto$1 = styled__default["default"].div `
815
+ .mantine-Text-root {
816
+ margin-bottom: 4px;
817
+ }
818
+ .preview-images-container {
819
+ display: flex;
820
+ gap: 8px;
821
+ overflow-x: auto;
822
+ overflow-y: hidden;
823
+ .image-src-wrapper {
824
+ flex: 0 0 140px;
825
+ width: 140px;
826
+ height: 96px;
827
+ border-radius: 4px;
828
+ position: relative;
829
+ img {
830
+ border-radius: 4px;
831
+ }
832
+ .icon-close {
833
+ position: absolute;
834
+ top: 6px;
835
+ right: 6px;
836
+ cursor: pointer;
837
+ z-index: 10;
838
+ max-height: 24px;
839
+ max-width: 24px;
840
+ }
841
+ }
842
+ }
843
+ `;
844
+
845
+ const PostPhotosReview$1 = ({ error, imageFiles: imageFilesInit, setImageFiles, removeKeyError, }) => {
846
+ const { t } = index.useTranslations();
847
+ const { imageSrcs, onRemoveImage } = index$3.useImagePicker(imageFilesInit, setImageFiles);
848
+ return (React__default["default"].createElement(StyleReviewPhoto$1, { className: "input-group" },
849
+ React__default["default"].createElement(index$2.Text, { size: "p5", weight: "semiBold" }, t('createPost.photos')),
850
+ React__default["default"].createElement("div", { className: "preview-images-container" }, imageSrcs === null || imageSrcs === void 0 ? void 0 : imageSrcs.map((src, index) => {
851
+ return (React__default["default"].createElement("div", { className: "image-src-wrapper", key: index },
852
+ React__default["default"].createElement("img", { src: src, className: "preview-image", alt: "", style: {
853
+ width: '100%',
854
+ height: '100%',
855
+ objectFit: 'cover',
856
+ } }),
857
+ React__default["default"].createElement("img", { alt: "", className: "icon-close", src: index$3.IconCloseCircle, onClick: () => {
858
+ removeKeyError && removeKeyError('photos');
859
+ onRemoveImage(index);
860
+ } })));
861
+ })),
862
+ error && (error === null || error === void 0 ? void 0 : error.photos) && (React__default["default"].createElement(StyledError$1, null,
863
+ React__default["default"].createElement(index$2.Text, { size: "p5", color: miscTheme.theme.colors.red600 }, error.photos)))));
864
+ };
865
+
866
+ const inputModify$2 = (value, opts) => {
867
+ var _a;
868
+ const { formatUrl, bannedWords = [] } = opts || {};
869
+ const removedFormat = post.fixMalformedMention(post.removeFontFormat(value));
870
+ if (!formatUrl)
871
+ return {
872
+ value: post.highlightBadWords(removedFormat, bannedWords),
873
+ };
874
+ let descriptionWithWrappedAnchor = post.removeEdittedBannedWord(post.wrapAnchorAroundUrls(removedFormat));
875
+ const urls = post.getUrlsFromEditorString(removedFormat);
876
+ if (urls) {
877
+ const invalidUrls = [];
878
+ let previewUrl = '';
879
+ urls.forEach((url) => {
880
+ if (!url)
881
+ return;
882
+ try {
883
+ const jsUrl = new URL(url);
884
+ // Check url has must into domain hellohealthgroup
885
+ if (!post.ALLOW_DOMAIN_URL.some((o) => jsUrl.origin.endsWith(o))) {
886
+ invalidUrls.push('notification.limitUrlDomain');
887
+ return;
888
+ }
889
+ // Check url have special character
890
+ if (url.endsWith('&')) {
891
+ invalidUrls.push('notification.urlWrongFormat');
892
+ return;
893
+ }
894
+ }
895
+ catch (_a) {
896
+ invalidUrls.push(url);
897
+ }
898
+ });
899
+ if (invalidUrls.length > 0) {
900
+ descriptionWithWrappedAnchor = descriptionWithWrappedAnchor
901
+ .replace(new RegExp(`data-url="true">(${invalidUrls.map(post.escapeRegExp).join('|')})<`, 'gi'), 'data-error="true" data-url="true">$1<')
902
+ .replace(new RegExp(`data-href="(${invalidUrls
903
+ .map(post.escapeRegExp)
904
+ .join('|')})" data-url="true">`, 'gi'), 'data-href="$1" data-error="true" data-url="true">');
905
+ }
906
+ previewUrl = (_a = urls.filter((u) => invalidUrls.indexOf(u) === -1)) === null || _a === void 0 ? void 0 : _a[0];
907
+ return {
908
+ invalidUrls,
909
+ previewUrl,
910
+ value: post.highlightBadWords(descriptionWithWrappedAnchor, bannedWords),
911
+ };
912
+ }
913
+ return {
914
+ value: post.highlightBadWords(descriptionWithWrappedAnchor, bannedWords),
915
+ };
916
+ };
917
+ const usePreviewUrl = (bannedWords, onChange) => {
918
+ const { data: { locale }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
919
+ const [previewUrl, setPreviewUrl] = React.useState(null);
920
+ const bannedWordsRef = React.useRef([]);
921
+ bannedWordsRef.current = bannedWords;
922
+ const fetchPreviewData = (url) => {
923
+ if (!previewUrl || previewUrl.url !== url) {
924
+ setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl({
925
+ url,
926
+ isFetching: true,
927
+ });
928
+ togetherComponentGlobalContext.callApi(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.FETCH_PREVIEW, {
929
+ _locale: locale,
930
+ }), 'POST', {
931
+ data: {
932
+ link: url,
933
+ },
934
+ headers: {
935
+ 'Content-Type': 'application/json',
936
+ },
937
+ })
938
+ .then((res) => {
939
+ var _a, _b, _c, _d;
940
+ setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl({
941
+ title: (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.title,
942
+ description: (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.description,
943
+ image: ((_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.image) || ((_d = res === null || res === void 0 ? void 0 : res.data) === null || _d === void 0 ? void 0 : _d.logo),
944
+ url,
945
+ });
946
+ })
947
+ .catch(() => {
948
+ setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl(null);
949
+ });
950
+ }
951
+ };
952
+ const fetchPreviewDataRef = React.useRef(fetchPreviewData);
953
+ fetchPreviewDataRef.current = fetchPreviewData;
954
+ const [invalidUrls, setInvalidUrls] = React.useState([]);
955
+ const debounceInputModify = React.useCallback(debounce__default["default"]((v) => {
956
+ if (v) {
957
+ const processedInput = inputModify$2(v, {
958
+ bannedWords: bannedWordsRef.current,
959
+ formatUrl: true,
960
+ });
961
+ const { invalidUrls: _invalidUrls, previewUrl: _previewUrl, value, } = processedInput;
962
+ if (_invalidUrls && (_invalidUrls === null || _invalidUrls === void 0 ? void 0 : _invalidUrls.length)) {
963
+ setInvalidUrls(_invalidUrls);
964
+ setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl(null);
965
+ }
966
+ else {
967
+ setInvalidUrls([]);
968
+ if (_previewUrl) {
969
+ fetchPreviewDataRef.current(_previewUrl);
970
+ }
971
+ else
972
+ setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl(null);
973
+ if (value !== v) {
974
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
975
+ }
976
+ }
977
+ }
978
+ }, 500), []);
979
+ return {
980
+ previewUrl,
981
+ setPreviewUrl,
982
+ invalidUrls,
983
+ debounceInputModify,
984
+ fetchPreviewData,
985
+ };
986
+ };
987
+
988
+ const StyleReviewVideo = styled__default["default"].div `
989
+ .link-preview-wrapper {
990
+ position: relative;
991
+ .icon-close {
992
+ position: absolute;
993
+ top: 6px;
994
+ right: 6px;
995
+ cursor: pointer;
996
+ z-index: 10;
997
+ max-width: 24px;
998
+ max-height: 24px;
999
+ }
1000
+ }
1001
+ .mantine-Text-root {
1002
+ margin-bottom: 4px;
1003
+ }
1004
+ `;
1005
+
1006
+ const PostVideoReview = ({ socialLinkData, bannedWords, onChange, onInvalidUrlsChange, onSocialLinkChanged, }) => {
1007
+ const { t } = index.useTranslations();
1008
+ const { invalidUrls, previewUrl, fetchPreviewData, setPreviewUrl } = usePreviewUrl(bannedWords || [], onChange);
1009
+ React.useEffect(() => {
1010
+ if (socialLinkData && socialLinkData.url) {
1011
+ fetchPreviewData(socialLinkData.url);
1012
+ }
1013
+ }, [socialLinkData, fetchPreviewData]);
1014
+ React.useEffect(() => {
1015
+ if (invalidUrls) {
1016
+ onInvalidUrlsChange === null || onInvalidUrlsChange === void 0 ? void 0 : onInvalidUrlsChange(invalidUrls);
1017
+ }
1018
+ }, [invalidUrls]);
1019
+ return (React__default["default"].createElement(StyleReviewVideo, { className: "input-group" },
1020
+ React__default["default"].createElement(index$2.Text, { size: "p5", weight: "semiBold" }, t('createPost.video')),
1021
+ React__default["default"].createElement("div", { className: "link-preview-wrapper" }, (socialLinkData === null || socialLinkData === void 0 ? void 0 : socialLinkData.url) && previewUrl && (React__default["default"].createElement("div", { className: "link-preview-wrapper" }, previewUrl.isFetching ? (React__default["default"].createElement(index$6.Loading, null)) : (React__default["default"].createElement(React__default["default"].Fragment, null,
1022
+ React__default["default"].createElement(index$7.CardLink, { title: previewUrl.title, url: previewUrl.url || '#', image: previewUrl.image, noRefetch: true }),
1023
+ React__default["default"].createElement("img", { alt: "", src: index$3.IconCloseCircle, className: "icon-close", onClick: () => {
1024
+ setPreviewUrl(null);
1025
+ onSocialLinkChanged && onSocialLinkChanged(null);
1026
+ } }))))))));
1027
+ };
1028
+
1029
+ const MAX_SIZE_FILE_UPLOAD$1 = 10 * 1024 * 1024;
1030
+ const applySpecialCharSite$1 = [
1031
+ Locale.LOCALE.PhilippinesEnglish,
1032
+ Locale.LOCALE.PhilippinesTagalog,
1033
+ Locale.LOCALE.Indonesia,
1034
+ Locale.LOCALE.Malaysia,
1035
+ Locale.LOCALE.Vietnam,
1036
+ ];
1037
+ const CreateNewPostContent = ({ className, style, onPostCreatedEdited, onClose, communities = [], forceSelectCommunity, forceSelectTopics, articleId, optionalTopic, editPostData, defaultCommunity, defaultTopics, selectAskDoctor, showAskDoctorOptions, userInfo, isMarryBaby = false, }) => {
1038
+ const isInEditMode = !!(editPostData === null || editPostData === void 0 ? void 0 : editPostData.id);
1039
+ const { data: { locale, router, env: { togetherBasePath }, }, action: { pushNotifications, sanitizeFunction }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
1040
+ const { asPath } = router || {};
1041
+ const { t } = index.useTranslations();
1042
+ // const [isAnonymous, setIsAnonymous] = useState<boolean>(false)
1043
+ const [isAskDoctor, setIsAskDoctor] = React.useState(selectAskDoctor);
1044
+ const [specialCharErr, setspecialCharErr] = React.useState(false);
1045
+ const [isSubmitting, setIsSubmitting] = React.useState(false);
1046
+ const [titleValue, setTitleValue] = React.useState('');
1047
+ const [descriptionValue, setDescriptionValue] = React.useState('');
1048
+ const [communityValue, setCommunityValue] = React.useState(forceSelectCommunity
1049
+ ? {
1050
+ label: forceSelectCommunity.name,
1051
+ value: `${forceSelectCommunity.id || ''}-${forceSelectCommunity.mappedCategoryId || ''}`,
1052
+ }
1053
+ : {
1054
+ label: t('community.choose'),
1055
+ value: '',
1056
+ });
1057
+ const [selectedTopics, setSelectedTopics] = React.useState([...forceSelectTopics] || []);
1058
+ const [socialLinkData, setSocialLinkData] = React.useState();
1059
+ const [error, setError] = React.useState({});
1060
+ const [imageFiles, setImageFiles] = React.useState([]);
1061
+ const [bannedWords, setBannedWords] = React.useState([]);
1062
+ const [postActionValue, setPostActionValue] = React.useState({
1063
+ label: t('cardPost.public'),
1064
+ value: 'public',
1065
+ });
1066
+ const { imageSrcs = [] } = index$3.useImagePicker(imageFiles);
1067
+ const currentCommunity = forceSelectCommunity ||
1068
+ communities.find((c) => `${c.id || ''}-${c.mappedCategoryId || ''}` === communityValue.value);
1069
+ const communitiesList = forceSelectCommunity
1070
+ ? [forceSelectCommunity]
1071
+ : communities
1072
+ .filter((c) => c.isActive)
1073
+ .sort((a, b) => {
1074
+ if (a.name > b.name)
1075
+ return 1;
1076
+ if (a.name < b.name)
1077
+ return -1;
1078
+ return 0;
1079
+ });
1080
+ const [previewUrl, setPreviewUrl] = React.useState(null);
1081
+ const [invalidUrls, setInvalidUrls] = React.useState([]);
1082
+ const isReadyToSubmit = titleValue &&
1083
+ !specialCharErr &&
1084
+ innertext__default["default"](descriptionValue) &&
1085
+ (optionalTopic || (!optionalTopic && selectedTopics.length > 0)) &&
1086
+ currentCommunity &&
1087
+ (!imageFiles || imageFiles.length <= constants.MAX_IMAGE_UPLOADS) &&
1088
+ !(invalidUrls === null || invalidUrls === void 0 ? void 0 : invalidUrls.length) &&
1089
+ !isSubmitting;
1090
+ const postActionType = [
1091
+ {
1092
+ label: t('cardPost.public'),
1093
+ value: 'public',
1094
+ icon: (React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconPublic, style: {
1095
+ width: '100%',
1096
+ height: '100%',
1097
+ objectFit: 'contain',
1098
+ marginLeft: 'auto',
1099
+ } })),
1100
+ },
1101
+ {
1102
+ label: t('cardPost.anonymous'),
1103
+ value: 'anonymous',
1104
+ icon: (React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconAnonymous, style: {
1105
+ width: '100%',
1106
+ height: '100%',
1107
+ objectFit: 'contain',
1108
+ marginLeft: 'auto',
1109
+ } })),
1110
+ },
1111
+ ];
1112
+ // HANDLE etra action when OPEN AND CLOSE
1113
+ React.useEffect(() => {
1114
+ if (editPostData) {
1115
+ const post$1 = editPostData;
1116
+ setTitleValue(post$1.title || '');
1117
+ setDescriptionValue(post.decodeMention(post.decodePostUrl(post$1.description || '', 'edit'), post$1.mentions));
1118
+ setCommunityValue({
1119
+ label: post$1.community.name,
1120
+ value: `${post$1.community.id || ''}-${post$1.community.mappedCategoryId || ''}`,
1121
+ });
1122
+ setSelectedTopics(post$1.topics || []);
1123
+ setImageFiles(post$1.photos || []);
1124
+ // setIsAnonymous(!!post.isAnonymous || false)
1125
+ setIsAskDoctor(!!post$1.isAskDoctor || false);
1126
+ }
1127
+ else {
1128
+ if (defaultCommunity) {
1129
+ setCommunityValue({
1130
+ label: defaultCommunity.name,
1131
+ value: `${defaultCommunity.id || ''}-${defaultCommunity.mappedCategoryId || ''}`,
1132
+ });
1133
+ }
1134
+ if (defaultTopics) {
1135
+ setSelectedTopics(defaultTopics);
1136
+ }
1137
+ }
1138
+ }, []);
1139
+ React.useEffect(() => {
1140
+ setspecialCharErr(applySpecialCharSite$1.includes(locale) &&
1141
+ titleValue !== '' &&
1142
+ !/[a-zA-Z]/.test(titleValue));
1143
+ setError({});
1144
+ }, [titleValue]);
1145
+ const onCreateEditSuccess = (res) => {
1146
+ if (onPostCreatedEdited) {
1147
+ onPostCreatedEdited(dataTransform.formatPost(res), isInEditMode);
1148
+ }
1149
+ onClose && onClose();
1150
+ };
1151
+ const validationUploadPhoto = (files) => {
1152
+ const errorMessage = Object.assign({}, error);
1153
+ if (files && files.length > 10) {
1154
+ errorMessage.photos = t('createPost.message.photoMaxium');
1155
+ }
1156
+ if (files && files.length) {
1157
+ const inValidSizeFile = files.some((file) => (file === null || file === void 0 ? void 0 : file.size) > MAX_SIZE_FILE_UPLOAD$1);
1158
+ if (inValidSizeFile) {
1159
+ errorMessage.photos = t('createPost.message.photoSize');
1160
+ }
1161
+ }
1162
+ setError(errorMessage);
1163
+ };
1164
+ const validationPost = () => {
1165
+ let hasError = false;
1166
+ const errorMessage = {};
1167
+ const description = innertext__default["default"](descriptionValue);
1168
+ if (!description) {
1169
+ errorMessage.description = t('createPost.message.requiredDescription');
1170
+ hasError = true;
1171
+ }
1172
+ if (isInEditMode && !titleValue) {
1173
+ errorMessage.title = t('createPost.message.requiredTitle');
1174
+ hasError = true;
1175
+ }
1176
+ if (description && description.split(' ').length < 10) {
1177
+ errorMessage.description = t('createPost.message.lengthDescription');
1178
+ hasError = true;
1179
+ }
1180
+ if (showAskDoctorOptions &&
1181
+ !(errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.description) &&
1182
+ typeof isAskDoctor === 'undefined') {
1183
+ errorMessage.askDoctor = t('createPost.message.askDoctorRequireMess');
1184
+ hasError = true;
1185
+ }
1186
+ if (imageFiles && imageFiles.length > 10) {
1187
+ errorMessage.photos = t('createPost.message.photoMaxium');
1188
+ hasError = true;
1189
+ }
1190
+ if (imageFiles && imageFiles.length) {
1191
+ const inValidSizeFile = imageFiles.some((file) => (file === null || file === void 0 ? void 0 : file.size) > MAX_SIZE_FILE_UPLOAD$1);
1192
+ if (inValidSizeFile) {
1193
+ errorMessage.photos = t('createPost.message.photoSize');
1194
+ hasError = true;
1195
+ }
1196
+ }
1197
+ if (invalidUrls && invalidUrls.length) {
1198
+ errorMessage.video = 'Invalid video url';
1199
+ hasError = true;
1200
+ }
1201
+ setError(errorMessage);
1202
+ return hasError;
1203
+ };
1204
+ const removeKeyError = (deleteKey) => {
1205
+ if (error[deleteKey]) {
1206
+ const _a = Object.assign({}, error), _b = `${deleteKey}`, value = _a[_b], rest = tslib_es6.__rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
1207
+ setError(rest);
1208
+ console.log(value);
1209
+ }
1210
+ };
1211
+ const submitPost = () => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
1212
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1213
+ const isError = validationPost();
1214
+ if (isError)
1215
+ return;
1216
+ const bodyFormData = yield index$3.getPostFormData({
1217
+ title: titleValue,
1218
+ description: descriptionValue,
1219
+ communityId: String((currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.id) || ''),
1220
+ imageFiles,
1221
+ previewUrl,
1222
+ topicIds: selectedTopics === null || selectedTopics === void 0 ? void 0 : selectedTopics.map((topic) => String(topic.id || '')).filter(Boolean),
1223
+ locale,
1224
+ sanitizeFunction,
1225
+ categoryCommunityId: String((currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.mappedCategoryId) || ''),
1226
+ categoryTopicIds: selectedTopics === null || selectedTopics === void 0 ? void 0 : selectedTopics.map((topic) => String((topic === null || topic === void 0 ? void 0 : topic.mappedCategoryId) || '')).filter(Boolean),
1227
+ isAnonymous: (postActionValue === null || postActionValue === void 0 ? void 0 : postActionValue.value) === 'anonymous' ? 1 : 0,
1228
+ isAskDoctor: isAskDoctor ? 1 : 0,
1229
+ introUrl: (socialLinkData === null || socialLinkData === void 0 ? void 0 : socialLinkData.url) || '',
1230
+ });
1231
+ if (articleId) {
1232
+ bodyFormData.append('article_id', articleId);
1233
+ }
1234
+ let res;
1235
+ if (isInEditMode) {
1236
+ if (editPostData === null || editPostData === void 0 ? void 0 : editPostData.id) {
1237
+ res = yield index$3.editPost({
1238
+ id: editPostData.id,
1239
+ formData: bodyFormData,
1240
+ locale,
1241
+ });
1242
+ }
1243
+ }
1244
+ else {
1245
+ res = yield index$3.createPost({
1246
+ formData: bodyFormData,
1247
+ locale,
1248
+ isArticleComment: !(currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.id) && !!(currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.mappedCategoryId),
1249
+ });
1250
+ }
1251
+ const resData = res === null || res === void 0 ? void 0 : res.data;
1252
+ if ((resData === null || resData === void 0 ? void 0 : resData.id) && !((_b = (_a = res === null || res === void 0 ? void 0 : res.messages) === null || _a === void 0 ? void 0 : _a.moderation) === null || _b === void 0 ? void 0 : _b.type)) {
1253
+ pushNotifications({
1254
+ message: t('createPost.popup.success'),
1255
+ type: 'success',
1256
+ });
1257
+ onCreateEditSuccess(resData);
1258
+ }
1259
+ else {
1260
+ if (((_d = (_c = res === null || res === void 0 ? void 0 : res.messages) === null || _c === void 0 ? void 0 : _c.moderation) === null || _d === void 0 ? void 0 : _d.type) === 'banned') {
1261
+ pushNotifications({
1262
+ title: t('notification.post.blocked.title'),
1263
+ message: t('notification.post.blocked.message'),
1264
+ type: 'danger',
1265
+ });
1266
+ if (res.messages.moderation.words) {
1267
+ setBannedWords(res.messages.moderation.words);
1268
+ }
1269
+ }
1270
+ else if (((_f = (_e = res === null || res === void 0 ? void 0 : res.messages) === null || _e === void 0 ? void 0 : _e.moderation) === null || _f === void 0 ? void 0 : _f.type) === 'suspect') {
1271
+ pushNotifications({
1272
+ title: t('notification.post.suspect.title'),
1273
+ message: t('notification.post.suspect.message'),
1274
+ type: 'warning',
1275
+ });
1276
+ onClose && onClose();
1277
+ }
1278
+ else if ((_h = (_g = res === null || res === void 0 ? void 0 : res.messages) === null || _g === void 0 ? void 0 : _g.find) === null || _h === void 0 ? void 0 : _h.call(_g, (m) => { var _a; return !!((_a = m === null || m === void 0 ? void 0 : m.includes) === null || _a === void 0 ? void 0 : _a.call(m, 'suspend')); })) {
1279
+ pushNotifications({
1280
+ message: t('notification.suspend.message'),
1281
+ type: 'danger',
1282
+ });
1283
+ onClose && onClose();
1284
+ }
1285
+ else {
1286
+ pushNotifications({
1287
+ message: ((_j = res === null || res === void 0 ? void 0 : res.messages) === null || _j === void 0 ? void 0 : _j[0]) || t('notification.failure'),
1288
+ type: 'danger',
1289
+ });
1290
+ }
1291
+ }
1292
+ });
1293
+ return (React__default["default"].createElement(StyledCreateNewPost$1, { className: `${className} create-post-popup-frame`, style: style },
1294
+ React__default["default"].createElement("div", { className: "input-group-container" },
1295
+ React__default["default"].createElement(StyledFormGroupInner$1, null,
1296
+ React__default["default"].createElement("div", { className: "input-group" },
1297
+ React__default["default"].createElement(StylePostAction$1, null,
1298
+ React__default["default"].createElement("div", { className: "avatar" }, (userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) ? (React__default["default"].createElement("img", { alt: "avatar-icon", src: userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar, style: {
1299
+ width: '100%',
1300
+ height: '100%',
1301
+ objectFit: 'contain',
1302
+ marginLeft: 'auto',
1303
+ } })) : (React__default["default"].createElement(togetherMoleculesCardAuthor.CardAuthor, { showDetailPopup: false, avatar: "", avatarProps: { size: 40 }, name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name, userId: userInfo === null || userInfo === void 0 ? void 0 : userInfo.userId, className: "author-avatar" }))),
1304
+ React__default["default"].createElement("div", { className: "post-action-form" },
1305
+ React__default["default"].createElement("div", { className: "post-action-by" }, (userInfo === null || userInfo === void 0 ? void 0 : userInfo.name) || ''),
1306
+ React__default["default"].createElement(index$8.Dropdown, { disabled: isInEditMode, options: postActionType, id: "post-action-type", size: "sm", className: "dropdown-post-action", placeholder: t('community.choose'), value: postActionValue, onChange: (option) => {
1307
+ setPostActionValue({
1308
+ label: option.label,
1309
+ value: String(option.value),
1310
+ });
1311
+ }, placeholderIcon: React__default["default"].createElement("div", { className: "post-action-result" }, postActionValue.value === 'public' ? (React__default["default"].createElement("img", { alt: "public-icon", src: IconPublic, style: {
1312
+ width: '100%',
1313
+ height: '100%',
1314
+ objectFit: 'contain',
1315
+ marginLeft: 'auto',
1316
+ } })) : (React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconAnonymous, style: {
1317
+ width: '100%',
1318
+ height: '100%',
1319
+ objectFit: 'contain',
1320
+ marginLeft: 'auto',
1321
+ } }))), style: {
1322
+ zIndex: 10,
1323
+ width: 'calc(100% + 20px)',
1324
+ } })))),
1325
+ React__default["default"].createElement(CreatePostTitle$1, { className: "input-group", bannedWords: bannedWords, value: titleValue, onChange: setTitleValue }),
1326
+ specialCharErr && (React__default["default"].createElement(StyledError$1, null,
1327
+ React__default["default"].createElement(other.Info, { isSolid: true, color: miscTheme.theme.colors.red700, size: 14 }),
1328
+ React__default["default"].createElement(index$2.Text, { size: "p3", as: "span", color: miscTheme.theme.colors.red700 }, t('createPost.popup.specialCharErr')))),
1329
+ React__default["default"].createElement("div", { className: "input-group" },
1330
+ React__default["default"].createElement(CreatePostDescription$1, { bannedWords: bannedWords, value: descriptionValue, onChange: (v) => {
1331
+ setDescriptionValue(v);
1332
+ removeKeyError('description');
1333
+ }, onPreviewUrlChange: setPreviewUrl, onInvalidUrlsChange: setInvalidUrls, onImageFilesChange: setImageFiles, imageFiles: imageFiles, className: `${error && (error === null || error === void 0 ? void 0 : error.description) ? 'error-description' : ''} ${showAskDoctorOptions ? 'has-ask-doctor-option' : ''}`, footerEditor: React__default["default"].createElement(React__default["default"].Fragment, null,
1334
+ showAskDoctorOptions && (React__default["default"].createElement(StyledIsQuestion$1, { color: "", className: `${error && (error === null || error === void 0 ? void 0 : error.askDoctor) ? 'has-error' : ''} ${error && (error === null || error === void 0 ? void 0 : error.description) ? 'error-description' : ''}` },
1335
+ React__default["default"].createElement("div", { className: "switch-label" },
1336
+ React__default["default"].createElement(other.Ask, { size: isMarryBaby ? 32 : 24, isMarryBaby: isMarryBaby }),
1337
+ React__default["default"].createElement("div", { className: "wrapper-text" },
1338
+ React__default["default"].createElement("div", { className: "label-txt" }, t('createPost.askDoctor')),
1339
+ React__default["default"].createElement("div", { className: "description-txt" }, t('createPost.askDoctor.description')))),
1340
+ React__default["default"].createElement(index$9.BtnChoice, { value: isAskDoctor, choices: [
1341
+ {
1342
+ label: t('createPost.askDoctorChoice.yes'),
1343
+ value: true,
1344
+ dataEventCategory: 'Together',
1345
+ dataEventAction: 'Write Post Click - Ask Doctor',
1346
+ dataEventLabel: togetherComponentGlobalContext.getCurrentHref(locale, togetherBasePath, asPath),
1347
+ },
1348
+ {
1349
+ label: t('createPost.askDoctorChoice.no'),
1350
+ value: false,
1351
+ },
1352
+ ], onChange: (v) => {
1353
+ if (typeof v === 'boolean') {
1354
+ setIsAskDoctor(v);
1355
+ removeKeyError('askDoctor');
1356
+ }
1357
+ } }))),
1358
+ error && (error === null || error === void 0 ? void 0 : error.askDoctor) && (React__default["default"].createElement(StyledError$1, { style: { margin: '4px 0 0' } },
1359
+ React__default["default"].createElement(index$2.Text, { size: "p5", as: "span", color: miscTheme.theme.colors.red600 }, error.askDoctor))),
1360
+ error && (error === null || error === void 0 ? void 0 : error.description) && (React__default["default"].createElement(StyledError$1, { style: { margin: '4px 0 0' } },
1361
+ React__default["default"].createElement(index$2.Text, { size: "p5", as: "span", color: miscTheme.theme.colors.red600 }, error.description)))) })),
1362
+ imageSrcs.length > 0 && (React__default["default"].createElement(PostPhotosReview$1, { imageFiles: imageFiles, error: error, setImageFiles: setImageFiles, removeKeyError: removeKeyError })),
1363
+ socialLinkData && (React__default["default"].createElement(PostVideoReview, { bannedWords: bannedWords, socialLinkData: socialLinkData, onSocialLinkChanged: setSocialLinkData, onInvalidUrlsChange: setInvalidUrls, onChange: (v) => {
1364
+ setDescriptionValue(v);
1365
+ } })),
1366
+ React__default["default"].createElement(CreatePostCommunity$1, { communitiesList: communitiesList, currentCommunity: currentCommunity, selectedTopics: selectedTopics, forceTopics: forceSelectTopics, communityValue: communityValue, error: error, isFullscreen: false, isInEditMode: isInEditMode, setSelectedTopics: setSelectedTopics, setCommunityValue: setCommunityValue }),
1367
+ React__default["default"].createElement(CreatePostPhotos$1, { imageFiles: imageFiles, setImageFiles: (data) => {
1368
+ setImageFiles(data);
1369
+ validationUploadPhoto(data);
1370
+ } }),
1371
+ React__default["default"].createElement(CreatePostVideo, { socialLinkData: socialLinkData, setSocialLinkData: setSocialLinkData }))),
1372
+ React__default["default"].createElement("div", { className: "form-action" },
1373
+ React__default["default"].createElement("div", { className: "input-group" },
1374
+ React__default["default"].createElement(index$1.Button, { className: "submit-btn pointer-event-child-none", size: "lg", "data-event-category": "Ask Doctor", "data-event-action": "Submit Question", "data-event-label": window.location.href, onClick: () => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
1375
+ if (isReadyToSubmit && !isSubmitting) {
1376
+ setIsSubmitting(true);
1377
+ try {
1378
+ yield submitPost();
1379
+ }
1380
+ catch (e) {
1381
+ console.error(e);
1382
+ pushNotifications(index$3.getDefaultFailNoti(t));
1383
+ }
1384
+ setIsSubmitting(false);
1385
+ }
1386
+ }), disabled: !isReadyToSubmit, loading: isSubmitting }, t('createPost.popup.submit'))))));
1387
+ };
1388
+
1389
+ const StyleContainer$2 = styled__default["default"].div ``;
1390
+ const StyleContentWrapper$1 = styled__default["default"].div `
1391
+ display: flex;
1392
+ flex-direction: column;
1393
+ gap: 16px;
1394
+
1395
+ .mantine-TopicSelectList-root {
1396
+ padding: 0;
1397
+ }
1398
+
1399
+ .mantine-TopicSelectList-list {
1400
+ gap: 12px;
1401
+ }
1402
+
1403
+ .tag-list {
1404
+ margin: 0;
1405
+ }
1406
+ `;
1407
+ const StyleWrapperButton$1 = styled__default["default"].div `
1408
+ display: flex;
1409
+ flex-direction: column;
1410
+ gap: 8px;
1411
+ .other-btn-community {
1412
+ color: ${miscTheme.theme.colors.gray400};
1413
+ font-size: 16px;
1414
+ font-weight: 600;
1415
+ line-height: 24px;
1416
+ cursor: pointer;
1417
+ }
1418
+ `;
1419
+
1420
+ const StyledTopicSelectList$1 = styled__default["default"].div `
1421
+ display: flex;
1422
+ width: 100%;
1423
+ flex-wrap: wrap;
1424
+ margin-top: 1rem;
1425
+ gap: 12px;
1426
+
1427
+ .tag-item {
1428
+ min-height: 32px;
1429
+ padding: 5px 12px;
1430
+ border: 1px solid ${miscTheme.theme.colors.neutral100};
1431
+ border-radius: 1rem;
1432
+ color: ${miscTheme.theme.colors.gray800};
1433
+ cursor: pointer;
1434
+ font-size: 13px;
1435
+ line-height: 22px;
1436
+ transition: all 0.2s;
1437
+
1438
+ &.--active {
1439
+ border-color: ${miscTheme.theme.colors.primary50};
1440
+ background: ${miscTheme.theme.colors.primary50};
1441
+ color: ${miscTheme.theme.colors.primaryBase};
1442
+ }
1443
+ &[data-disabled='true'] {
1444
+ background: ${miscTheme.theme.colors.gray100};
1445
+ color: ${miscTheme.theme.colors.gray800};
1446
+ }
1447
+ }
1448
+ .topic-spinner {
1449
+ margin-right: auto;
1450
+ margin-left: auto;
1451
+ & > button {
1452
+ width: 24px;
1453
+ height: 24px;
1454
+ }
1455
+ }
1456
+ &[data-is-marrybaby='true'] {
1457
+ .tag-item {
1458
+ border-color: transparent;
1459
+ background: #f3f3f3;
1460
+ color: #3e3f58;
1461
+ &.--active {
1462
+ border-color: #b6cdff;
1463
+ background: #e0e9fb;
1464
+ color: #3e3f58;
1465
+ }
1466
+ }
1467
+ }
1468
+ `;
1469
+
1470
+ const TopicSelectList$1 = ({ className, style, topics: topicsProp, communityId, onChange, isLoading, disabled, forceTopics, selectedTopics: selectedTopicsProp, noFetch, dataEventCategory, dataEventAction, dataEventLabel, }) => {
1471
+ const { data: { locale, env: { isMarryBaby }, }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
1472
+ const [topics, setTopics] = React.useState(topicsProp ? [...topicsProp] : []);
1473
+ const [selectedTopics, setSelectedTopics] = React.useState(selectedTopicsProp ? [...selectedTopicsProp] : []);
1474
+ const [isLoadingTopics, setIsLoadingTopics] = React.useState(false);
1475
+ const topicsPropRef = React.useRef(topicsProp);
1476
+ topicsPropRef.current = topicsProp;
1477
+ React.useEffect(() => {
1478
+ var _a;
1479
+ if (communityId && !noFetch && !((_a = topicsPropRef.current) === null || _a === void 0 ? void 0 : _a.length)) {
1480
+ setTopics([]);
1481
+ setIsLoadingTopics(true);
1482
+ (() => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
1483
+ var _b;
1484
+ try {
1485
+ const res = yield togetherComponentGlobalContext.callApi(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.TOPIC.LIST, {
1486
+ communityId: communityId,
1487
+ _locale: locale,
1488
+ }), 'GET');
1489
+ const topicRes = (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.topics;
1490
+ if (Array.isArray(topicRes)) {
1491
+ setTopics(() => (topicRes === null || topicRes === void 0 ? void 0 : topicRes.map(dataTransform.formatTopic).sort((t1, t2) => (t1.order || 0) - (t2.order || 0))) || []);
1492
+ }
1493
+ }
1494
+ catch (e) {
1495
+ console.log(e);
1496
+ setIsLoadingTopics(false);
1497
+ }
1498
+ setIsLoadingTopics(false);
1499
+ }))();
1500
+ }
1501
+ }, [communityId, noFetch]);
1502
+ const topicsPropString = topicsProp === null || topicsProp === void 0 ? void 0 : topicsProp.map((t) => t.id).join('-');
1503
+ const topicsStateString = topics === null || topics === void 0 ? void 0 : topics.map((t) => t.id).join('-');
1504
+ const forceTopicsPropString = forceTopics === null || forceTopics === void 0 ? void 0 : forceTopics.map((t) => t.id).join('-');
1505
+ React.useEffect(() => {
1506
+ if (topicsProp &&
1507
+ typeof topicsPropString !== 'undefined' &&
1508
+ topicsPropString !== topicsStateString) {
1509
+ setTopics(topicsProp);
1510
+ }
1511
+ }, [topicsProp, topicsPropString, topicsStateString]);
1512
+ const topicsWithoutForced = React.useMemo(() => topics.filter((t) => !(forceTopics === null || forceTopics === void 0 ? void 0 : forceTopics.some((ft) => (ft.id && ft.id === t.id) ||
1513
+ (ft.mappedCategoryId &&
1514
+ ft.mappedCategoryId === t.mappedCategoryId)))), [topicsStateString, forceTopicsPropString]);
1515
+ return (React__default["default"].createElement(StyledTopicSelectList$1, { "data-is-marrybaby": isMarryBaby, className: className, style: style },
1516
+ forceTopics.map((topic) => (React__default["default"].createElement(TopicItem$1, { key: `${topic.id}-${topic.mappedCategoryId}`, topic: topic, disabled: true, selected: true, dataEventAction: dataEventAction, dataEventCategory: dataEventCategory, dataEventLabel: dataEventLabel }))),
1517
+ topicsWithoutForced.map((topic) => (React__default["default"].createElement(TopicItem$1, { key: `${topic.id}-${topic.mappedCategoryId}`, topic: topic, disabled: disabled, selected: (selectedTopicsProp || selectedTopics).some((t) => (t.id && t.id === topic.id) ||
1518
+ (t.mappedCategoryId &&
1519
+ t.mappedCategoryId === topic.mappedCategoryId)), onClick: () => {
1520
+ const _selected = selectedTopicsProp || selectedTopics;
1521
+ const foundIndex = _selected.findIndex((_selected) => (_selected.id && _selected.id === topic.id) ||
1522
+ (_selected.mappedCategoryId &&
1523
+ _selected.mappedCategoryId === topic.mappedCategoryId));
1524
+ if (foundIndex !== -1) {
1525
+ _selected.splice(foundIndex, 1);
1526
+ }
1527
+ else {
1528
+ _selected.push(topic);
1529
+ }
1530
+ if (onChange && selectedTopicsProp) {
1531
+ onChange(_selected.slice());
1532
+ }
1533
+ else {
1534
+ onChange && onChange(_selected.slice());
1535
+ setSelectedTopics(_selected.slice());
1536
+ }
1537
+ }, dataEventAction: dataEventAction, dataEventCategory: dataEventCategory, dataEventLabel: dataEventLabel }))),
1538
+ (isLoading || isLoadingTopics) && React__default["default"].createElement(togetherMoleculesCardAuthor.Loading, { className: "topic-spinner" })));
1539
+ };
1540
+ const TopicItem$1 = (_a) => {
1541
+ var { topic, disabled, selected, onClick } = _a, rest = tslib_es6.__rest(_a, ["topic", "disabled", "selected", "onClick"]);
1542
+ return (React__default["default"].createElement("div", Object.assign({ className: 'tag-item' + (selected ? ' --active' : ''), "data-disabled": disabled, onClick: !disabled ? onClick : undefined }, rest), topic.name));
1543
+ };
1544
+
1545
+ const StyleContainer$1 = styled__default["default"].div `
1546
+ border-radius: 8px;
1547
+ border: 1px solid ${miscTheme.theme.colors.neutral100};
1548
+ background: ${miscTheme.theme.colors.white};
1549
+ border: 1px solid ${miscTheme.theme.colors.neutral100};
1550
+ .card-header {
1551
+ padding: 12px 16px;
1552
+ color: ${miscTheme.theme.colors.gray800};
1553
+ font-size: 14px;
1554
+ font-weight: 600;
1555
+ line-height: 22px;
1556
+ border-bottom: 1px solid ${miscTheme.theme.colors.neutral100};
1557
+ background: ${miscTheme.theme.colors.neutral50};
1558
+ border-radius: 8px 8px 0px 0px;
1559
+ }
1560
+ .card-body {
1561
+ padding: 16px;
1562
+ }
1563
+ `;
1564
+
1565
+ const CardPostCommunity = ({ title, children }) => {
1566
+ return (React__default["default"].createElement(StyleContainer$1, null,
1567
+ React__default["default"].createElement("div", { className: "card-header" }, title),
1568
+ React__default["default"].createElement("div", { className: "card-body" }, children)));
1569
+ };
1570
+
1571
+ const CommonCommunity = ({ communitiesList, communityValue, selectedTopics, defaultCommunity, isInEditMode, setCommunityValue, setSelectedTopics, onSubmitPost, }) => {
1572
+ const { t } = index.useTranslations();
1573
+ React.useEffect(() => {
1574
+ if (defaultCommunity && !isInEditMode) {
1575
+ setCommunityValue({
1576
+ label: defaultCommunity.name,
1577
+ value: defaultCommunity.id,
1578
+ });
1579
+ }
1580
+ }, [defaultCommunity, isInEditMode]);
1581
+ return (React__default["default"].createElement(StyleContainer$2, null,
1582
+ React__default["default"].createElement(StyleContentWrapper$1, null,
1583
+ React__default["default"].createElement(CardPostCommunity, { title: t('admin.community') },
1584
+ React__default["default"].createElement(index$8.Dropdown, { options: (communitiesList === null || communitiesList === void 0 ? void 0 : communitiesList.map((c) => ({
1585
+ label: c.name,
1586
+ value: c.id || '',
1587
+ }))) || [], id: "community-picker", disabled: isInEditMode, value: communityValue, placeholder: t('community.choose'), onChange: (option) => {
1588
+ setCommunityValue({
1589
+ label: option.label,
1590
+ value: String(option.value),
1591
+ });
1592
+ setSelectedTopics([]);
1593
+ }, style: {
1594
+ zIndex: 1,
1595
+ } })),
1596
+ React__default["default"].createElement(CardPostCommunity, { title: t('tab.topic') }, communityValue.value ? (React__default["default"].createElement(TopicSelectList$1, { className: "tag-list", communityId: Number(communityValue.value), onChange: (topics) => setSelectedTopics(topics), selectedTopics: selectedTopics, forceTopics: [] })) : (React__default["default"].createElement("div", { style: { height: '30px' } }))),
1597
+ React__default["default"].createElement(StyleWrapperButton$1, null,
1598
+ React__default["default"].createElement(index$1.Button, { className: "submit-btn", size: "lg", "data-event-category": "Ask Doctor", "data-event-action": "Submit Question", "data-event-label": window.location.href, "data-testid": "Button Post", disabled: !communityValue.value, onClick: () => onSubmitPost() }, t('createPost.popup.submit'))))));
1599
+ };
1600
+
1601
+ styled__default["default"].div `
1602
+ display: flex;
1603
+ flex-direction: column;
1604
+ gap: 8px;
1605
+ margin-top: 8px;
1606
+
1607
+ .topic-review {
1608
+ display: flex;
1609
+ gap: 4px;
1610
+ flex-wrap: wrap;
1611
+ }
1612
+
1613
+ .community-review {
1614
+ .tag-item {
1615
+ background-color: ${miscTheme.theme.colors.neutral50};
1616
+
1617
+ img {
1618
+ border-radius: 50%;
1619
+ margin-right: 8px;
1620
+ }
1621
+ }
1622
+ }
1623
+ `;
1624
+ const StyleDrawer = styled__default["default"].div `
1625
+ background-color: white;
1626
+ z-index: 1000;
1627
+ top: 0;
1628
+ left: 0;
1629
+ height: 100%;
1630
+ position: absolute;
1631
+ width: 100%;
1632
+
1633
+ .drawer-header {
1634
+ display: flex;
1635
+ gap: 12px;
1636
+ align-items: center;
1637
+ padding: 12px 16px;
1638
+ border-bottom: 1px solid ${miscTheme.theme.colors.gray200};
1639
+
1640
+ img {
1641
+ cursor: pointer;
1642
+ }
1643
+
1644
+ p {
1645
+ flex: 1;
1646
+ }
1647
+ }
1648
+
1649
+ .drawer-content {
1650
+ padding: 24px;
1651
+ display: flex;
1652
+ flex-direction: column;
1653
+ gap: 16px;
1654
+ overflow-y: auto;
1655
+ height: calc(100% - 49px);
1656
+
1657
+ ${utils.MediaQueries.mbDown} {
1658
+ padding: 16px;
1659
+ &.drawer-content-adjust {
1660
+ justify-content: center;
1661
+ }
1662
+ }
1663
+
1664
+ .input-field-label {
1665
+ margin-bottom: 8px;
1666
+ }
1667
+
1668
+ &.drawer-content-full-screen {
1669
+ max-width: 680px;
1670
+ margin: 0 auto;
1671
+ padding: 16px 24px;
1672
+ }
1673
+ }
1674
+ `;
1675
+
1676
+ const StyleContainer = styled__default["default"].div `
1677
+ display: flex;
1678
+ flex-direction: column;
1679
+ gap: 32px;
1680
+ `;
1681
+ const StyleSearchWrapper = styled__default["default"].div `
1682
+ display: flex;
1683
+ flex-direction: column;
1684
+ justify-content: center;
1685
+ gap: 24px;
1686
+ align-items: center;
1687
+ max-width: 400px;
1688
+ margin: 0 auto;
1689
+ .search-description {
1690
+ text-align: center;
1691
+ font-size: 16px;
1692
+ font-weight: 600;
1693
+ line-height: 24px;
1694
+ background: linear-gradient(92deg, #45a4ff 16.17%, #00c076 98.95%);
1695
+ background-clip: text;
1696
+ -webkit-background-clip: text;
1697
+ -webkit-text-fill-color: transparent;
1698
+ }
1699
+ .result-search-description {
1700
+ color: ${miscTheme.theme.colors.gray800};
1701
+ font-size: 16px;
1702
+ font-weight: 400;
1703
+ line-height: 24px;
1704
+ text-align: center;
1705
+ }
1706
+ `;
1707
+ const StyleContentWrapper = styled__default["default"].div `
1708
+ display: flex;
1709
+ flex-direction: column;
1710
+ gap: 16px;
1711
+
1712
+ .tag-item-review {
1713
+ display: flex;
1714
+ align-items: center;
1715
+ gap: 12px;
1716
+
1717
+ .tag-item-label {
1718
+ flex: 1;
1719
+ color: ${miscTheme.theme.colors.gray800};
1720
+ font-size: 16px;
1721
+ font-weight: 400;
1722
+ line-height: 24px;
1723
+ }
1724
+ }
1725
+ .topic-item-review-wrapper {
1726
+ display: flex;
1727
+ gap: 12px;
1728
+ flex-wrap: wrap;
1729
+ }
1730
+ .topic-item-review {
1731
+ border-radius: 40px;
1732
+ background: ${miscTheme.theme.colors.blue50};
1733
+ padding: 6px 12px;
1734
+ }
1735
+ `;
1736
+ const StyleWrapperButton = styled__default["default"].div `
1737
+ display: flex;
1738
+ flex-direction: column;
1739
+ gap: 8px;
1740
+ .other-btn-community {
1741
+ color: ${miscTheme.theme.colors.gray400};
1742
+ font-size: 16px;
1743
+ font-weight: 600;
1744
+ line-height: 24px;
1745
+ cursor: pointer;
1746
+ }
1747
+ `;
1748
+
1749
+ var img$1 = "data:image/svg+xml,%3csvg width='268' height='268' viewBox='0 0 268 268' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg filter='url(%23filter0_f_270_203608)'%3e%3ccircle cx='134.175' cy='134.174' r='99.1225' fill='url(%23paint0_linear_270_203608)'/%3e%3c/g%3e%3cpath d='M143.63 122.941C143.884 121.934 145.315 121.934 145.569 122.941L146.243 125.609C147.585 130.925 151.907 134.969 157.301 135.954L158.295 136.136C159.389 136.336 159.389 137.903 158.295 138.103L157.301 138.285C151.907 139.271 147.585 143.314 146.243 148.631L145.569 151.299C145.315 152.306 143.884 152.306 143.63 151.299L142.956 148.631C141.614 143.314 137.292 139.271 131.899 138.285L130.904 138.103C129.81 137.904 129.81 136.336 130.904 136.136L131.899 135.954C137.292 134.969 141.614 130.925 142.956 125.609L143.63 122.941Z' fill='url(%23paint1_linear_270_203608)'/%3e%3cpath d='M134.365 89.0399C134.461 88.2144 135.659 88.2144 135.755 89.04L135.958 90.7817C136.317 93.8718 138.673 96.3541 141.74 96.8746L143.713 97.2094C144.49 97.3413 144.49 98.4578 143.713 98.5897L141.74 98.9246C138.673 99.4451 136.317 101.927 135.958 105.017L135.755 106.759C135.659 107.585 134.461 107.585 134.365 106.759L134.162 105.017C133.803 101.927 131.447 99.4451 128.38 98.9246L126.407 98.5897C125.629 98.4578 125.629 97.3413 126.407 97.2094L128.38 96.8746C131.447 96.3541 133.803 93.8718 134.162 90.7816L134.365 89.0399Z' fill='url(%23paint2_linear_270_203608)'/%3e%3cdefs%3e%3cfilter id='filter0_f_270_203608' x='0.782799' y='0.781822' width='266.784' height='266.785' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3e%3cfeFlood flood-opacity='0' result='BackgroundImageFix'/%3e%3cfeBlend mode='normal' in='SourceGraphic' in2='BackgroundImageFix' result='shape'/%3e%3cfeGaussianBlur stdDeviation='17.135' result='effect1_foregroundBlur_270_203608'/%3e%3c/filter%3e%3clinearGradient id='paint0_linear_270_203608' x1='55.5444' y1='48.7129' x2='193.903' y2='233.297' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%23A7D2FF'/%3e%3cstop offset='1' stop-color='%2376EE9A' stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient id='paint1_linear_270_203608' x1='144.6' y1='118.518' x2='144.6' y2='155.721' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0.26' stop-color='%2378B0F6'/%3e%3cstop offset='1' stop-color='%2376F197'/%3e%3c/linearGradient%3e%3clinearGradient id='paint2_linear_270_203608' x1='135.06' y1='82.5809' x2='135.06' y2='113.218' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0.26' stop-color='%2378B0F6'/%3e%3cstop offset='1' stop-color='%2376F197'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
1750
+ var IconSuggestSearch = img$1;
1751
+
1752
+ const SuggestedCommunity = ({ currentCommunity, selectedTopics, isLoading, clickOtherCommunity, onSubmitPost, }) => {
1753
+ const { t } = index.useTranslations();
1754
+ return (React__default["default"].createElement(StyleContainer, null,
1755
+ isLoading || !currentCommunity ? (React__default["default"].createElement(StyleSearchWrapper, null,
1756
+ React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconSuggestSearch, style: {
1757
+ width: '212px',
1758
+ height: '212px',
1759
+ objectFit: 'contain',
1760
+ } }),
1761
+ isLoading ? (React__default["default"].createElement("div", { className: "search-description" },
1762
+ t('createPost.message.suggestLoading'),
1763
+ "...")) : (React__default["default"].createElement("div", { className: "result-search-description" }, t('createPost.message.suggestResult'))))) : (React__default["default"].createElement(StyleContentWrapper, null,
1764
+ React__default["default"].createElement(CardPostCommunity, { title: t('admin.community') },
1765
+ React__default["default"].createElement(React__default["default"].Fragment, null, currentCommunity && (React__default["default"].createElement("div", { className: "tag-item-review" },
1766
+ React__default["default"].createElement("img", { alt: "community-thumbnail", src: currentCommunity.thumbnail, style: {
1767
+ width: '40px',
1768
+ height: '40px',
1769
+ objectFit: 'contain',
1770
+ marginLeft: 'auto',
1771
+ flex: '0 0 40px',
1772
+ } }),
1773
+ React__default["default"].createElement(index$2.Text, { size: "p4", as: "span", color: "inherit", className: "tag-item-label" }, currentCommunity.name))))),
1774
+ selectedTopics.length > 0 && (React__default["default"].createElement(CardPostCommunity, { title: t('tab.topic') },
1775
+ React__default["default"].createElement("div", { className: "topic-item-review-wrapper" }, selectedTopics.map((item, index) => (React__default["default"].createElement("div", { className: "topic-item-review", key: index },
1776
+ React__default["default"].createElement(index$2.Text, { size: "p4", as: "span", color: "inherit", className: "tag-item-label" }, item.name))))))))),
1777
+ !isLoading && (React__default["default"].createElement(StyleWrapperButton, null,
1778
+ React__default["default"].createElement(index$1.Button, { className: "submit-btn", size: "lg", "data-testid": "Button Post", "data-event-category": "Ask Doctor", "data-event-action": "Submit Question", "data-event-label": window.location.href, onClick: () => onSubmitPost(!currentCommunity) }, t('createPost.now')),
1779
+ React__default["default"].createElement(index$1.Button, { variant: "ghost", className: "other-btn-community", type: "button", onClick: clickOtherCommunity }, currentCommunity
1780
+ ? t('choose.other.community')
1781
+ : t('choose.community'))))));
1782
+ };
1783
+
1784
+ const CreatePostCommunity = ({ communitiesList, currentCommunity, selectedTopics, communityValue, isInEditMode, isLoadingSuggest, defaultCommunity, isMarryBaby = false, setSelectedTopics, setCommunityValue, onSubmitPost, setStepPost, }) => {
1785
+ const { t, locale } = index.useTranslations();
1786
+ const [typeSelectionCommunity, setTypeSelectionCommunity] = React.useState('chatbot');
1787
+ const clickOtherCommunity = () => {
1788
+ setTypeSelectionCommunity('manual');
1789
+ setCommunityValue({
1790
+ label: t('community.choose'),
1791
+ value: '',
1792
+ });
1793
+ setSelectedTopics([]);
1794
+ };
1795
+ const onClickBack = () => {
1796
+ setCommunityValue({
1797
+ label: t('community.choose'),
1798
+ value: '',
1799
+ });
1800
+ setSelectedTopics([]);
1801
+ setStepPost === null || setStepPost === void 0 ? void 0 : setStepPost('step_info');
1802
+ };
1803
+ return ReactDOM__namespace.createPortal(React__default["default"].createElement(StyleDrawer, null,
1804
+ React__default["default"].createElement("div", { className: "drawer-header" },
1805
+ React__default["default"].createElement("img", { alt: "public-icon", src: togetherMoleculesPostImagePreview.IconArrowLeft, onClick: onClickBack, style: {
1806
+ width: '24px',
1807
+ height: '24px',
1808
+ objectFit: 'contain',
1809
+ marginLeft: 'auto',
1810
+ } }),
1811
+ React__default["default"].createElement(index$2.Text, { size: "p3", className: "input-group-label", weight: "semiBold" }, t('createPost.communityAndTopic'))),
1812
+ React__default["default"].createElement("div", { className: `drawer-content` }, !isInEditMode &&
1813
+ typeSelectionCommunity === 'chatbot' &&
1814
+ locale === Locale.LOCALE.Vietnam &&
1815
+ !isMarryBaby ? (React__default["default"].createElement(SuggestedCommunity, { selectedTopics: selectedTopics, currentCommunity: currentCommunity, isLoading: isLoadingSuggest, clickOtherCommunity: clickOtherCommunity, onSubmitPost: onSubmitPost })) : (React__default["default"].createElement(CommonCommunity, { communitiesList: communitiesList, communityValue: communityValue, selectedTopics: selectedTopics, isInEditMode: isInEditMode, defaultCommunity: defaultCommunity, setCommunityValue: setCommunityValue, setSelectedTopics: setSelectedTopics, onSubmitPost: onSubmitPost })))), document.querySelector('.create-post-popup-frame') || document.body);
1816
+ };
1817
+
1818
+ const StyledCreatePostDescription = styled__default["default"].div `
1819
+ input:focus,
1820
+ textarea:focus,
1821
+ [contenteditable='true'] {
1822
+ outline: none;
1823
+ }
1824
+
1825
+ &.has-ask-doctor-option {
1826
+ .textarea-control {
1827
+ border-bottom: none;
1828
+ border-radius: 4px 4px 0 0;
1829
+ }
1830
+ }
1831
+
1832
+ &.error-description {
1833
+ .textarea-control {
1834
+ border: 1px solid ${miscTheme.theme.colors.red600};
1835
+ border-bottom: none;
1836
+ }
1837
+ }
1838
+
1839
+ .textarea-control {
1840
+ position: relative;
1841
+ border: 1px solid ${miscTheme.theme.colors.gray200};
1842
+ border-bottom: none;
1843
+ border-radius: 8px 8px 0 0;
1844
+ &.--focus {
1845
+ border-color: ${miscTheme.theme.colors.primaryBase};
1846
+ box-shadow: 0px 0px 2px 2px ${miscTheme.theme.colors.primary200};
1847
+ }
1848
+
1849
+ .textarea-wrapper {
1850
+ width: 100%;
1851
+ min-height: 268px;
1852
+ height: auto;
1853
+ }
1854
+
1855
+ .control-tool {
1856
+ position: absolute;
1857
+ bottom: 0;
1858
+ left: 0;
1859
+ display: flex;
1860
+ width: calc(100% - 2rem);
1861
+ height: 40px;
1862
+ align-items: center;
1863
+ justify-content: flex-end;
1864
+ border-top: 1px solid ${miscTheme.theme.colors.gray200};
1865
+ margin: 0 1rem;
1866
+
1867
+ .tool-button {
1868
+ display: flex;
1869
+ width: 2rem;
1870
+ height: 2rem;
1871
+ align-items: center;
1872
+ justify-content: center;
1873
+ background: transparent;
1874
+ cursor: pointer;
1875
+ }
1876
+ .image-icon {
1877
+ vertical-align: middle;
1878
+ }
1879
+ }
1880
+ }
1881
+
1882
+ .link-preview-wrapper {
1883
+ position: relative;
1884
+ .icon-close {
1885
+ position: absolute;
1886
+ top: 5px;
1887
+ right: 5px;
1888
+ width: 24px;
1889
+ height: 24px;
1890
+ cursor: pointer;
1891
+ }
1892
+ }
1893
+
1894
+ .image-gallery {
1895
+ margin-bottom: 1rem;
1896
+
1897
+ .image-item {
1898
+ position: relative;
1899
+ overflow: hidden;
1900
+ width: 100%;
1901
+ height: 0;
1902
+ padding-top: 67%;
1903
+ margin-top: 1rem;
1904
+ border-radius: ${miscTheme.theme.borderRadius};
1905
+
1906
+ & > img {
1907
+ position: absolute;
1908
+ top: 0;
1909
+ left: 0;
1910
+ width: 100%;
1911
+ height: 100%;
1912
+ object-fit: cover;
1913
+ }
1914
+
1915
+ .close-btn {
1916
+ position: absolute;
1917
+ top: 8px;
1918
+ right: 8px;
1919
+ left: unset;
1920
+ width: 24px;
1921
+ height: 24px;
1922
+ cursor: pointer;
1923
+ }
1924
+ }
1925
+ }
1926
+
1927
+ .description-label {
1928
+ margin-bottom: 5px;
1929
+ color: ${miscTheme.theme.colors.gray600};
1930
+ /* font-family: 'Open Sans', sans-serif; */
1931
+ font-size: 13px;
1932
+ font-weight: bold;
1933
+ }
1934
+
1935
+ .count-string {
1936
+ margin-top: 5px;
1937
+ color: ${miscTheme.theme.colors.gray500};
1938
+ font-size: 11px;
1939
+ text-align: right;
1940
+ }
1941
+
1942
+ .input-notification {
1943
+ display: flex;
1944
+
1945
+ & > img {
1946
+ width: 16px;
1947
+ height: 16px;
1948
+ margin-top: 1.5px;
1949
+ margin-right: 8px;
1950
+ }
1951
+ }
1952
+ `;
1953
+ const StyledEditorContainer = styled__default["default"].div `
1954
+ height: 100%;
1955
+ position: relative;
1956
+ width: 100%;
1957
+ display: flex;
1958
+ flex-direction: column;
1959
+ .ql-toolbar.ql-snow {
1960
+ top: 0;
1961
+ width: 100%;
1962
+ // position: sticky;
1963
+ z-index: 3;
1964
+ border: none;
1965
+ border-bottom: 1px solid #ccc;
1966
+ border-radius: 8px 8px 0 0;
1967
+ background: white;
1968
+ .ql-formats {
1969
+ display: inline-flex;
1970
+ align-items: center;
1971
+ margin-right: 0.5rem;
1972
+ .link-tool-wrapper {
1973
+ .popover-menu__content {
1974
+ padding: 0.5rem;
1975
+ transform: translateX(calc(-50% - 1rem));
1976
+ max-width: calc(100vw - 4rem);
1977
+ ::before {
1978
+ right: calc(50% - 8px);
1979
+ }
1980
+ .link-tool-popover {
1981
+ input {
1982
+ padding-left: 1rem;
1983
+ }
1984
+ .link-input-url {
1985
+ margin-bottom: 0.5rem;
1986
+ }
1987
+ .link-input-text {
1988
+ margin-bottom: 0.5rem;
1989
+ }
1990
+ label {
1991
+ display: inline-block;
1992
+ margin-bottom: 0.2rem;
1993
+ }
1994
+ .link-input-button-wrapper {
1995
+ &[data-is-marrybaby='true'] {
1996
+ .link-input-button {
1997
+ border: solid 2px ${miscTheme.theme.mbColors.pink};
1998
+ background-color: ${miscTheme.theme.mbColors.pink};
1999
+ &:hover:not(:disabled) {
2000
+ border: solid 2px ${miscTheme.theme.mbColors.pink};
2001
+ background-color: ${miscTheme.theme.colors.white};
2002
+ color: ${miscTheme.theme.mbColors.pink};
2003
+ }
2004
+ }
2005
+ }
2006
+ }
2007
+ .link-input-button {
2008
+ width: auto;
2009
+ height: auto;
2010
+ padding: 0.4rem 1rem;
2011
+ background-color: ${miscTheme.theme.colors.primaryBase};
2012
+
2013
+ &:disabled {
2014
+ border-color: #bfbfbf;
2015
+ background-color: #bfbfbf;
2016
+ color: #fff;
2017
+ cursor: not-allowed;
2018
+ }
2019
+ &:hover:not(:disabled) {
2020
+ background-color: ${miscTheme.theme.colors.primaryHover};
2021
+ }
2022
+ }
2023
+ .error-text {
2024
+ padding: 0;
2025
+ margin-bottom: 0.5rem;
2026
+ font-weight: 600;
2027
+ color: ${miscTheme.theme.colors.red700};
2028
+ }
2029
+ }
2030
+ }
2031
+ }
2032
+ }
2033
+ @media (max-width: 450px) {
2034
+ position: relative;
2035
+ .ql-formats {
2036
+ .link-tool-wrapper {
2037
+ position: unset;
2038
+ .popover-menu__content {
2039
+ left: 0;
2040
+ transform: unset;
2041
+ max-width: 100%;
2042
+ }
2043
+ }
2044
+ }
2045
+ }
2046
+ }
2047
+ .quill {
2048
+ flex: 1;
2049
+ overflow-y: hidden;
2050
+ .ql-container {
2051
+ display: inline-block;
2052
+ width: 100%;
2053
+ min-height: 100%;
2054
+ /* padding: 14px 16px; */
2055
+ border: none;
2056
+ border-radius: ${miscTheme.theme.borderRadius};
2057
+ color: ${miscTheme.theme.colors.gray800};
2058
+ font-size: 1rem;
2059
+ line-height: 1.5;
2060
+ resize: none;
2061
+ white-space: break-spaces;
2062
+ .ql-editor {
2063
+ word-break: break-word;
2064
+ overflow-wrap: break-word;
2065
+ /* -ms-overflow-style: none;
2066
+ scrollbar-width: none;
2067
+ &::-webkit-scrollbar {
2068
+ display: none;
2069
+ } */
2070
+
2071
+ &::before {
2072
+ font-size: 16px;
2073
+ color: ${miscTheme.theme.colors.gray400};
2074
+ font-weight: 400;
2075
+ line-height: 24px;
2076
+ font-style: normal;
2077
+ }
2078
+ }
2079
+ mocka {
2080
+ padding: 2px 6px;
2081
+ border-radius: 1rem;
2082
+ &[data-url='true'] {
2083
+ /* background-color: #eeeeff; */
2084
+ font-style: italic;
2085
+ color: #1890ff;
2086
+ cursor: pointer;
2087
+ outline: none;
2088
+ text-decoration: underline;
2089
+ }
2090
+ &[data-error='true'] {
2091
+ background-color: #ffeeee;
2092
+ color: red;
2093
+ text-decoration: underline;
2094
+ font-style: bold;
2095
+ }
2096
+ }
2097
+ mention {
2098
+ padding: 2px 6px;
2099
+ border-radius: 1rem;
2100
+ background-color: #eeeeff;
2101
+ color: #1890ff;
2102
+ cursor: pointer;
2103
+ outline: none;
2104
+ text-decoration: none;
2105
+ }
2106
+ ol,
2107
+ ul {
2108
+ padding-left: 1rem;
2109
+ }
2110
+ }
2111
+ }
2112
+ .mention-search-container {
2113
+ position: absolute;
2114
+ background: white;
2115
+ border-radius: ${miscTheme.theme.borderRadius};
2116
+ filter: drop-shadow(0px 10px 16px rgba(0, 0, 0, 0.04))
2117
+ drop-shadow(0px 2px 8px rgba(0, 0, 0, 0.04))
2118
+ drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.04));
2119
+ overflow-y: scroll;
2120
+ z-index: 99;
2121
+ ::-webkit-scrollbar {
2122
+ -webkit-appearance: none;
2123
+ }
2124
+ ::-webkit-scrollbar:vertical {
2125
+ width: 14px;
2126
+ }
2127
+ ::-webkit-scrollbar-thumb {
2128
+ border-radius: ${miscTheme.theme.borderRadius};
2129
+ background-color: #d9d9d9;
2130
+ @supports (background-clip: padding-box) {
2131
+ border: 3px solid rgba(0, 0, 0, 0);
2132
+ background-clip: padding-box;
2133
+ }
2134
+ @supports not (background-clip: padding-box) {
2135
+ border: 3px solid white;
2136
+ }
2137
+ }
2138
+ ::-webkit-scrollbar-track {
2139
+ background-color: #fff;
2140
+ border-radius: 0 6px 6px 0;
2141
+ border-left: 1px solid #f2f2f2;
2142
+ }
2143
+ .mention-search-item {
2144
+ cursor: pointer;
2145
+ padding: 12px 1rem;
2146
+ display: flex;
2147
+ align-items: center;
2148
+ &.item-selected {
2149
+ background-color: ${miscTheme.theme.colors.gray100};
2150
+ }
2151
+ .search-avatar {
2152
+ width: 40px;
2153
+ height: 40px;
2154
+ font-size: 20px;
2155
+ margin-right: 20px;
2156
+ }
2157
+ }
2158
+ }
2159
+ `;
2160
+
2161
+ let ReactQuill = null;
2162
+ (() => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
2163
+ if (typeof window === 'undefined')
2164
+ return;
2165
+ const QuillRes = yield Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('react-quill')); });
2166
+ ReactQuill = QuillRes.default;
2167
+ const Quill = QuillRes.Quill || ReactQuill.Quill;
2168
+ class PreserveWhiteSpace {
2169
+ constructor(quill, options) {
2170
+ this.quill = quill;
2171
+ this.options = options;
2172
+ quill.container.style.whiteSpace = 'pre-line';
2173
+ }
2174
+ }
2175
+ Quill.register('modules/preserveWhiteSpace', PreserveWhiteSpace);
2176
+ const Inline = Quill.import('blots/inline');
2177
+ class MockABlot extends Inline {
2178
+ static create(options) {
2179
+ if (!options)
2180
+ return super.create(false);
2181
+ const node = super.create(options);
2182
+ MockABlot.setNodeConfigurations(node, options);
2183
+ return node;
2184
+ }
2185
+ static formats(node) {
2186
+ if (node.innerText &&
2187
+ (node.getAttribute('data-href') ||
2188
+ node.getAttribute('data-url') ||
2189
+ node.getAttribute('data-error') ||
2190
+ node.getAttribute('data-bad-word'))) {
2191
+ return {
2192
+ 'data-bad-word': node.getAttribute('data-bad-word'),
2193
+ 'data-error': node.getAttribute('data-error'),
2194
+ 'data-href': node.getAttribute('data-href'),
2195
+ 'data-url': node.getAttribute('data-url'),
2196
+ 'data-text': node.innerText || node.getAttribute('data-href'),
2197
+ };
2198
+ }
2199
+ else {
2200
+ return false;
2201
+ }
2202
+ }
2203
+ /* To prevent the node from accidentally being built in different ways. */
2204
+ static setNodeConfigurations(node, value) {
2205
+ var _a, _b;
2206
+ if (!value)
2207
+ return;
2208
+ if (!((_b = (_a = value === null || value === void 0 ? void 0 : value['data-text']) === null || _a === void 0 ? void 0 : _a.replace(/(\&nbsp;)+/g, ' ')) === null || _b === void 0 ? void 0 : _b.replace(/(\u200c|&zwnj;)+/g, '')))
2209
+ return;
2210
+ if (value['data-bad-word'])
2211
+ node.setAttribute('data-bad-word', value['data-bad-word']);
2212
+ if (value['data-href'])
2213
+ node.setAttribute('data-href', value['data-href']);
2214
+ if (value['data-error'])
2215
+ node.setAttribute('data-error', value['data-error']);
2216
+ // setTimeout(() => {
2217
+ // if (value['data-text'] !== node.innerText && !node.innerText)
2218
+ // node.innerHTML = value['data-text']
2219
+ // }, 200)
2220
+ if (value['data-url'])
2221
+ node.setAttribute('data-url', value['data-url']);
2222
+ // if (value['data-text']) node.innerText = value['data-text']
2223
+ // console.log(value, node.outerHTML, node)
2224
+ }
2225
+ }
2226
+ MockABlot.blotName = 'mocka1';
2227
+ MockABlot.tagName = 'mocka';
2228
+ Quill.register(MockABlot);
2229
+ class MentionBlot extends Inline {
2230
+ static create(options) {
2231
+ if (!options)
2232
+ return super.create(false);
2233
+ const node = super.create(options);
2234
+ MentionBlot.setNodeConfigurations(node, options);
2235
+ return node;
2236
+ }
2237
+ static formats(node) {
2238
+ if (node.getAttribute('data-name') && node.getAttribute('data-id')) {
2239
+ return {
2240
+ 'data-name': node.getAttribute('data-name'),
2241
+ 'data-id': node.getAttribute('data-id'),
2242
+ };
2243
+ }
2244
+ else {
2245
+ return false;
2246
+ }
2247
+ }
2248
+ /* To prevent the node from accidentally being built in different ways. */
2249
+ static setNodeConfigurations(node, value) {
2250
+ var _a, _b;
2251
+ if (!value)
2252
+ return;
2253
+ if (!value['data-id'] ||
2254
+ !((_b = (_a = value === null || value === void 0 ? void 0 : value['data-name']) === null || _a === void 0 ? void 0 : _a.replace(/(\&nbsp;)+/g, ' ')) === null || _b === void 0 ? void 0 : _b.replace(/(\u200c|&zwnj;)+/g, '')))
2255
+ return;
2256
+ if (value['data-id'])
2257
+ node.setAttribute('data-id', value['data-id']);
2258
+ if (value['data-name']) {
2259
+ // node.setAttribute('contenteditable', false)
2260
+ node.setAttribute('data-name', value['data-name']);
2261
+ }
2262
+ }
2263
+ }
2264
+ MentionBlot.blotName = 'mention';
2265
+ MentionBlot.tagName = 'mention';
2266
+ Quill.register(MentionBlot);
2267
+ }))();
2268
+ function getCaretCharacterOffsetWithin(element) {
2269
+ var _a, _b;
2270
+ let caretOffset = -1;
2271
+ if (typeof window.getSelection != 'undefined') {
2272
+ const sel = window.getSelection();
2273
+ if ((sel === null || sel === void 0 ? void 0 : sel.rangeCount) && (sel === null || sel === void 0 ? void 0 : sel.rangeCount) > 0) {
2274
+ const range = (_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.getRangeAt(0);
2275
+ if (range) {
2276
+ const preCaretRange = range.cloneRange();
2277
+ // preCaretRange.setStart(element, 0)
2278
+ preCaretRange.selectNodeContents(element);
2279
+ preCaretRange.setEnd(range.endContainer, range.endOffset);
2280
+ caretOffset = calculateChildNodeOffset(preCaretRange.cloneContents().childNodes, caretOffset);
2281
+ const parentMockAElement = (_b = range.endContainer.parentElement) === null || _b === void 0 ? void 0 : _b.closest('mocka');
2282
+ const lastNodeValue = range.endContainer.nodeValue ||
2283
+ range.endContainer.outerHTML;
2284
+ if (parentMockAElement && (lastNodeValue === null || lastNodeValue === void 0 ? void 0 : lastNodeValue.length)) {
2285
+ /// set selector to end of <mocka elemt, prevent select in the middle
2286
+ caretOffset =
2287
+ caretOffset -
2288
+ range.endOffset +
2289
+ (parentMockAElement.outerHTML.length -
2290
+ (parentMockAElement === null || parentMockAElement === void 0 ? void 0 : parentMockAElement.outerHTML.lastIndexOf(lastNodeValue)));
2291
+ }
2292
+ }
2293
+ }
2294
+ }
2295
+ return caretOffset;
2296
+ }
2297
+ function calculateChildNodeOffset(childNodes, caretOffset) {
2298
+ childNodes.forEach((node, index) => {
2299
+ const isLast = index + 1 === childNodes.length;
2300
+ if (node.nodeType === Node.ELEMENT_NODE) {
2301
+ const outerHTML = node.outerHTML;
2302
+ if (!isLast) {
2303
+ caretOffset += outerHTML.length;
2304
+ return;
2305
+ }
2306
+ else {
2307
+ caretOffset += outerHTML.indexOf('>') + 1;
2308
+ caretOffset = calculateChildNodeOffset(node.childNodes, caretOffset);
2309
+ }
2310
+ }
2311
+ else if (node.nodeType === Node.TEXT_NODE) {
2312
+ caretOffset += (node.nodeValue || '')
2313
+ .replace(/&/g, '&amp;')
2314
+ .replace(/</g, '&lt;')
2315
+ .replace(/>/g, '&gt;')
2316
+ .replace(/"/g, '&quot;')
2317
+ .replace(/'/g, '&#039;').length;
2318
+ }
2319
+ });
2320
+ return caretOffset;
2321
+ }
2322
+ function getSearchName(root) {
2323
+ var _a, _b;
2324
+ let res = null;
2325
+ if (typeof window.getSelection != 'undefined') {
2326
+ const sel = window.getSelection();
2327
+ if ((sel === null || sel === void 0 ? void 0 : sel.rangeCount) && (sel === null || sel === void 0 ? void 0 : sel.rangeCount) > 0) {
2328
+ const range = (_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.getRangeAt(0);
2329
+ if (range) {
2330
+ const preCaretRange = range.cloneRange();
2331
+ // preCaretRange.setStart(element, 0)
2332
+ preCaretRange.selectNodeContents(root);
2333
+ preCaretRange.setEnd(range.endContainer, range.endOffset);
2334
+ const endText = (preCaretRange.endContainer.nodeValue || '').substring(0, range.endOffset);
2335
+ // only allow @ at start of text or has space before it
2336
+ const lastAnchorSymbolIndex = endText.lastIndexOf('@');
2337
+ if (lastAnchorSymbolIndex + 1 < endText.length &&
2338
+ (lastAnchorSymbolIndex === 0 ||
2339
+ endText.slice(lastAnchorSymbolIndex - 1, lastAnchorSymbolIndex + 1) === ' @')) {
2340
+ const name = (_b = endText.slice(lastAnchorSymbolIndex + 1)) === null || _b === void 0 ? void 0 : _b.trim();
2341
+ if (name) {
2342
+ preCaretRange.setStart(range.endContainer, lastAnchorSymbolIndex);
2343
+ const replaceRange = preCaretRange.cloneRange();
2344
+ replaceRange.setStart(replaceRange.endContainer, lastAnchorSymbolIndex);
2345
+ res = {
2346
+ name,
2347
+ rect: preCaretRange.getBoundingClientRect(),
2348
+ replaceRange,
2349
+ };
2350
+ }
2351
+ }
2352
+ }
2353
+ }
2354
+ }
2355
+ return res;
2356
+ }
2357
+ const inputModify$1 = (value, opts) => {
2358
+ var _a;
2359
+ const { formatUrl, bannedWords = [] } = opts || {};
2360
+ const removedFormat = post.fixMalformedMention(post.removeFontFormat(value));
2361
+ if (!formatUrl)
2362
+ return {
2363
+ value: post.highlightBadWords(removedFormat, bannedWords),
2364
+ };
2365
+ let descriptionWithWrappedAnchor = post.removeEdittedBannedWord(post.wrapAnchorAroundUrls(removedFormat));
2366
+ const urls = post.getUrlsFromEditorString(removedFormat);
2367
+ if (urls) {
2368
+ const invalidUrls = [];
2369
+ let previewUrl = '';
2370
+ urls.forEach((url) => {
2371
+ if (!url)
2372
+ return;
2373
+ try {
2374
+ const jsUrl = new URL(url);
2375
+ if (post.ALLOW_DOMAIN_URL.some((o) => jsUrl.origin.endsWith(o))) {
2376
+ // is valid
2377
+ }
2378
+ else {
2379
+ invalidUrls.push(url);
2380
+ // is not valid
2381
+ }
2382
+ }
2383
+ catch (_a) {
2384
+ invalidUrls.push(url);
2385
+ }
2386
+ });
2387
+ if (invalidUrls.length > 0) {
2388
+ descriptionWithWrappedAnchor = descriptionWithWrappedAnchor
2389
+ .replace(new RegExp(`data-url="true">(${invalidUrls.map(post.escapeRegExp).join('|')})<`, 'gi'), 'data-error="true" data-url="true">$1<')
2390
+ .replace(new RegExp(`data-href="(${invalidUrls
2391
+ .map(post.escapeRegExp)
2392
+ .join('|')})" data-url="true">`, 'gi'), 'data-href="$1" data-error="true" data-url="true">');
2393
+ }
2394
+ previewUrl = (_a = urls.filter((u) => invalidUrls.indexOf(u) === -1)) === null || _a === void 0 ? void 0 : _a[0];
2395
+ return {
2396
+ invalidUrls,
2397
+ previewUrl,
2398
+ value: post.highlightBadWords(descriptionWithWrappedAnchor, bannedWords),
2399
+ };
2400
+ }
2401
+ return {
2402
+ value: post.highlightBadWords(descriptionWithWrappedAnchor, bannedWords),
2403
+ };
2404
+ };
2405
+ const RichTextEditor = ({ html, onChange, className, style, placeholder, onImagePickerClick, bannedWords = [], onInvalidUrlsChange, onPreviewUrlChange, setEditorRef, isReplying, }) => {
2406
+ var _a, _b, _c, _d;
2407
+ const bannedWordsRef = React.useRef([]);
2408
+ bannedWordsRef.current = bannedWords;
2409
+ const [invalidUrls, setInvalidUrls] = React.useState([]);
2410
+ const [previewUrl, setPreviewUrl] = React.useState(null);
2411
+ const { data: { locale }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
2412
+ const bannedString = (bannedWords === null || bannedWords === void 0 ? void 0 : bannedWords.join(',')) || '';
2413
+ React.useEffect(() => {
2414
+ var _a, _b;
2415
+ const currHTML = (_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root.innerHTML;
2416
+ debounceInputModify(currHTML);
2417
+ }, [bannedString]);
2418
+ const fetchPreviewData = (url) => {
2419
+ if (!previewUrl || previewUrl.url !== url) {
2420
+ setPreviewUrl({
2421
+ url,
2422
+ isFetching: true,
2423
+ });
2424
+ togetherComponentGlobalContext.callApi(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.FETCH_PREVIEW, {
2425
+ _locale: locale,
2426
+ }), 'POST', {
2427
+ data: {
2428
+ link: url,
2429
+ },
2430
+ })
2431
+ .then((res) => {
2432
+ var _a, _b, _c, _d;
2433
+ setPreviewUrl({
2434
+ title: (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.title,
2435
+ description: (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.description,
2436
+ image: ((_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.image) || ((_d = res === null || res === void 0 ? void 0 : res.data) === null || _d === void 0 ? void 0 : _d.logo),
2437
+ url,
2438
+ });
2439
+ })
2440
+ .catch(() => {
2441
+ setPreviewUrl(null);
2442
+ });
2443
+ }
2444
+ };
2445
+ const fetchPreviewDataRef = React.useRef(fetchPreviewData);
2446
+ fetchPreviewDataRef.current = fetchPreviewData;
2447
+ const debounceInputModify = React.useCallback(debounce__default["default"]((v) => {
2448
+ if (v) {
2449
+ const processedInput = inputModify$1(v, {
2450
+ bannedWords: bannedWordsRef.current,
2451
+ formatUrl: true,
2452
+ });
2453
+ const { invalidUrls: _invalidUrls, previewUrl: _previewUrl, value, } = processedInput;
2454
+ if (_invalidUrls) {
2455
+ setInvalidUrls(_invalidUrls);
2456
+ }
2457
+ if (_previewUrl) {
2458
+ fetchPreviewDataRef.current(_previewUrl);
2459
+ }
2460
+ else
2461
+ setPreviewUrl(null);
2462
+ if (value !== v) {
2463
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
2464
+ }
2465
+ }
2466
+ }, 500), []);
2467
+ React.useEffect(() => {
2468
+ onInvalidUrlsChange && onInvalidUrlsChange(invalidUrls);
2469
+ }, [invalidUrls]);
2470
+ React.useEffect(() => {
2471
+ if (onPreviewUrlChange) {
2472
+ if (previewUrl === null || previewUrl === void 0 ? void 0 : previewUrl.url)
2473
+ onPreviewUrlChange({
2474
+ title: previewUrl.title || '',
2475
+ url: previewUrl.url || '',
2476
+ image: previewUrl.image || '',
2477
+ description: previewUrl.description || '',
2478
+ });
2479
+ else
2480
+ onPreviewUrlChange(null);
2481
+ }
2482
+ }, [previewUrl]);
2483
+ const imageHandlerRef = React.useRef(onImagePickerClick);
2484
+ imageHandlerRef.current = onImagePickerClick;
2485
+ const toolbarId = useUniqueId.useUniqueId();
2486
+ const cachedModules = React.useRef({
2487
+ toolbar: {
2488
+ handlers: {
2489
+ image: () => { var _a; return (_a = imageHandlerRef.current) === null || _a === void 0 ? void 0 : _a.call(imageHandlerRef); },
2490
+ link: () => false,
2491
+ },
2492
+ container: '#toolbar-' + toolbarId,
2493
+ },
2494
+ // toolbar: [
2495
+ // ['bold', 'italic', 'underline'],
2496
+ // [{ list: 'ordered' }, { list: 'bullet' }],
2497
+ // ],
2498
+ preserveWhiteSpace: true,
2499
+ });
2500
+ const contentEditableCaretPos = React.useRef(-1);
2501
+ const reactQuillRef = React.useRef(null);
2502
+ setEditorRef &&
2503
+ ((_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root) &&
2504
+ setEditorRef((_d = (_c = reactQuillRef.current) === null || _c === void 0 ? void 0 : _c.getEditor()) === null || _d === void 0 ? void 0 : _d.root);
2505
+ const handleSelectionChange = () => {
2506
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2507
+ if ((_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root) {
2508
+ const newCaretPos = getCaretCharacterOffsetWithin((_d = (_c = reactQuillRef.current) === null || _c === void 0 ? void 0 : _c.getEditor()) === null || _d === void 0 ? void 0 : _d.root);
2509
+ const currHTML = (_f = (_e = reactQuillRef.current) === null || _e === void 0 ? void 0 : _e.getEditor()) === null || _f === void 0 ? void 0 : _f.root.innerHTML;
2510
+ // in case of clicking on a div outside editor while focus, we get caret position too large
2511
+ if (newCaretPos >= 0 && newCaretPos < currHTML.length) {
2512
+ const mentionIds = post.getMentionIdsFromString(currHTML, true);
2513
+ if (mentionIds.length < post.LIMIT_MENTION - (isReplying ? 1 : 0)) {
2514
+ const searchData = getSearchName((_h = (_g = reactQuillRef.current) === null || _g === void 0 ? void 0 : _g.getEditor()) === null || _h === void 0 ? void 0 : _h.root);
2515
+ if (searchData) {
2516
+ searchUser(searchData.name, searchData.rect);
2517
+ replaceRangeRef.current = searchData.replaceRange;
2518
+ }
2519
+ else {
2520
+ replaceRangeRef.current = null;
2521
+ // to avoid race condition, we reuse this function to clear foundUsers
2522
+ searchUser('', null);
2523
+ }
2524
+ }
2525
+ else {
2526
+ replaceRangeRef.current = null;
2527
+ // to avoid race condition, we reuse this function to clear foundUsers
2528
+ searchUser('', null);
2529
+ }
2530
+ // const insertIndex = newCaretPos + 1
2531
+ // const currHTML = reactQuillRef.current?.getEditor()?.root.innerHTML
2532
+ // console.log(
2533
+ // currHTML?.substring(0, insertIndex) || '',
2534
+ // '========',
2535
+ // currHTML?.substring(insertIndex) || '',
2536
+ // )
2537
+ contentEditableCaretPos.current = newCaretPos;
2538
+ }
2539
+ }
2540
+ else {
2541
+ setFoundUsers([]);
2542
+ }
2543
+ };
2544
+ const [foundUsers, setFoundUsers] = React.useState([]);
2545
+ const [searchUserPosition, setSearchUserPosition] = React.useState({
2546
+ top: 0,
2547
+ left: 0,
2548
+ });
2549
+ const searchUser = React.useCallback(debounce__default["default"]((name, rect, excludeIds) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
2550
+ var _e, _f, _g, _h;
2551
+ if (!name || !DOMRect) {
2552
+ return setFoundUsers([]);
2553
+ }
2554
+ const res = yield ((((_e = miscCookieHelper.getCookie(constants.BEARER_TOKEN_COOKIE)) === null || _e === void 0 ? void 0 : _e.length) || 0) > 0
2555
+ ? togetherComponentGlobalContext.callApiWithAuth(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.SEARCH_USER, {
2556
+ _locale: locale,
2557
+ name: name,
2558
+ }), 'get')
2559
+ : togetherComponentGlobalContext.callApiWithAdminAuth(togetherComponentGlobalContext.getApiPath(togetherApiPaths.ADMIN_PATHS.SEARCH_USER, {
2560
+ _locale: locale,
2561
+ name: name,
2562
+ }), 'get'));
2563
+ setSelectTagUserIndex(0);
2564
+ setFoundUsers((_g = (_f = res === null || res === void 0 ? void 0 : res.data) === null || _f === void 0 ? void 0 : _f.users) === null || _g === void 0 ? void 0 : _g.filter((u) => !(excludeIds === null || excludeIds === void 0 ? void 0 : excludeIds.includes(String(u.id)))));
2565
+ const textNodeRect = rect;
2566
+ const containerRect = (_h = containerRef.current) === null || _h === void 0 ? void 0 : _h.getBoundingClientRect();
2567
+ if (textNodeRect && containerRect) {
2568
+ const idealWidth = 343;
2569
+ const idealHeight = 256;
2570
+ const styleConfig = {
2571
+ top: textNodeRect.bottom - containerRect.top,
2572
+ width: `min(343px, 100%)`,
2573
+ maxHeight: idealHeight,
2574
+ };
2575
+ const tempRightWidth = containerRect.width - (textNodeRect.left - containerRect.left);
2576
+ if (tempRightWidth < idealWidth) {
2577
+ styleConfig.right = 0;
2578
+ }
2579
+ else {
2580
+ styleConfig.left = textNodeRect.left - containerRect.left;
2581
+ }
2582
+ setSearchUserPosition(styleConfig);
2583
+ }
2584
+ }), 500), []);
2585
+ const setSelectUser = (id, name) => {
2586
+ var _a, _b, _c;
2587
+ if (replaceRangeRef.current) {
2588
+ replaceRangeRef.current.deleteContents();
2589
+ const newMention = document.createElement('mention');
2590
+ newMention.setAttribute('data-id', id);
2591
+ newMention.setAttribute('data-name', name);
2592
+ // newMention.setAttribute('contenteditable', 'false')
2593
+ newMention.innerText = name;
2594
+ const newPostText = document.createTextNode(' ');
2595
+ replaceRangeRef.current.insertNode(newPostText);
2596
+ replaceRangeRef.current.insertNode(newMention);
2597
+ const editorRoot = (_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root;
2598
+ editorRoot.focus();
2599
+ const range = (_c = window.getSelection()) === null || _c === void 0 ? void 0 : _c.getRangeAt(0);
2600
+ range === null || range === void 0 ? void 0 : range.setStart(replaceRangeRef.current.endContainer, replaceRangeRef.current.endOffset);
2601
+ range === null || range === void 0 ? void 0 : range.setEnd(replaceRangeRef.current.endContainer, replaceRangeRef.current.endOffset);
2602
+ }
2603
+ setFoundUsers([]);
2604
+ };
2605
+ const containerRef = React.useRef(null);
2606
+ const replaceRangeRef = React.useRef(null);
2607
+ const foundUsersListRef = React.useRef(null);
2608
+ const [selectTagUserIndex, setSelectTagUserIndex] = React.useState(0);
2609
+ React.useEffect(() => {
2610
+ // convenient behavior, scroll item into view when select using keyboard
2611
+ if (foundUsersListRef.current) {
2612
+ const parentElement = foundUsersListRef.current;
2613
+ const childElement = parentElement.children.item(selectTagUserIndex);
2614
+ if (childElement) {
2615
+ const containerRect = parentElement.getBoundingClientRect();
2616
+ const childRect = childElement.getBoundingClientRect();
2617
+ if (childElement.offsetTop < parentElement.scrollTop)
2618
+ parentElement.scrollTop = childElement.offsetTop;
2619
+ else if (childElement.offsetTop + childRect.height >
2620
+ parentElement.scrollTop + containerRect.height) {
2621
+ parentElement.scrollTop =
2622
+ childElement.offsetTop - containerRect.height + childRect.height;
2623
+ }
2624
+ }
2625
+ }
2626
+ }, [selectTagUserIndex]);
2627
+ React.useEffect(() => {
2628
+ const clickHandler = function (e) {
2629
+ var _a;
2630
+ if (!((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
2631
+ // Clicked outside the box
2632
+ setFoundUsers([]);
2633
+ }
2634
+ };
2635
+ window.addEventListener('click', clickHandler, {
2636
+ passive: true,
2637
+ });
2638
+ return () => {
2639
+ window.removeEventListener('click', clickHandler);
2640
+ };
2641
+ }, []);
2642
+ React.useEffect(() => {
2643
+ var _a, _b;
2644
+ if (placeholder && reactQuillRef) {
2645
+ const elmInput = (_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root;
2646
+ if (elmInput) {
2647
+ elmInput.setAttribute('data-placeholder', placeholder);
2648
+ }
2649
+ }
2650
+ }, [placeholder]);
2651
+ return (React__default["default"].createElement(StyledEditorContainer, { ref: containerRef, className: className, style: style, onKeyDownCapture: (e) => {
2652
+ // convenient behavior, use arrow to select tag user and enter to choose
2653
+ if (foundUsers === null || foundUsers === void 0 ? void 0 : foundUsers.length) {
2654
+ let preventKey = false;
2655
+ if (e.key === 'ArrowDown') {
2656
+ preventKey = true;
2657
+ setSelectTagUserIndex((s) => s + 1 >= foundUsers.length ? 0 : s + 1);
2658
+ }
2659
+ else if (e.key === 'Escape') {
2660
+ preventKey = true;
2661
+ setSelectTagUserIndex(0);
2662
+ setFoundUsers([]);
2663
+ }
2664
+ else if (e.key === 'ArrowUp') {
2665
+ preventKey = true;
2666
+ setSelectTagUserIndex((s) => s - 1 < 0 ? foundUsers.length - 1 : s - 1);
2667
+ }
2668
+ else if (e.key === 'Enter' || e.key === 'Tab') {
2669
+ const user = foundUsers[selectTagUserIndex];
2670
+ if (user) {
2671
+ preventKey = true;
2672
+ setSelectUser(user.id, user.name);
2673
+ }
2674
+ }
2675
+ if (preventKey) {
2676
+ e.preventDefault();
2677
+ return false;
2678
+ }
2679
+ }
2680
+ } },
2681
+ React__default["default"].createElement(CustomToolbar, { id: toolbarId, onAddLink: (text, href) => {
2682
+ var _a, _b;
2683
+ const insertIndex = contentEditableCaretPos.current + 1;
2684
+ const currHTML = (_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root.innerHTML;
2685
+ const newHTML = ((currHTML === null || currHTML === void 0 ? void 0 : currHTML.substring(0, insertIndex)) || '') +
2686
+ `<mocka data-href="${href}" data-url="true">${text}</mocka> ` +
2687
+ ((currHTML === null || currHTML === void 0 ? void 0 : currHTML.substring(insertIndex)) || '');
2688
+ onChange === null || onChange === void 0 ? void 0 : onChange(newHTML);
2689
+ debounceInputModify(newHTML);
2690
+ } }),
2691
+ ReactQuill && (React__default["default"].createElement(ReactQuill, { ref: reactQuillRef, theme: "snow", value: html, placeholder: placeholder, onChange: (t) => {
2692
+ onChange === null || onChange === void 0 ? void 0 : onChange(t);
2693
+ debounceInputModify(t);
2694
+ handleSelectionChange();
2695
+ }, onChangeSelection: () => {
2696
+ handleSelectionChange();
2697
+ }, modules: cachedModules.current, formats: [
2698
+ 'mocka1',
2699
+ 'mention',
2700
+ 'id',
2701
+ 'key',
2702
+ 'bold',
2703
+ 'italic',
2704
+ 'underline',
2705
+ 'list',
2706
+ 'bullet',
2707
+ ] })),
2708
+ !!(foundUsers === null || foundUsers === void 0 ? void 0 : foundUsers.length) && (React__default["default"].createElement("div", { ref: foundUsersListRef, className: "mention-search-container", style: searchUserPosition }, foundUsers.map((foundUser, index) => (React__default["default"].createElement("div", { className: `mention-search-item ${selectTagUserIndex === index ? 'item-selected' : ''}`, key: foundUser.id, onClick: (e) => {
2709
+ e.preventDefault();
2710
+ e.stopPropagation();
2711
+ setSelectUser(foundUser.id, foundUser.name);
2712
+ }, onMouseEnter: () => {
2713
+ setSelectTagUserIndex(index);
2714
+ } },
2715
+ React__default["default"].createElement(index$a.UserAvatar, { className: "search-avatar", username: foundUser.name, avatar: foundUser.avatar }),
2716
+ React__default["default"].createElement("div", null,
2717
+ React__default["default"].createElement(index$2.Text, { size: "p2" }, foundUser.name),
2718
+ React__default["default"].createElement(index$2.Text, { size: "p4", color: "#595959" },
2719
+ "@",
2720
+ foundUser.username)))))))));
2721
+ };
2722
+ const CustomToolbar = ({ onAddLink, id, }) => {
2723
+ return (React__default["default"].createElement("div", { id: 'toolbar-' + id, onClick: (e) => {
2724
+ e.preventDefault();
2725
+ e.stopPropagation();
2726
+ } },
2727
+ React__default["default"].createElement("span", { className: "ql-formats" },
2728
+ React__default["default"].createElement("button", { className: "ql-bold", type: "button" }),
2729
+ React__default["default"].createElement("button", { className: "ql-italic", type: "button" }),
2730
+ React__default["default"].createElement("button", { className: "ql-underline", type: "button" })),
2731
+ React__default["default"].createElement("span", { className: "ql-formats" },
2732
+ React__default["default"].createElement("button", { className: "ql-list", value: "ordered", type: "button" }),
2733
+ React__default["default"].createElement("button", { className: "ql-list", value: "bullet", type: "button" })),
2734
+ React__default["default"].createElement("span", { className: "ql-formats" }, onAddLink && (React__default["default"].createElement(index$b.PopoverMenu, { className: "link-tool-wrapper", toggleButtonContent: React__default["default"].createElement("img", { className: "link-icon", src: togetherRichTextEditor.IconLink, loading: "lazy" }), buttonProps: {
2735
+ size: 'md',
2736
+ color: 'transparent',
2737
+ }, align: "end" }, ({ setShow }) => (React__default["default"].createElement(LinkToolInputPopover, { onAddUrl: onAddLink, setShow: setShow })))))));
2738
+ };
2739
+ const URL_WARN_MAP = [
2740
+ 'notification.limitUrlDomain',
2741
+ 'notification.urlWrongFormat',
2742
+ ];
2743
+ const LinkToolInputPopover = ({ onAddUrl, setShow }) => {
2744
+ const { data: { env: { isMarryBaby }, }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
2745
+ const { t } = index.useTranslations();
2746
+ const [urlValue, setUrlValue] = React.useState('');
2747
+ const [textValue, setTextValue] = React.useState('');
2748
+ const [urlWarnType, setUrlWarnType] = React.useState(-1);
2749
+ const checkUrlValid = (v) => {
2750
+ const trimmedUrl = post.reformatUrl(v.trim());
2751
+ try {
2752
+ const jsUrl = new URL(trimmedUrl);
2753
+ if (!jsUrl.protocol.startsWith('http')) {
2754
+ setUrlWarnType(1);
2755
+ return false;
2756
+ }
2757
+ if (!post.ALLOW_DOMAIN_URL.some((o) => jsUrl.origin.endsWith('/' + o) || jsUrl.origin.endsWith('.' + o))) {
2758
+ setUrlWarnType(0);
2759
+ return false;
2760
+ }
2761
+ setUrlWarnType(-1);
2762
+ return true;
2763
+ }
2764
+ catch (_a) {
2765
+ setUrlWarnType(1);
2766
+ return false;
2767
+ }
2768
+ };
2769
+ const isValid = urlValue.trim() && textValue.trim() && urlWarnType < 0;
2770
+ return (React__default["default"].createElement("div", { className: "link-tool-popover" },
2771
+ React__default["default"].createElement(index$4.Input, { name: "url", value: urlValue, size: "md", label: "URL", placeholder: t('placeholder.enterUrlHere'), type: "text", className: "link-input-url", onChange: (v) => {
2772
+ setUrlValue(v);
2773
+ checkUrlValid(v);
2774
+ } }),
2775
+ urlWarnType >= 0 && (React__default["default"].createElement(index$2.Text, { size: "c2", className: "error-text" }, t(URL_WARN_MAP[urlWarnType]))),
2776
+ React__default["default"].createElement(index$4.Input, { name: "text", value: textValue, size: "md", label: t('createPost.urlText'), placeholder: t('placeholder.enterUrlTextHere'), type: "text", className: "link-input-text", onChange: (v) => setTextValue(v) }),
2777
+ React__default["default"].createElement("div", { "data-is-marrybaby": isMarryBaby, className: "link-input-button-wrapper" },
2778
+ React__default["default"].createElement(index$c.Button, { theme: isMarryBaby ? 'marryBaby' : 'helloSites', size: "sm", color: "primary", className: "link-input-button", onClick: () => {
2779
+ if (!isValid)
2780
+ return;
2781
+ onAddUrl(textValue.trim(), post.reformatUrl(urlValue.trim()));
2782
+ setShow && setShow(false);
2783
+ }, isDisabled: !isValid }, t('insert')))));
2784
+ };
2785
+
2786
+ const StyledCreatePostTitle = styled__default["default"].div `
2787
+ input:focus,
2788
+ textarea:focus,
2789
+ [contenteditable='true'] {
2790
+ outline: none;
2791
+ }
2792
+
2793
+ input {
2794
+ &::placeholder {
2795
+ font-size: 16px;
2796
+ color: ${miscTheme.theme.colors.gray400};
2797
+ font-weight: 400;
2798
+ line-height: 24px;
2799
+ }
2800
+ }
2801
+
2802
+ .title-input {
2803
+ overflow: hidden;
2804
+ width: 100%;
2805
+ padding: 12px 16px;
2806
+ border: solid 1px #d9d9d9;
2807
+ border-radius: ${miscTheme.theme.borderRadius};
2808
+ font-size: 16px;
2809
+ line-height: 1.2;
2810
+ white-space: nowrap;
2811
+ :focus {
2812
+ border-color: ${(props) => props.color};
2813
+ box-shadow: 0px 0px 2px 2px ${(props) => props.colorShadow};
2814
+ }
2815
+ br {
2816
+ display: none;
2817
+ }
2818
+ * {
2819
+ display: inline;
2820
+ white-space: nowrap;
2821
+ }
2822
+ mocka {
2823
+ padding: 2px 6px;
2824
+ border-radius: 1rem;
2825
+ &[data-error='true'] {
2826
+ background-color: #ffeeee;
2827
+ color: red;
2828
+ text-decoration: underline;
2829
+ font-style: bold;
2830
+ }
2831
+ }
2832
+ ol,
2833
+ ul {
2834
+ padding-left: 1rem;
2835
+ }
2836
+ }
2837
+
2838
+ label {
2839
+ display: block;
2840
+ margin-bottom: 5px;
2841
+ color: ${miscTheme.theme.colors.gray600};
2842
+ font-size: 13px;
2843
+ font-weight: bold;
2844
+ }
2845
+
2846
+ .count-string {
2847
+ color: ${miscTheme.theme.colors.gray400};
2848
+ font-size: 14px;
2849
+ text-align: right;
2850
+ font-weight: 400;
2851
+ line-height: 22px;
2852
+ letter-spacing: -0.2px;
2853
+ text-transform: lowercase;
2854
+ }
2855
+
2856
+ .has-input-error {
2857
+ input {
2858
+ border: 1px solid ${miscTheme.theme.colors.red600};
2859
+ }
2860
+ }
2861
+ `;
2862
+ const StyleWrapperTitle = styled__default["default"].div `
2863
+ display: flex;
2864
+ justify-content: space-between;
2865
+ align-items: center;
2866
+ margin-bottom: 2px;
2867
+
2868
+ .field-label {
2869
+ color: ${miscTheme.theme.colors.gray600};
2870
+ font-size: 14px;
2871
+ font-weight: 600;
2872
+ line-height: 22px;
2873
+ }
2874
+ `;
2875
+
2876
+ var ErrorFieldKey;
2877
+ (function (ErrorFieldKey) {
2878
+ ErrorFieldKey["title"] = "create-post-title-field";
2879
+ ErrorFieldKey["description"] = "create-post-description-field";
2880
+ ErrorFieldKey["photos"] = "create-post-photos-field";
2881
+ })(ErrorFieldKey || (ErrorFieldKey = {}));
2882
+ const orderErrorFieldKey = ['title', 'description', 'photos'];
2883
+
2884
+ const CreatePostDescription = ({ className, style, bannedWords = [], value, placeholder = '', onChange, onPreviewUrlChange, onInvalidUrlsChange, isReplying, footerEditor, }) => {
2885
+ const { t } = index.useTranslations();
2886
+ const [previewUrl, setPreviewUrl] = React.useState(null);
2887
+ const imagePicker = React.useRef(null);
2888
+ React.useEffect(() => {
2889
+ if (onPreviewUrlChange) {
2890
+ if (previewUrl === null || previewUrl === void 0 ? void 0 : previewUrl.url)
2891
+ onPreviewUrlChange({
2892
+ title: previewUrl.title || '',
2893
+ url: previewUrl.url || '',
2894
+ image: previewUrl.image || '',
2895
+ description: previewUrl.description || '',
2896
+ });
2897
+ else
2898
+ onPreviewUrlChange(null);
2899
+ }
2900
+ }, [previewUrl]);
2901
+ return (React__default["default"].createElement("div", null,
2902
+ React__default["default"].createElement(StyleWrapperTitle, null,
2903
+ React__default["default"].createElement(index$2.Text, { size: "p4", className: "field-label" }, t('createPost.popup.description'))),
2904
+ React__default["default"].createElement(StyledCreatePostDescription, { className: className, style: style },
2905
+ React__default["default"].createElement("div", { className: `textarea-control ${ErrorFieldKey.description}` },
2906
+ React__default["default"].createElement("div", { className: "textarea-wrapper" },
2907
+ React__default["default"].createElement(RichTextEditor, { html: value || '', placeholder: placeholder, onChange: onChange, bannedWords: bannedWords, onImagePickerClick: () => { var _a; return (_a = imagePicker.current) === null || _a === void 0 ? void 0 : _a.click(); }, onPreviewUrlChange: setPreviewUrl, onInvalidUrlsChange: onInvalidUrlsChange, isReplying: isReplying }))),
2908
+ footerEditor)));
2909
+ };
2910
+
2911
+ const StyledCreateNewPost = styled__default["default"].div `
2912
+ position: relative;
2913
+ display: flex;
2914
+ height: 100%;
2915
+ flex-direction: column;
2916
+
2917
+ ${utils.MediaQueries.mbDown} {
2918
+ padding: 16px 16px;
2919
+ }
2920
+
2921
+ .input-group-container {
2922
+ flex: 1;
2923
+ padding: 16px 24px;
2924
+ -ms-overflow-style: none; /* IE and Edge */
2925
+ overflow-y: auto;
2926
+ scrollbar-width: none; /* Firefox */
2927
+ &::-webkit-scrollbar {
2928
+ display: none;
2929
+ }
2930
+ }
2931
+
2932
+ .input-group {
2933
+ :not(:last-child) {
2934
+ margin-bottom: 0.6rem;
2935
+ }
2936
+
2937
+ input:focus,
2938
+ textarea:focus,
2939
+ [contenteditable='true'] {
2940
+ outline: none;
2941
+ }
2942
+
2943
+ label {
2944
+ margin-bottom: 5px;
2945
+ color: ${miscTheme.theme.colors.gray600};
2946
+ /* font-family: 'Open Sans', sans-serif; */
2947
+ font-size: 13px;
2948
+ font-weight: bold;
2949
+ }
2950
+
2951
+ .input-group-label {
2952
+ margin-bottom: 5px;
2953
+ color: ${miscTheme.theme.colors.gray600};
2954
+ /* font-family: 'Open Sans', sans-serif; */
2955
+ font-size: 13px;
2956
+ font-weight: bold;
2957
+ }
2958
+
2959
+ .input-notification {
2960
+ display: flex;
2961
+
2962
+ & > img {
2963
+ width: 16px;
2964
+ height: 16px;
2965
+ margin-top: 1.5px;
2966
+ margin-right: 8px;
2967
+ }
2968
+ }
2969
+
2970
+ .tag-list {
2971
+ }
2972
+ }
2973
+
2974
+ .warning {
2975
+ margin-top: 16px;
2976
+ }
2977
+
2978
+ .submit-btn {
2979
+ width: 100%;
2980
+ }
2981
+
2982
+ .switch-label {
2983
+ display: flex;
2984
+ align-items: center;
2985
+ }
2986
+
2987
+ .swich-input-group {
2988
+ padding: 12px 16px;
2989
+ border-radius: 8px;
2990
+ background: ${miscTheme.theme.colors.neutral50};
2991
+
2992
+ &.askdoctor-switch {
2993
+ background: ${miscTheme.theme.colors.primary50};
2994
+ &.mb-color {
2995
+ background: ${miscTheme.theme.mbColors.tonePink};
2996
+ }
2997
+ }
2998
+
2999
+ .mantine-Switch-labelWrapper {
3000
+ flex-grow: 1;
3001
+ }
3002
+ .mantine-Checkbox-body {
3003
+ display: flex;
3004
+ width: 100%;
3005
+ align-items: center;
3006
+ justify-content: space-between;
3007
+ }
3008
+ .mantine-Switch-track {
3009
+ margin-bottom: 0;
3010
+ }
3011
+ .label-txt {
3012
+ font-weight: normal;
3013
+ font-size: 14px;
3014
+ color: ${miscTheme.theme.colors.gray800};
3015
+ margin-left: 10px;
3016
+ }
3017
+ }
3018
+ `;
3019
+ const StyledIsQuestion = styled__default["default"].div `
3020
+ display: flex;
3021
+ width: 100%;
3022
+ align-items: center;
3023
+ justify-content: space-between;
3024
+ padding: 12px;
3025
+ border-radius: 0 0 8px 8px;
3026
+ background: ${miscTheme.theme.colors.neutral50};
3027
+ gap: 12px;
3028
+
3029
+ &.has-error {
3030
+ border: 1px solid ${miscTheme.theme.colors.red600};
3031
+ }
3032
+ &.error-description {
3033
+ border: 1px solid ${miscTheme.theme.colors.red600};
3034
+ border-top: none;
3035
+ }
3036
+
3037
+ &[data-is-marry-baby='true'] {
3038
+ background: ${miscTheme.theme.mbColors.tonePink};
3039
+ }
3040
+
3041
+ .switch-label {
3042
+ display: flex;
3043
+ gap: 12px;
3044
+ align-items: center;
3045
+
3046
+ .wrapper-text {
3047
+ .label-txt {
3048
+ color: ${miscTheme.theme.colors.gray800};
3049
+ font-size: 14px;
3050
+ font-weight: 600;
3051
+ line-height: 22px;
3052
+ }
3053
+ .description-txt {
3054
+ color: ${miscTheme.theme.colors.gray700};
3055
+ font-size: 12px;
3056
+ font-weight: 400;
3057
+ line-height: 18px;
3058
+ }
3059
+ }
3060
+ }
3061
+
3062
+ .switch-btn {
3063
+ .mantine-Switch-track {
3064
+ margin: 0;
3065
+ min-width: 40px;
3066
+ width: 40px;
3067
+ }
3068
+ .mantine-Switch-labelWrapper {
3069
+ display: none;
3070
+ }
3071
+ }
3072
+
3073
+ button {
3074
+ height: 40px;
3075
+ &:hover,
3076
+ &.primary {
3077
+ border-radius: 16px;
3078
+ border: 1px solid ${miscTheme.theme.colors.blue100};
3079
+ background: ${miscTheme.theme.colors.blue50};
3080
+ color: ${miscTheme.theme.colors.primaryBase};
3081
+ }
3082
+ }
3083
+ `;
3084
+ const StyledError = styled__default["default"].div `
3085
+ margin-bottom: 12px;
3086
+ color: ${miscTheme.theme.colors.red700};
3087
+ svg {
3088
+ margin-right: 5px;
3089
+ }
3090
+ svg,
3091
+ span {
3092
+ vertical-align: middle;
3093
+ }
3094
+ .mantine-Text-root {
3095
+ color: ${miscTheme.theme.colors.red600};
3096
+ font-size: 12px;
3097
+ font-weight: 400;
3098
+ line-height: 18px;
3099
+ display: block;
3100
+ }
3101
+ `;
3102
+ const StyledFormGroupInner = styled__default["default"].div `
3103
+ .swich-input-group {
3104
+ padding: 12px 16px;
3105
+ border-radius: 8px;
3106
+ background: ${miscTheme.theme.colors.neutral50};
3107
+
3108
+ &.askdoctor-switch {
3109
+ background: ${miscTheme.theme.colors.blue50};
3110
+ }
3111
+
3112
+ .switch-label {
3113
+ display: flex;
3114
+ align-items: center;
3115
+ }
3116
+ .mantine-Switch-labelWrapper {
3117
+ flex-grow: 1;
3118
+ }
3119
+ .mantine-Checkbox-body {
3120
+ display: flex;
3121
+ width: 100%;
3122
+ align-items: center;
3123
+ justify-content: space-between;
3124
+ }
3125
+ .mantine-Switch-track {
3126
+ margin-bottom: 0;
3127
+ }
3128
+ .label-txt {
3129
+ font-weight: normal;
3130
+ font-size: 14px;
3131
+ color: ${miscTheme.theme.colors.gray800};
3132
+ margin-left: 14px;
3133
+ }
3134
+ }
3135
+ `;
3136
+ const StylePostAction = styled__default["default"].div `
3137
+ display: flex;
3138
+ gap: 12px;
3139
+ .avatar {
3140
+ width: 40px;
3141
+ height: 40px;
3142
+ border-radius: 100%;
3143
+
3144
+ &.avatar-anonymous {
3145
+ background: ${miscTheme.theme.colors.neutral100};
3146
+ }
3147
+
3148
+ img {
3149
+ border-radius: 100%;
3150
+ }
3151
+
3152
+ .author-avatar {
3153
+ .col-left {
3154
+ display: none;
3155
+ }
3156
+ }
3157
+ }
3158
+
3159
+ .post-action-form {
3160
+ display: flex;
3161
+ flex-direction: column;
3162
+ gap: 4px;
3163
+ }
3164
+
3165
+ .post-action-by {
3166
+ color: ${miscTheme.theme.colors.gray800};
3167
+ font-size: 16px;
3168
+ font-weight: 600;
3169
+ line-height: 24px;
3170
+ }
3171
+
3172
+ .post-action-result {
3173
+ display: flex;
3174
+ position: relative;
3175
+ }
3176
+
3177
+ .dropdown-post-action {
3178
+ background: ${miscTheme.theme.colors.white} !important;
3179
+ border-radius: 8px;
3180
+ border: 1px solid ${miscTheme.theme.colors.neutral200} !important;
3181
+
3182
+ > div {
3183
+ padding: 3px 8px;
3184
+ }
3185
+
3186
+ span {
3187
+ flex: 1;
3188
+ color: ${miscTheme.theme.colors.gray600};
3189
+ font-size: 12px;
3190
+ font-weight: 600;
3191
+ line-height: 18px;
3192
+ }
3193
+
3194
+ ul {
3195
+ width: 130px;
3196
+ li {
3197
+ img {
3198
+ flex: 0 0 16px;
3199
+ width: 16px;
3200
+ }
3201
+ }
3202
+ }
3203
+ }
3204
+ `;
3205
+ const StyleSessionRow = styled__default["default"].div `
3206
+ display: inline-flex;
3207
+ gap: 8px;
3208
+ align-items: center;
3209
+ cursor: pointer;
3210
+
3211
+ .session-title {
3212
+ color: ${miscTheme.theme.colors.gray600};
3213
+ font-size: 14px;
3214
+ font-weight: 600;
3215
+ line-height: 22px;
3216
+ flex: 1;
3217
+ }
3218
+ `;
3219
+ const StyledIsQuestionWrapper = styled__default["default"].div `
3220
+ padding: 8px 8px;
3221
+ border: 1px solid ${miscTheme.theme.colors.gray200};
3222
+ border-top: none;
3223
+ border-radius: 0 0 8px 8px;
3224
+ &.has-error {
3225
+ border: 1px solid ${miscTheme.theme.colors.red600};
3226
+ }
3227
+ &.error-description {
3228
+ border: 1px solid ${miscTheme.theme.colors.red600};
3229
+ border-top: none;
3230
+ }
3231
+ `;
3232
+ const StyleActionFooter = styled__default["default"].div `
3233
+ display: flex;
3234
+ padding: 16px 24px 24px 24px;
3235
+ justify-content: space-between;
3236
+ align-items: center;
3237
+ box-shadow: 0px -2px 10px 0px rgba(0, 0, 0, 0.08);
3238
+ ${utils.MediaQueries.mbDown} {
3239
+ padding: 8px 16px 12px 16px;
3240
+ gap: 12px;
3241
+ flex-direction: column;
3242
+ justify-content: flex-start;
3243
+ align-items: flex-start;
3244
+ }
3245
+ .input-group {
3246
+ margin-bottom: 0 !important;
3247
+ }
3248
+ `;
3249
+
3250
+ const CreatePostPhotos = ({ imageFiles: imageFilesInit, setImageFiles, }) => {
3251
+ const imageRef = React.useRef(null);
3252
+ const { t } = index.useTranslations();
3253
+ const { onSelectImages } = index$3.useImagePicker(imageFilesInit, setImageFiles);
3254
+ const handleClick = () => {
3255
+ var _a;
3256
+ (_a = imageRef === null || imageRef === void 0 ? void 0 : imageRef.current) === null || _a === void 0 ? void 0 : _a.click();
3257
+ };
3258
+ return (React__default["default"].createElement("div", { className: "input-group" },
3259
+ React__default["default"].createElement(StyleSessionRow, { onClick: handleClick },
3260
+ React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconPhone, style: {
3261
+ width: '18px',
3262
+ height: '18px',
3263
+ objectFit: 'contain',
3264
+ marginLeft: 'auto',
3265
+ } }),
3266
+ React__default["default"].createElement("div", { className: "session-title" }, t('createPost.photos'))),
3267
+ React__default["default"].createElement("input", { ref: imageRef, type: "file", accept: "image/png, image/gif, image/jpeg", multiple: true, style: { display: 'none' }, onChange: (e) => onSelectImages(e) })));
3268
+ };
3269
+
3270
+ const TITLE_LIMIT = 120;
3271
+ const inputModify = (value, opts) => {
3272
+ if (!opts)
3273
+ return value;
3274
+ const { limit, bannedWords = [] } = opts;
3275
+ const shorten = typeof limit === 'number' && limit >= 0 ? value.substring(0, limit) : value;
3276
+ const processedValue = post.highlightBadWords(shorten, bannedWords);
3277
+ return processedValue;
3278
+ };
3279
+ const CreatePostTitle = ({ className, style, bannedWords = [], value, placeholder = '', error, onChange, }) => {
3280
+ const _theme = core.useMantineTheme();
3281
+ const { t } = index.useTranslations();
3282
+ const [titleValue, setTitleValue] = React.useState('');
3283
+ const titleRef = React.useRef(null);
3284
+ React.useEffect(() => {
3285
+ if (titleRef.current) {
3286
+ const pasteHandler = (e) => {
3287
+ var _a;
3288
+ e.preventDefault();
3289
+ const text = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/plain');
3290
+ document.execCommand('insertHTML', false, text);
3291
+ };
3292
+ const contentDiv = titleRef.current;
3293
+ contentDiv.addEventListener('paste', pasteHandler, {
3294
+ passive: true,
3295
+ });
3296
+ return () => contentDiv.removeEventListener('paste', pasteHandler);
3297
+ }
3298
+ }, [titleRef]);
3299
+ const bannedString = (bannedWords === null || bannedWords === void 0 ? void 0 : bannedWords.join(',')) || '';
3300
+ React.useEffect(() => {
3301
+ var _a;
3302
+ if (bannedString) {
3303
+ const titleText = (_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.innerText;
3304
+ if (titleText) {
3305
+ const titleValueWithBanned = post.highlightBadWords(titleText, bannedWords);
3306
+ if (titleValueWithBanned !== titleText) {
3307
+ onChange && onChange(titleValueWithBanned);
3308
+ setTitleValue(titleValueWithBanned);
3309
+ }
3310
+ }
3311
+ }
3312
+ }, [bannedString]);
3313
+ const debounceInputModify = React.useCallback(debounce__default["default"]((v) => {
3314
+ if (v) {
3315
+ const shortenString = inputModify(v, {
3316
+ limit: TITLE_LIMIT,
3317
+ bannedWords,
3318
+ });
3319
+ onChange && onChange(shortenString);
3320
+ setTitleValue(shortenString);
3321
+ }
3322
+ }, 300), []);
3323
+ return (React__default["default"].createElement(StyledCreatePostTitle, { className: className, style: style, color: _theme.colors[_theme.primaryColor][0], colorShadow: _theme.colors[_theme.primaryColor][2] },
3324
+ React__default["default"].createElement(StyleWrapperTitle, null,
3325
+ React__default["default"].createElement(index$2.Text, { size: "p4", className: "field-label" }, t('createPost.title')),
3326
+ React__default["default"].createElement(index$2.Text, { size: "p4", className: "count-string" },
3327
+ `${value === null || value === void 0 ? void 0 : value.length}/${TITLE_LIMIT}`,
3328
+ "\u00A0",
3329
+ t('character'))),
3330
+ React__default["default"].createElement(index$4.Input, { name: "title", value: value || titleValue, size: "md", label: "", placeholder: placeholder, onChange: (str) => {
3331
+ if (str !== (value || titleValue)) {
3332
+ const initialValue = inputModify(str, {
3333
+ bannedWords,
3334
+ });
3335
+ onChange && onChange(initialValue);
3336
+ setTitleValue(initialValue);
3337
+ debounceInputModify(str);
3338
+ }
3339
+ }, className: `${ErrorFieldKey.title} ${error && (error === null || error === void 0 ? void 0 : error.title) ? 'has-input-error' : ''}` }),
3340
+ error && (error === null || error === void 0 ? void 0 : error.title) && (React__default["default"].createElement(StyledError, { style: { margin: '4px 0 0' } },
3341
+ React__default["default"].createElement(index$2.Text, { size: "p5", as: "span", color: miscTheme.theme.colors.red600 }, error.title)))));
3342
+ };
3343
+
3344
+ const StyleReviewPhoto = styled__default["default"].div `
3345
+ .mantine-Text-root {
3346
+ margin-bottom: 4px;
3347
+ }
3348
+ .preview-images-container {
3349
+ display: flex;
3350
+ gap: 8px;
3351
+ overflow-x: auto;
3352
+ overflow-y: hidden;
3353
+ .image-src-wrapper {
3354
+ flex: 0 0 116px;
3355
+ width: 116px;
3356
+ height: 116px;
3357
+ border-radius: 4px;
3358
+ position: relative;
3359
+ img {
3360
+ border-radius: 4px;
3361
+ }
3362
+ .icon-close {
3363
+ position: absolute;
3364
+ top: 6px;
3365
+ right: 6px;
3366
+ cursor: pointer;
3367
+ z-index: 10;
3368
+ max-height: 24px;
3369
+ max-width: 24px;
3370
+ }
3371
+
3372
+ &.image-has-error {
3373
+ .preview-image {
3374
+ border: 1.5px solid ${miscTheme.theme.colors.red600};
3375
+ }
3376
+ }
3377
+ }
3378
+ }
3379
+ `;
3380
+
3381
+ const PostPhotosReview = ({ error, imageFiles: imageFilesInit, indexImageError = [], setIndexImageError, setImageFiles, removeKeyError, }) => {
3382
+ const { t } = index.useTranslations();
3383
+ const { imageSrcs, onRemoveImage } = index$3.useImagePicker(imageFilesInit, setImageFiles);
3384
+ return (React__default["default"].createElement(StyleReviewPhoto, { className: "input-group" },
3385
+ React__default["default"].createElement(index$2.Text, { size: "p5", weight: "semiBold" }, t('createPost.photos')),
3386
+ React__default["default"].createElement("div", { className: `${ErrorFieldKey.photos} preview-images-container` }, imageSrcs === null || imageSrcs === void 0 ? void 0 : imageSrcs.map((src, index) => {
3387
+ const imageError = indexImageError.includes(index);
3388
+ return (React__default["default"].createElement("div", { className: `image-src-wrapper ${imageError ? 'image-has-error' : ''}`, key: index },
3389
+ React__default["default"].createElement("img", { src: src, className: "preview-image", alt: "", style: {
3390
+ width: '100%',
3391
+ height: '100%',
3392
+ objectFit: 'cover',
3393
+ } }),
3394
+ React__default["default"].createElement("img", { alt: "", className: "icon-close", src: index$3.IconCloseCircle, onClick: () => {
3395
+ removeKeyError && removeKeyError('photos');
3396
+ onRemoveImage(index);
3397
+ const newIndexError = indexImageError.filter((item) => item !== index) || [];
3398
+ setIndexImageError(newIndexError);
3399
+ } })));
3400
+ })),
3401
+ error && (error === null || error === void 0 ? void 0 : error.photos) && (React__default["default"].createElement(StyledError, null,
3402
+ React__default["default"].createElement(index$2.Text, { size: "p5", color: miscTheme.theme.colors.red600 }, error.photos)))));
3403
+ };
3404
+
3405
+ var img = "data:image/svg+xml,%3csvg width='27' height='34' viewBox='0 0 27 34' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M26.6198 30.8276C26.1994 29.8612 25.6858 28.938 25.0862 28.0712C24.7039 27.4646 24.1752 26.9639 23.5487 26.6152L20.809 24.8984H6.56441L3.82386 26.6152C3.19735 26.9639 2.66863 27.4646 2.28637 28.0712C1.68686 28.938 1.1733 29.8612 0.752979 30.8276C0.66293 31.0085 0.641973 31.216 0.694039 31.4113C0.746105 31.6065 0.867615 31.776 1.03578 31.8881C3.0517 33.0766 8.44044 33.6133 13.6865 33.6133C18.9327 33.6133 24.3197 33.0766 26.3357 31.8881C26.5041 31.7762 26.6259 31.6068 26.6782 31.4116C26.7305 31.2163 26.7098 31.0087 26.6198 30.8276Z' fill='%23626D7C'/%3e%3cpath d='M10.0127 16.6728C11.3205 16.6728 12.3808 15.6125 12.3808 14.3046C12.3808 12.9968 11.3205 11.9365 10.0127 11.9365C8.70478 11.9365 7.64453 12.9968 7.64453 14.3046C7.64453 15.6125 8.70478 16.6728 10.0127 16.6728Z' fill='%23626D7C'/%3e%3cpath d='M17.3642 16.6728C18.6721 16.6728 19.7323 15.6125 19.7323 14.3046C19.7323 12.9968 18.6721 11.9365 17.3642 11.9365C16.0563 11.9365 14.9961 12.9968 14.9961 14.3046C14.9961 15.6125 16.0563 16.6728 17.3642 16.6728Z' fill='%23626D7C'/%3e%3cpath d='M21.9864 28.0466C22.082 29.5658 21.4126 32.585 21.0465 33.4184C20.347 33.5359 19.612 33.6342 18.8497 33.7162C19.2541 28.6723 18.254 25.817 17.3633 23.1885C19.6065 23.9945 20.3088 24.4426 20.8088 24.8989C21.6531 25.664 21.8006 26.2187 21.6094 26.5192C21.4181 26.828 20.5082 27.0438 20.5082 27.0438C21.6831 27.3225 21.9564 27.5958 21.9864 28.0466Z' fill='%2387909C'/%3e%3cpath d='M10.0121 23.1885C9.11859 25.817 8.11855 28.6723 8.52293 33.7162C7.76061 33.6342 7.02561 33.5359 6.32613 33.4184C5.95999 32.585 5.29057 29.5658 5.3862 28.0466C5.41625 27.5958 5.68949 27.3225 6.8644 27.0438C6.8644 27.0438 5.95726 26.828 5.76326 26.5219C5.56927 26.2159 5.72228 25.664 6.56384 24.8989C7.06659 24.4426 7.76881 23.9945 10.0121 23.1885Z' fill='%2387909C'/%3e%3cpath d='M3.82307 26.6153L6.56361 24.8994C5.72205 25.6645 5.57177 26.2191 5.76304 26.5224C5.9543 26.8257 6.86417 27.0443 6.86417 27.0443C5.68926 27.323 5.41603 27.5962 5.38597 28.0471C5.29034 29.5663 5.95977 32.5855 6.3259 33.4189C3.99248 33.0391 2.07164 32.4981 1.03608 31.8888C0.868115 31.7766 0.746669 31.6072 0.694385 31.4122C0.6421 31.2171 0.662547 31.0097 0.751911 30.8286C1.17295 29.8624 1.68628 28.9392 2.28476 28.0717C2.66772 27.4653 3.19662 26.9645 3.82307 26.6153Z' fill='%23626D7C'/%3e%3cpath d='M26.6201 30.8286C26.7101 31.0096 26.7309 31.2172 26.6786 31.4124C26.6262 31.6077 26.5044 31.7771 26.3359 31.8888C25.3031 32.4981 23.3822 33.0391 21.0461 33.4189C21.4122 32.5855 22.0816 29.5663 21.986 28.0471C21.956 27.5962 21.6827 27.323 20.5078 27.0443C20.5078 27.0443 21.4177 26.8285 21.6089 26.5197C21.8002 26.2191 21.6527 25.6645 20.8084 24.8994L23.5489 26.6153C24.1754 26.9645 24.7043 27.4653 25.0872 28.0717C25.6863 28.9388 26.1996 29.8621 26.6201 30.8286Z' fill='%23626D7C'/%3e%3cpath d='M17.3632 23.1885C18.254 25.817 19.254 28.6723 18.8496 33.7162C17.1356 33.9049 15.4126 33.9998 13.6882 34.0004C11.963 33.9997 10.239 33.9049 8.5241 33.7162C8.11971 28.6723 9.11975 25.817 10.0132 23.1885C10.2264 22.4453 10.5843 22.3497 10.8411 22.3797C11.4805 22.4562 12.1171 23.0136 13.6828 23.0136H13.691C15.2566 23.0136 15.896 22.4562 16.5326 22.3797C16.7895 22.3497 17.1501 22.4453 17.3632 23.1885Z' fill='%23D2D6DC'/%3e%3cpath d='M21.5965 8.49707H5.7789C3.77117 8.55172 2.41347 9.08289 2.59189 9.89057C2.8889 11.2362 7.55957 13.0035 13.6877 13.0035C19.8158 13.0035 24.4865 11.2362 24.7835 9.89057C24.9619 9.08289 23.6042 8.55117 21.5965 8.49707Z' fill='%2387909C'/%3e%3cpath d='M21.6065 8.49671C21.6725 8.82817 21.7208 9.1629 21.7513 9.49949C21.7513 10.2072 18.1009 11.2263 13.6882 11.2263C9.27542 11.2263 5.625 10.2072 5.625 9.49949C5.65547 9.1629 5.70381 8.82817 5.76981 8.49671C6.50755 4.6441 9.52133 -0.744085 12.8001 1.00735C13.0736 1.15268 13.3785 1.22867 13.6882 1.22867C13.9978 1.22867 14.3027 1.15268 14.5762 1.00735C17.855 -0.744085 20.8688 4.6441 21.6065 8.49671Z' fill='%23626D7C'/%3e%3c/svg%3e";
3406
+ var AvatarAnonymous = img;
3407
+
3408
+ const MAX_SIZE_FILE_UPLOAD = 10 * 1024 * 1024;
3409
+ const applySpecialCharSite = [
3410
+ Locale.LOCALE.PhilippinesEnglish,
3411
+ Locale.LOCALE.PhilippinesTagalog,
3412
+ Locale.LOCALE.Indonesia,
3413
+ Locale.LOCALE.Malaysia,
3414
+ Locale.LOCALE.Vietnam,
3415
+ ];
3416
+ const CreateNewPostContentV2 = ({ className, style, onClose, forceSelectCommunity, articleId, editPostData, defaultCommunity, defaultTopics, userInfo, isMarryBaby = false, }) => {
3417
+ const isInEditMode = !!(editPostData === null || editPostData === void 0 ? void 0 : editPostData.id);
3418
+ const { data: { locale, env: { togetherBasePath }, }, action: { pushNotifications, sanitizeFunction }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
3419
+ const { t } = index.useTranslations();
3420
+ const containerRef = React.useRef(null);
3421
+ const [isAskDoctor, setIsAskDoctor] = React.useState(false);
3422
+ const [specialCharErr, setspecialCharErr] = React.useState(false);
3423
+ const [titleValue, setTitleValue] = React.useState('');
3424
+ const [descriptionValue, setDescriptionValue] = React.useState('');
3425
+ const [communityValue, setCommunityValue] = React.useState({
3426
+ label: t('community.choose'),
3427
+ value: '',
3428
+ });
3429
+ const [selectedTopics, setSelectedTopics] = React.useState([]);
3430
+ const [error, setError] = React.useState({});
3431
+ const [imageFiles, setImageFiles] = React.useState([]);
3432
+ const [bannedWords, setBannedWords] = React.useState([]);
3433
+ const [indexImageError, setIndexImageError] = React.useState([]);
3434
+ const [postActionValue, setPostActionValue] = React.useState({
3435
+ label: t('cardPost.public'),
3436
+ value: 'public',
3437
+ });
3438
+ const [communitiesList, setCommunitiesList] = React.useState([]);
3439
+ const [topicsList, setTopicsList] = React.useState([]);
3440
+ const { imageSrcs = [] } = index$3.useImagePicker(imageFiles);
3441
+ const [previewUrl, setPreviewUrl] = React.useState(null);
3442
+ const [invalidUrls, setInvalidUrls] = React.useState([]);
3443
+ const [stepPost, setStepPost] = React.useState('step_info');
3444
+ const [isLoadingSuggest, setIsLoadingSuggest] = React.useState(false);
3445
+ const [uncategorizedId, setUncategorizedId] = React.useState('');
3446
+ const postActionType = [
3447
+ {
3448
+ label: t('cardPost.public'),
3449
+ value: 'public',
3450
+ icon: (React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconPublic, style: {
3451
+ width: '100%',
3452
+ height: '100%',
3453
+ objectFit: 'contain',
3454
+ marginLeft: 'auto',
3455
+ } })),
3456
+ },
3457
+ {
3458
+ label: t('cardPost.option.anonymous'),
3459
+ value: 'anonymous',
3460
+ icon: (React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconAnonymous, style: {
3461
+ width: '100%',
3462
+ height: '100%',
3463
+ objectFit: 'contain',
3464
+ marginLeft: 'auto',
3465
+ } })),
3466
+ },
3467
+ ];
3468
+ const currentCommunity = React.useMemo(() => {
3469
+ if (!communityValue.value)
3470
+ return null;
3471
+ const result = communitiesList.find((item) => String(item.id) === String(communityValue.value));
3472
+ if (!result)
3473
+ return null;
3474
+ return result;
3475
+ }, [communityValue, communitiesList]);
3476
+ // HANDLE etra action when OPEN AND CLOSE
3477
+ React.useEffect(() => {
3478
+ if (editPostData) {
3479
+ const post$1 = editPostData;
3480
+ setTitleValue(post$1.title || '');
3481
+ setDescriptionValue(post.decodeMention(post.decodePostUrl(post$1.description || '', 'edit'), post$1.mentions));
3482
+ setCommunityValue({
3483
+ label: post$1.community.name,
3484
+ value: `${post$1.community.id || ''}-${post$1.community.mappedCategoryId || ''}`,
3485
+ });
3486
+ setSelectedTopics(post$1.topics || []);
3487
+ setImageFiles(post$1.photos || []);
3488
+ setIsAskDoctor(!!post$1.isAskDoctor || false);
3489
+ }
3490
+ else {
3491
+ if (defaultCommunity) {
3492
+ setCommunityValue({
3493
+ label: defaultCommunity.name,
3494
+ value: `${defaultCommunity.id || ''}-${defaultCommunity.mappedCategoryId || ''}`,
3495
+ });
3496
+ }
3497
+ if (defaultTopics) {
3498
+ setSelectedTopics(defaultTopics);
3499
+ }
3500
+ }
3501
+ }, []);
3502
+ React.useEffect(() => {
3503
+ setspecialCharErr(applySpecialCharSite.includes(locale) &&
3504
+ titleValue !== '' &&
3505
+ !/[a-zA-Z]/.test(titleValue));
3506
+ setError({});
3507
+ }, [titleValue]);
3508
+ React.useEffect(() => {
3509
+ (() => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
3510
+ var _a, _b, _c;
3511
+ const [resListCommunity, resListTopic, resUncategorized] = yield Promise.all([
3512
+ togetherComponentGlobalContext.callApiWithAuth(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.COMMUNITY.LIST, {
3513
+ _locale: locale,
3514
+ pageSize: 100,
3515
+ }), 'GET'),
3516
+ togetherComponentGlobalContext.callApiWithAuth(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.TOPIC.LIST, {
3517
+ _locale: locale,
3518
+ pageSize: 100,
3519
+ }), 'GET'),
3520
+ togetherComponentGlobalContext.callApiWithAuth(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.COMMUNITY.GET_UNCATEGORIZED, {
3521
+ _locale: locale,
3522
+ }), 'GET'),
3523
+ ]);
3524
+ const communitiesApi = (_a = resListCommunity === null || resListCommunity === void 0 ? void 0 : resListCommunity.data) === null || _a === void 0 ? void 0 : _a.communities;
3525
+ if (Array.isArray(communitiesApi) && communitiesApi.length) {
3526
+ setCommunitiesList(communitiesApi);
3527
+ }
3528
+ const topicRes = (_b = resListTopic === null || resListTopic === void 0 ? void 0 : resListTopic.data) === null || _b === void 0 ? void 0 : _b.topics;
3529
+ if (Array.isArray(topicRes)) {
3530
+ setTopicsList(() => topicRes === null || topicRes === void 0 ? void 0 : topicRes.map(dataTransform.formatTopic));
3531
+ }
3532
+ const uncategorizedApi = (_c = resUncategorized === null || resUncategorized === void 0 ? void 0 : resUncategorized.data) === null || _c === void 0 ? void 0 : _c.communities;
3533
+ if (Array.isArray(uncategorizedApi) && uncategorizedApi.length) {
3534
+ setUncategorizedId(String(uncategorizedApi[0].id));
3535
+ }
3536
+ }))();
3537
+ }, []);
3538
+ const validationUploadPhoto = (files) => {
3539
+ const errorMessage = Object.assign({}, error);
3540
+ if (files && files.length > 10) {
3541
+ errorMessage.photos = t('createPost.message.photoMaxium');
3542
+ }
3543
+ if (files && files.length) {
3544
+ let inValidSizeFile = false;
3545
+ const indexInValid = [];
3546
+ files.forEach((file, index) => {
3547
+ if ((file === null || file === void 0 ? void 0 : file.size) > MAX_SIZE_FILE_UPLOAD) {
3548
+ inValidSizeFile = true;
3549
+ indexInValid.push(index);
3550
+ }
3551
+ });
3552
+ if (inValidSizeFile) {
3553
+ errorMessage.photos = t('createPost.message.photoSize');
3554
+ }
3555
+ setIndexImageError(indexInValid);
3556
+ }
3557
+ else {
3558
+ setIndexImageError([]);
3559
+ }
3560
+ setError(errorMessage);
3561
+ };
3562
+ const validationPost = () => {
3563
+ let hasError = false;
3564
+ const errorMessage = {};
3565
+ const description = innertext__default["default"](descriptionValue);
3566
+ if (!description) {
3567
+ errorMessage.description = t('createPost.message.requiredDescription');
3568
+ hasError = true;
3569
+ }
3570
+ if (!titleValue) {
3571
+ errorMessage.title = t('createPost.message.requiredTitle');
3572
+ hasError = true;
3573
+ }
3574
+ if (description && description.split(' ').length < 10) {
3575
+ errorMessage.description = t('createPost.message.lengthDescription', {
3576
+ currentLength: description.split(' ').length,
3577
+ });
3578
+ hasError = true;
3579
+ }
3580
+ if (titleValue && titleValue.length < 5) {
3581
+ errorMessage.title = t('createPost.message.lengthTitle.characters');
3582
+ hasError = true;
3583
+ }
3584
+ if (imageFiles && imageFiles.length > 10) {
3585
+ errorMessage.photos = t('createPost.message.photoMaxium');
3586
+ hasError = true;
3587
+ }
3588
+ if (imageFiles && imageFiles.length) {
3589
+ let inValidSizeFile = false;
3590
+ const indexInValid = [];
3591
+ imageFiles.forEach((file, index) => {
3592
+ if ((file === null || file === void 0 ? void 0 : file.size) > MAX_SIZE_FILE_UPLOAD) {
3593
+ inValidSizeFile = true;
3594
+ indexInValid.push(index);
3595
+ }
3596
+ });
3597
+ if (inValidSizeFile) {
3598
+ errorMessage.photos = t('createPost.message.photoSize');
3599
+ hasError = true;
3600
+ }
3601
+ setIndexImageError(indexInValid);
3602
+ }
3603
+ else {
3604
+ setIndexImageError([]);
3605
+ }
3606
+ if (invalidUrls && invalidUrls.length) {
3607
+ errorMessage.video = 'Invalid video url';
3608
+ hasError = true;
3609
+ }
3610
+ setError(errorMessage);
3611
+ return hasError;
3612
+ };
3613
+ const removeKeyError = (deleteKey) => {
3614
+ if (error[deleteKey]) {
3615
+ const _a = Object.assign({}, error), _b = `${deleteKey}`, value = _a[_b], rest = tslib_es6.__rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
3616
+ setError(rest);
3617
+ console.log(value);
3618
+ }
3619
+ };
3620
+ const submitPost = (uncategorized) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
3621
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
3622
+ const isError = validationPost();
3623
+ if (isError)
3624
+ return;
3625
+ const bodyFormData = yield index$3.getPostFormData({
3626
+ title: titleValue,
3627
+ description: descriptionValue,
3628
+ communityId: uncategorized
3629
+ ? uncategorizedId
3630
+ : String((currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.id) || ''),
3631
+ imageFiles,
3632
+ previewUrl,
3633
+ topicIds: uncategorized
3634
+ ? []
3635
+ : selectedTopics === null || selectedTopics === void 0 ? void 0 : selectedTopics.map((topic) => String(topic.id || '')).filter(Boolean),
3636
+ locale,
3637
+ sanitizeFunction,
3638
+ categoryCommunityId: String((currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.mappedCategoryId) || ''),
3639
+ categoryTopicIds: selectedTopics === null || selectedTopics === void 0 ? void 0 : selectedTopics.map((topic) => String((topic === null || topic === void 0 ? void 0 : topic.mappedCategoryId) || '')).filter(Boolean),
3640
+ isAnonymous: (postActionValue === null || postActionValue === void 0 ? void 0 : postActionValue.value) === 'anonymous' ? 1 : 0,
3641
+ isAskDoctor: isAskDoctor ? 1 : 0,
3642
+ introUrl: '',
3643
+ });
3644
+ if (articleId) {
3645
+ bodyFormData.append('article_id', articleId);
3646
+ }
3647
+ let res;
3648
+ if (isInEditMode) {
3649
+ if (editPostData === null || editPostData === void 0 ? void 0 : editPostData.id) {
3650
+ res = yield index$3.editPost({
3651
+ id: editPostData.id,
3652
+ formData: bodyFormData,
3653
+ locale,
3654
+ });
3655
+ }
3656
+ }
3657
+ else {
3658
+ res = yield index$3.createPost({
3659
+ formData: bodyFormData,
3660
+ locale,
3661
+ isArticleComment: !(currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.id) && !!(currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.mappedCategoryId),
3662
+ });
3663
+ }
3664
+ const resData = res === null || res === void 0 ? void 0 : res.data;
3665
+ if ((resData === null || resData === void 0 ? void 0 : resData.id) && !((_b = (_a = res === null || res === void 0 ? void 0 : res.messages) === null || _a === void 0 ? void 0 : _a.moderation) === null || _b === void 0 ? void 0 : _b.type)) {
3666
+ const params = `action=${editPostData ? 'editPost' : 'createPost'}&askDoctor=${(resData === null || resData === void 0 ? void 0 : resData.is_question) ? 'true' : 'false'}`;
3667
+ const postHref = `${togetherComponentGlobalContext.getCurrentBaseUrl(locale)}${togetherBasePath}/${(_c = resData === null || resData === void 0 ? void 0 : resData.community) === null || _c === void 0 ? void 0 : _c.slug}/${resData === null || resData === void 0 ? void 0 : resData.slug}/?${params}`;
3668
+ window.location.href = postHref;
3669
+ }
3670
+ else {
3671
+ if (((_e = (_d = res === null || res === void 0 ? void 0 : res.messages) === null || _d === void 0 ? void 0 : _d.moderation) === null || _e === void 0 ? void 0 : _e.type) === 'banned') {
3672
+ pushNotifications({
3673
+ title: t('notification.post.blocked.title'),
3674
+ message: t('notification.post.blocked.message'),
3675
+ type: 'danger',
3676
+ });
3677
+ if (res.messages.moderation.words) {
3678
+ setBannedWords(res.messages.moderation.words);
3679
+ }
3680
+ }
3681
+ else if (((_g = (_f = res === null || res === void 0 ? void 0 : res.messages) === null || _f === void 0 ? void 0 : _f.moderation) === null || _g === void 0 ? void 0 : _g.type) === 'suspect') {
3682
+ pushNotifications({
3683
+ title: t('notification.post.suspect.title'),
3684
+ message: t('notification.post.suspect.message'),
3685
+ type: 'warning',
3686
+ });
3687
+ onClose && onClose();
3688
+ }
3689
+ else if ((_j = (_h = res === null || res === void 0 ? void 0 : res.messages) === null || _h === void 0 ? void 0 : _h.find) === null || _j === void 0 ? void 0 : _j.call(_h, (m) => { var _a; return !!((_a = m === null || m === void 0 ? void 0 : m.includes) === null || _a === void 0 ? void 0 : _a.call(m, 'suspend')); })) {
3690
+ pushNotifications({
3691
+ message: t('notification.suspend.message'),
3692
+ type: 'danger',
3693
+ });
3694
+ onClose && onClose();
3695
+ }
3696
+ else {
3697
+ pushNotifications({
3698
+ message: ((_k = res === null || res === void 0 ? void 0 : res.messages) === null || _k === void 0 ? void 0 : _k[0]) || t('notification.failure'),
3699
+ type: 'danger',
3700
+ });
3701
+ }
3702
+ }
3703
+ });
3704
+ const getFirstOrderErroKey = (orderKey) => {
3705
+ const result = orderKey.find((key) => {
3706
+ if (error.hasOwnProperty(key) && error[key]) {
3707
+ return true;
3708
+ }
3709
+ return false;
3710
+ });
3711
+ if (!result)
3712
+ return '';
3713
+ return ErrorFieldKey[result];
3714
+ };
3715
+ const handleScrollToError = (selectorKey) => {
3716
+ if ((containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) && selectorKey) {
3717
+ const errorFieldElm = document.querySelector(`.${selectorKey}`);
3718
+ if (errorFieldElm && containerRef.current) {
3719
+ const elm = containerRef.current;
3720
+ if (elm) {
3721
+ elm.scrollTo({
3722
+ top: errorFieldElm.offsetTop - 40,
3723
+ behavior: 'smooth',
3724
+ });
3725
+ }
3726
+ }
3727
+ }
3728
+ };
3729
+ const onSubmitContinuePost = () => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
3730
+ var _l;
3731
+ const isError = validationPost();
3732
+ if (isError) {
3733
+ const keyElmToScroll = getFirstOrderErroKey(orderErrorFieldKey);
3734
+ handleScrollToError(keyElmToScroll);
3735
+ return;
3736
+ }
3737
+ setStepPost('step_community');
3738
+ // Current just apply ai suggest community for Vietnam site
3739
+ if (locale === Locale.LOCALE.Vietnam && !isMarryBaby && !isInEditMode) {
3740
+ try {
3741
+ setIsLoadingSuggest(true);
3742
+ const res = yield togetherComponentGlobalContext.callApiWithAuth(togetherComponentGlobalContext.getChatbotAiApiPath(togetherApiPaths.PATHS.CHATBOT.GET_SUGGEST_COMMUNITY), 'POST', {
3743
+ data: {
3744
+ title: titleValue,
3745
+ description: descriptionValue,
3746
+ },
3747
+ headers: {
3748
+ 'Content-Type': 'application/json',
3749
+ },
3750
+ });
3751
+ if (!res)
3752
+ throw new Error();
3753
+ if (res === null || res === void 0 ? void 0 : res.community) {
3754
+ // Check community is exist list communities
3755
+ const suggestResult = communitiesList.find((item) => String(item.id) === String(res === null || res === void 0 ? void 0 : res.community.id));
3756
+ if (suggestResult) {
3757
+ setCommunityValue({
3758
+ label: suggestResult.name,
3759
+ value: String(suggestResult.id),
3760
+ });
3761
+ if ((res === null || res === void 0 ? void 0 : res.topic) && (res === null || res === void 0 ? void 0 : res.topic.length)) {
3762
+ const listTopicId = res.topic.map((item) => item.id);
3763
+ const resTopic = yield togetherComponentGlobalContext.callApiWithAuth(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.TOPIC.LIST, {
3764
+ _locale: locale,
3765
+ topic_in: listTopicId.join(),
3766
+ pageSize: 100,
3767
+ }), 'GET');
3768
+ const topicsApi = (_l = resTopic === null || resTopic === void 0 ? void 0 : resTopic.data) === null || _l === void 0 ? void 0 : _l.topics;
3769
+ const topicSuggested = topicsApi
3770
+ ? topicsApi.map((item) => dataTransform.formatTopic(item))
3771
+ : [];
3772
+ setSelectedTopics(topicSuggested);
3773
+ }
3774
+ }
3775
+ }
3776
+ }
3777
+ catch (err) {
3778
+ console.log('err');
3779
+ }
3780
+ finally {
3781
+ setIsLoadingSuggest(false);
3782
+ }
3783
+ }
3784
+ });
3785
+ console.log('topicsList: ', topicsList);
3786
+ return (React__default["default"].createElement(StyledCreateNewPost, { className: `${className} create-post-popup-frame`, style: style },
3787
+ React__default["default"].createElement("div", { className: "input-group-container", ref: containerRef },
3788
+ React__default["default"].createElement(StyledFormGroupInner, null,
3789
+ React__default["default"].createElement("div", { className: "input-group" },
3790
+ React__default["default"].createElement(StylePostAction, null,
3791
+ React__default["default"].createElement("div", { className: `avatar ${postActionValue.value === 'anonymous'
3792
+ ? 'avatar-anonymous'
3793
+ : ''}` }, postActionValue.value === 'anonymous' ? (React__default["default"].createElement("img", { alt: "avatar-icon", src: AvatarAnonymous, style: {
3794
+ width: '100%',
3795
+ height: '100%',
3796
+ objectFit: 'contain',
3797
+ marginLeft: 'auto',
3798
+ } })) : (userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) ? (React__default["default"].createElement("img", { alt: "avatar-icon", src: userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar, style: {
3799
+ width: '100%',
3800
+ height: '100%',
3801
+ objectFit: 'contain',
3802
+ marginLeft: 'auto',
3803
+ } })) : (React__default["default"].createElement(togetherMoleculesCardAuthor.CardAuthor, { showDetailPopup: false, avatar: "", avatarProps: { size: 40 }, name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name, userId: userInfo === null || userInfo === void 0 ? void 0 : userInfo.userId, className: "author-avatar" }))),
3804
+ React__default["default"].createElement("div", { className: "post-action-form" },
3805
+ React__default["default"].createElement("div", { className: "post-action-by" }, (postActionValue === null || postActionValue === void 0 ? void 0 : postActionValue.value) === 'anonymous'
3806
+ ? t('cardPost.anonymous')
3807
+ : userInfo === null || userInfo === void 0 ? void 0 : userInfo.name),
3808
+ React__default["default"].createElement(index$8.Dropdown, { disabled: isInEditMode, options: postActionType, id: "post-action-type", size: "sm", className: "dropdown-post-action", placeholder: t('community.choose'), value: postActionValue, onChange: (option) => {
3809
+ setPostActionValue({
3810
+ label: option.label,
3811
+ value: String(option.value),
3812
+ });
3813
+ }, placeholderIcon: React__default["default"].createElement("div", { className: "post-action-result" }, postActionValue.value === 'public' ? (React__default["default"].createElement("img", { alt: "public-icon", src: IconPublic, style: {
3814
+ width: '100%',
3815
+ height: '100%',
3816
+ objectFit: 'contain',
3817
+ marginLeft: 'auto',
3818
+ } })) : (React__default["default"].createElement("img", { alt: "anonymous-icon", src: IconAnonymous, style: {
3819
+ width: '100%',
3820
+ height: '100%',
3821
+ objectFit: 'contain',
3822
+ marginLeft: 'auto',
3823
+ } }))), style: {
3824
+ zIndex: 10,
3825
+ width: 'calc(100% + 20px)',
3826
+ } })))),
3827
+ React__default["default"].createElement(CreatePostTitle, { className: "input-group", bannedWords: bannedWords, value: titleValue, error: error, placeholder: isAskDoctor
3828
+ ? t('createPost.post.askDoctor.title')
3829
+ : t('createPost.post.title'), onChange: setTitleValue }),
3830
+ specialCharErr && (React__default["default"].createElement(StyledError, null,
3831
+ React__default["default"].createElement(other.Info, { isSolid: true, color: miscTheme.theme.colors.red700, size: 14 }),
3832
+ React__default["default"].createElement(index$2.Text, { size: "p3", as: "span", color: miscTheme.theme.colors.red700 }, t('createPost.popup.specialCharErr')))),
3833
+ React__default["default"].createElement("div", { className: "input-group" },
3834
+ React__default["default"].createElement(CreatePostDescription, { bannedWords: bannedWords, value: descriptionValue, placeholder: isAskDoctor
3835
+ ? t('createPost.post.askDoctor.description')
3836
+ : t('createPost.post.description'), onChange: (v) => {
3837
+ setDescriptionValue(v);
3838
+ removeKeyError('description');
3839
+ }, onPreviewUrlChange: setPreviewUrl, onInvalidUrlsChange: setInvalidUrls, onImageFilesChange: setImageFiles, imageFiles: imageFiles, className: `${error && (error === null || error === void 0 ? void 0 : error.description) ? 'error-description' : ''}`, footerEditor: React__default["default"].createElement(React__default["default"].Fragment, null,
3840
+ React__default["default"].createElement(StyledIsQuestionWrapper, { className: `${error && (error === null || error === void 0 ? void 0 : error.description) ? 'error-description' : ''}` },
3841
+ React__default["default"].createElement(StyledIsQuestion, { color: miscTheme.theme.colors.primaryBase },
3842
+ React__default["default"].createElement("div", { className: "switch-label" },
3843
+ React__default["default"].createElement(other.Ask, { isMarryBaby: isMarryBaby, size: isMarryBaby ? 32 : 24, color: miscTheme.theme.colors.primaryBase, className: "label-icon" }),
3844
+ React__default["default"].createElement("div", { className: "wrapper-text" },
3845
+ React__default["default"].createElement("div", { className: "label-txt" }, t('createPost.askDoctor.description')))),
3846
+ React__default["default"].createElement(core.Switch, { checked: isAskDoctor, label: "", className: "switch-btn", size: "md", onChange: (v) => {
3847
+ setIsAskDoctor(v.target.checked);
3848
+ } }))),
3849
+ error && (error === null || error === void 0 ? void 0 : error.description) && (React__default["default"].createElement(StyledError, { style: { margin: '4px 0 0' } },
3850
+ React__default["default"].createElement(index$2.Text, { size: "p5", as: "span", color: miscTheme.theme.colors.red600 }, error.description)))) })),
3851
+ stepPost === 'step_community' && (React__default["default"].createElement(CreatePostCommunity, { communitiesList: communitiesList, currentCommunity: currentCommunity, selectedTopics: selectedTopics, communityValue: communityValue, defaultCommunity: forceSelectCommunity, error: error, isFullscreen: false, isMarryBaby: isMarryBaby, isInEditMode: isInEditMode, isLoadingSuggest: isLoadingSuggest, setSelectedTopics: setSelectedTopics, setCommunityValue: setCommunityValue, removeKeyError: removeKeyError, setStepPost: setStepPost, onSubmitPost: submitPost })),
3852
+ imageSrcs.length > 0 && (React__default["default"].createElement(PostPhotosReview, { imageFiles: imageFiles, error: error, indexImageError: indexImageError, setIndexImageError: setIndexImageError, setImageFiles: setImageFiles, removeKeyError: removeKeyError })))),
3853
+ React__default["default"].createElement(StyleActionFooter, null,
3854
+ React__default["default"].createElement(CreatePostPhotos, { imageFiles: imageFiles, setImageFiles: (data) => {
3855
+ setImageFiles(data);
3856
+ validationUploadPhoto(data);
3857
+ } }),
3858
+ React__default["default"].createElement("div", null,
3859
+ React__default["default"].createElement(index$1.Button, { className: "submit-btn pointer-event-child-none", size: "lg", "data-event-category": "Ask Doctor", "data-event-action": "Submit Question", "data-event-label": window.location.href, onClick: onSubmitContinuePost, loading: isLoadingSuggest, disabled: isLoadingSuggest }, t('onboarding.button.continue'))))));
3860
+ };
3861
+
3862
+ const StyledTopicSelectList = styled__default["default"].div `
3863
+ display: flex;
3864
+ width: 100%;
3865
+ flex-wrap: wrap;
3866
+ margin-top: 1rem;
3867
+
3868
+ .tag-item {
3869
+ min-height: 32px;
3870
+ padding: 5px 12px;
3871
+ border: 1px solid ${miscTheme.theme.colors.neutral100};
3872
+ margin-right: 1rem;
3873
+ margin-bottom: 8px;
3874
+ border-radius: 1rem;
3875
+ color: ${miscTheme.theme.colors.gray800};
3876
+ cursor: pointer;
3877
+ font-size: 13px;
3878
+ line-height: 22px;
3879
+ transition: all 0.2s;
3880
+
3881
+ &.--active {
3882
+ border-color: ${miscTheme.theme.colors.primary50};
3883
+ background: ${miscTheme.theme.colors.primary50};
3884
+ color: ${miscTheme.theme.colors.primaryBase};
3885
+ }
3886
+ &[data-disabled='true'] {
3887
+ background: ${miscTheme.theme.colors.gray100};
3888
+ color: ${miscTheme.theme.colors.gray800};
3889
+ }
3890
+ }
3891
+ .topic-spinner {
3892
+ margin-right: auto;
3893
+ margin-left: auto;
3894
+ & > button {
3895
+ width: 24px;
3896
+ height: 24px;
3897
+ }
3898
+ }
3899
+ &[data-is-marrybaby='true'] {
3900
+ .tag-item {
3901
+ border-color: transparent;
3902
+ background: #f3f3f3;
3903
+ color: #3e3f58;
3904
+ &.--active {
3905
+ border-color: #b6cdff;
3906
+ background: #e0e9fb;
3907
+ color: #3e3f58;
3908
+ }
3909
+ }
3910
+ }
3911
+ `;
3912
+
3913
+ const TopicSelectList = ({ className, style, topics: topicsProp, communityId, onChange, isLoading, disabled, forceTopics, selectedTopics: selectedTopicsProp, noFetch, dataEventCategory, dataEventAction, dataEventLabel, }) => {
3914
+ const { data: { locale, env: { isMarryBaby }, }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
3915
+ const [topics, setTopics] = React.useState(topicsProp ? [...topicsProp] : []);
3916
+ const [selectedTopics, setSelectedTopics] = React.useState(selectedTopicsProp ? [...selectedTopicsProp] : []);
3917
+ const [isLoadingTopics, setIsLoadingTopics] = React.useState(false);
3918
+ const topicsPropRef = React.useRef(topicsProp);
3919
+ topicsPropRef.current = topicsProp;
3920
+ React.useEffect(() => {
3921
+ var _a;
3922
+ if (communityId && !noFetch && !((_a = topicsPropRef.current) === null || _a === void 0 ? void 0 : _a.length)) {
3923
+ setTopics([]);
3924
+ setIsLoadingTopics(true);
3925
+ (() => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
3926
+ var _b;
3927
+ try {
3928
+ const res = yield togetherComponentGlobalContext.callApi(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.TOPIC.LIST, {
3929
+ communityId: communityId,
3930
+ _locale: locale,
3931
+ }), 'GET');
3932
+ const topicRes = (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.topics;
3933
+ if (Array.isArray(topicRes)) {
3934
+ setTopics(() => (topicRes === null || topicRes === void 0 ? void 0 : topicRes.map(dataTransform.formatTopic).sort((t1, t2) => (t1.order || 0) - (t2.order || 0))) || []);
3935
+ }
3936
+ }
3937
+ catch (e) {
3938
+ console.log(e);
3939
+ setIsLoadingTopics(false);
3940
+ }
3941
+ setIsLoadingTopics(false);
3942
+ }))();
3943
+ }
3944
+ }, [communityId, noFetch]);
3945
+ const topicsPropString = topicsProp === null || topicsProp === void 0 ? void 0 : topicsProp.map((t) => t.id).join('-');
3946
+ const topicsStateString = topics === null || topics === void 0 ? void 0 : topics.map((t) => t.id).join('-');
3947
+ const forceTopicsPropString = forceTopics === null || forceTopics === void 0 ? void 0 : forceTopics.map((t) => t.id).join('-');
3948
+ React.useEffect(() => {
3949
+ if (topicsProp &&
3950
+ typeof topicsPropString !== 'undefined' &&
3951
+ topicsPropString !== topicsStateString) {
3952
+ setTopics(topicsProp);
3953
+ }
3954
+ }, [topicsProp, topicsPropString, topicsStateString]);
3955
+ const topicsWithoutForced = React.useMemo(() => topics.filter((t) => !(forceTopics === null || forceTopics === void 0 ? void 0 : forceTopics.some((ft) => (ft.id && ft.id === t.id) ||
3956
+ (ft.mappedCategoryId &&
3957
+ ft.mappedCategoryId === t.mappedCategoryId)))), [topicsStateString, forceTopicsPropString]);
3958
+ return (React__default["default"].createElement(StyledTopicSelectList, { "data-is-marrybaby": isMarryBaby, className: className, style: style },
3959
+ forceTopics.map((topic) => (React__default["default"].createElement(TopicItem, { key: `${topic.id}-${topic.mappedCategoryId}`, topic: topic, disabled: true, selected: true, dataEventAction: dataEventAction, dataEventCategory: dataEventCategory, dataEventLabel: dataEventLabel }))),
3960
+ topicsWithoutForced.map((topic) => (React__default["default"].createElement(TopicItem, { key: `${topic.id}-${topic.mappedCategoryId}`, topic: topic, disabled: disabled, selected: (selectedTopicsProp || selectedTopics).some((t) => (t.id && t.id === topic.id) ||
3961
+ (t.mappedCategoryId &&
3962
+ t.mappedCategoryId === topic.mappedCategoryId)), onClick: () => {
3963
+ const _selected = selectedTopicsProp || selectedTopics;
3964
+ const foundIndex = _selected.findIndex((_selected) => (_selected.id && _selected.id === topic.id) ||
3965
+ (_selected.mappedCategoryId &&
3966
+ _selected.mappedCategoryId === topic.mappedCategoryId));
3967
+ if (foundIndex !== -1) {
3968
+ _selected.splice(foundIndex, 1);
3969
+ }
3970
+ else {
3971
+ _selected.push(topic);
3972
+ }
3973
+ if (onChange && selectedTopicsProp) {
3974
+ onChange(_selected.slice());
3975
+ }
3976
+ else {
3977
+ onChange && onChange(_selected.slice());
3978
+ setSelectedTopics(_selected.slice());
3979
+ }
3980
+ }, dataEventAction: dataEventAction, dataEventCategory: dataEventCategory, dataEventLabel: dataEventLabel }))),
3981
+ (isLoading || isLoadingTopics) && React__default["default"].createElement(togetherMoleculesCardAuthor.Loading, { className: "topic-spinner" })));
3982
+ };
3983
+ const TopicItem = (_a) => {
3984
+ var { topic, disabled, selected, onClick } = _a, rest = tslib_es6.__rest(_a, ["topic", "disabled", "selected", "onClick"]);
3985
+ return (React__default["default"].createElement("div", Object.assign({ className: 'tag-item' + (selected ? ' --active' : ''), "data-disabled": disabled, onClick: !disabled ? onClick : undefined }, rest), topic.name));
3986
+ };
3987
+
3988
+ var styles = {"skipBtn":"KsWg8i6","alertHeading":"_9tS0EUN","alertDesc":"kyyRKlb","alertAction":"-Uqqka-"};
3989
+
3990
+ const SkipQuestionOfExpertBtn = (_a) => {
3991
+ var { post, onSkip, btnText, currentPageUrl } = _a, rest = tslib_es6.__rest(_a, ["post", "onSkip", "btnText", "currentPageUrl"]);
3992
+ const { t } = index.useTranslations();
3993
+ const { data: { locale }, action: { pushNotifications }, } = React.useContext(togetherComponentGlobalContext.TogetherComponentGlobalContext);
3994
+ const [showAlert, setShowAlert] = React.useState(false);
3995
+ const [loading, setLoading] = React.useState(false);
3996
+ const _theme = core.useMantineTheme();
3997
+ const handleSkip = React.useCallback(() => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
3998
+ var _b;
3999
+ setLoading(true);
4000
+ const res = yield togetherComponentGlobalContext.callApiWithAuth(togetherComponentGlobalContext.getApiPath(togetherApiPaths.PATHS.USER.SKIP_QUESTION, {
4001
+ _locale: locale,
4002
+ id: post === null || post === void 0 ? void 0 : post.id,
4003
+ }), 'PUT');
4004
+ if ((res === null || res === void 0 ? void 0 : res.status) === 1) {
4005
+ onSkip === null || onSkip === void 0 ? void 0 : onSkip({ id: (post === null || post === void 0 ? void 0 : post.id) || '', communityId: ((_b = post === null || post === void 0 ? void 0 : post.community) === null || _b === void 0 ? void 0 : _b.id) || '' });
4006
+ setShowAlert(false);
4007
+ pushNotifications({
4008
+ title: '',
4009
+ message: 'Skip success',
4010
+ type: 'success',
4011
+ });
4012
+ }
4013
+ else {
4014
+ pushNotifications({
4015
+ title: '',
4016
+ message: res === null || res === void 0 ? void 0 : res.messages,
4017
+ type: 'danger',
4018
+ });
4019
+ }
4020
+ setLoading(false);
4021
+ }), []);
4022
+ return (React__default["default"].createElement(core.Popover, { width: 327, withArrow: true, shadow: "md", opened: showAlert },
4023
+ React__default["default"].createElement(core.Popover.Target, null,
4024
+ React__default["default"].createElement("div", Object.assign({ className: `${styles.skipBtn} ${(rest === null || rest === void 0 ? void 0 : rest.className) || ''}`, onClick: () => setShowAlert(true) }, rest), btnText || t('profilePanel.questionNotClear'))),
4025
+ React__default["default"].createElement(core.Popover.Dropdown, null,
4026
+ React__default["default"].createElement("div", null,
4027
+ React__default["default"].createElement("div", { className: styles.alertHeading }, t('profilePanel.skipQuestion.heading')),
4028
+ React__default["default"].createElement("div", { className: styles.alertDesc }, t('profilePanel.skipQuestion.content')),
4029
+ React__default["default"].createElement("div", { className: styles.alertAction },
4030
+ React__default["default"].createElement(index$1.Button, { size: "md", variant: "secondary", leftIcon: React__default["default"].createElement(core$1.Close, { color: _theme.fn.primaryColor(), size: 24 }), onClick: () => setShowAlert(false), styles: () => ({
4031
+ leftIcon: {
4032
+ marginRight: 0,
4033
+ },
4034
+ }) }),
4035
+ React__default["default"].createElement(index$1.Button, { variant: "primary", size: "md", leftIcon: React__default["default"].createElement(core$1.Check, { color: 'white', size: 24 }), onClick: handleSkip, loading: loading, "data-event-category": "Together", "data-event-action": "Unclear Question Click", "data-event-label": currentPageUrl, styles: () => ({
4036
+ leftIcon: {
4037
+ marginRight: 0,
4038
+ },
4039
+ }) }))))));
4040
+ };
4041
+
4042
+ exports.CreateNewPostContent = CreateNewPostContent;
4043
+ exports.CreateNewPostContentV2 = CreateNewPostContentV2;
4044
+ exports.CreatePostDescription = CreatePostDescription$1;
4045
+ exports.CreatePostTitle = CreatePostTitle$1;
4046
+ exports.SkipQuestionOfExpertBtn = SkipQuestionOfExpertBtn;
4047
+ exports.TopicSelectList = TopicSelectList;