@hhgtech/hhg-components 1.29.80 → 1.29.82

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 (370) hide show
  1. package/build/{index-1250dd06.js → WhatsApp-46f4f408.js} +24 -276
  2. package/build/adapters.js +17 -16
  3. package/build/atoms.js +102 -0
  4. package/build/babyGrowth.js +162 -164
  5. package/build/cache.js +3 -3
  6. package/build/care.js +17 -17
  7. package/build/components.js +181 -163
  8. package/build/{constants-ca71f9e5.js → constants-223c01fc.js} +2 -2
  9. package/build/{constants-4e7c419e.js → constants-8743b014.js} +0 -136
  10. package/build/constants-a78fa8b3.js +318 -0
  11. package/build/constants-f182fc32.js +425 -0
  12. package/build/constants.js +3 -3
  13. package/build/{core-bb2587e7.js → core-9d69a722.js} +2 -2
  14. package/build/{dataTransform-469b75eb.js → dataTransform-ded2692d.js} +1 -1
  15. package/build/{index-5d9ad07e.js → dataTransform-e39297c1.js} +3 -52
  16. package/build/defaultClassWrapper-b7719693.js +21 -0
  17. package/build/ecom.js +5 -5
  18. package/build/esm/WhatsApp-c599b715.js +46 -0
  19. package/build/esm/adapters.js +17 -16
  20. package/build/esm/atoms.js +59 -0
  21. package/build/esm/babyGrowth.js +87 -89
  22. package/build/esm/cache.js +3 -3
  23. package/build/esm/care.js +17 -17
  24. package/build/esm/components.js +91 -73
  25. package/build/esm/constants-a5827634.js +307 -0
  26. package/build/esm/{constants-7661ce64.js → constants-bb470362.js} +2 -2
  27. package/build/esm/{constants-508ba335.js → constants-f6b2e49d.js} +1 -127
  28. package/build/esm/constants-fa475b0f.js +417 -0
  29. package/build/esm/constants.js +3 -3
  30. package/build/esm/{core-5a22b83e.js → core-80bfe8b7.js} +2 -2
  31. package/build/esm/{dataTransform-f5db5afb.js → dataTransform-55f67eed.js} +1 -1
  32. package/build/esm/{index-9b54376f.js → dataTransform-623716c3.js} +5 -53
  33. package/build/esm/defaultClassWrapper-00903c00.js +15 -0
  34. package/build/esm/ecom.js +5 -5
  35. package/build/esm/fixedBottomAdBlock-60a5d48f.js +3474 -0
  36. package/build/esm/footer.js +18 -18
  37. package/build/esm/gAssets.js +4 -4
  38. package/build/esm/{getDynamicHealthTool-09fda8b3.js → getDynamicHealthTool-82855adc.js} +4 -4
  39. package/build/esm/{getSocialList-96301dbb.js → getSocialList-7d2cf48d.js} +5 -6
  40. package/build/esm/healthToolsForm.js +40 -0
  41. package/build/esm/healthToolsForms.d.ts +7 -0
  42. package/build/esm/hooks.js +17 -17
  43. package/build/esm/i18n.js +2 -2
  44. package/build/esm/i18nV2.js +2 -2
  45. package/build/esm/{index-da2b8f22.js → index-01405723.js} +12 -11
  46. package/build/esm/index-01b5d2e9.js +202 -0
  47. package/build/esm/index-02d3f05b.js +1681 -0
  48. package/build/esm/{index-82861dba.js → index-046778af.js} +2 -2
  49. package/build/esm/{index-df29c4e0.js → index-049e0270.js} +33 -5
  50. package/build/esm/index-07f3f47e.js +14 -0
  51. package/build/esm/index-0b745f46.js +1349 -0
  52. package/build/esm/{index-e68d4285.js → index-0ca9b175.js} +2 -2
  53. package/build/esm/{index-c4699d44.js → index-0cd3523c.js} +35 -176
  54. package/build/esm/index-0ee66974.js +95 -0
  55. package/build/esm/index-10ab6596.js +489 -0
  56. package/build/esm/{index-5773eb18.js → index-13d8dd4b.js} +6 -6
  57. package/build/esm/{index.styled-9e147e72.js → index-1c9b481b.js} +21 -3
  58. package/build/esm/index-1d3c6ce7.js +195 -0
  59. package/build/esm/{index-474e0ae5.js → index-21256394.js} +2 -13
  60. package/build/esm/{index-2d47a346.js → index-219e3a35.js} +11 -10
  61. package/build/esm/{index-679d5383.js → index-29908d2c.js} +1 -1
  62. package/build/esm/{utils-ff5d88a2.js → index-2dc7803d.js} +71 -105
  63. package/build/esm/{index-4dcdce19.js → index-5723381f.js} +2 -2
  64. package/build/esm/{index-c807ef87.js → index-6210f454.js} +3 -3
  65. package/build/esm/index-7a1ea734.js +100 -0
  66. package/build/esm/{index-53a86337.js → index-7c384ae6.js} +5 -5
  67. package/build/esm/index-8eb04f36.js +130 -0
  68. package/build/esm/index-8fcf671c.js +335 -0
  69. package/build/esm/{index-80f4d7df.js → index-9471fca1.js} +2 -2
  70. package/build/esm/{index-92eedeb0.js → index-9b3a8b6d.js} +12 -201
  71. package/build/esm/{index-3c7f109c.js → index-9b9c1499.js} +2 -2
  72. package/build/esm/index-9f99909b.js +54 -0
  73. package/build/esm/index-ac2a8f95.js +1114 -0
  74. package/build/esm/index-acf8b60e.js +42 -0
  75. package/build/esm/index-ad1c7c38.js +275 -0
  76. package/build/esm/{index-bcd13f1d.js → index-bcedec73.js} +13 -12
  77. package/build/esm/{index-ef855343.js → index-c013ba1b.js} +4 -4
  78. package/build/esm/index-c2584051.js +262 -0
  79. package/build/esm/{types-957334f2.js → index-c430773c.js} +559 -3519
  80. package/build/esm/index-cdc50618.js +25 -0
  81. package/build/esm/{index-77dddeb9.js → index-cfedca38.js} +2 -2
  82. package/build/esm/index-d6a5f5cf.js +557 -0
  83. package/build/esm/index-e0b0d6a2.js +847 -0
  84. package/build/esm/index-ea63e0d2.js +148 -0
  85. package/build/esm/{index-32e2b169.js → index-f22f6e6e.js} +65 -28
  86. package/build/esm/index-f4b938f2.js +18 -0
  87. package/build/esm/index-f660abb7.js +156 -0
  88. package/build/esm/index-fa67d66e.js +789 -0
  89. package/build/esm/index.js +98 -73
  90. package/build/esm/labelSorting-7351409a.js +47 -0
  91. package/build/esm/lead.js +23 -33
  92. package/build/esm/logoIcon-3a581efb.js +104 -0
  93. package/build/esm/mantine.js +22 -20
  94. package/build/esm/misc.js +21 -21
  95. package/build/esm/molecules.js +88 -0
  96. package/build/esm/navigation.js +37 -37
  97. package/build/esm/onboardingV2.js +26 -35
  98. package/build/esm/organisms.js +57 -0
  99. package/build/esm/pwg.js +19 -19
  100. package/build/esm/{routing-7bc3e320.js → routing-9e330438.js} +2 -2
  101. package/build/esm/subot.js +31 -27
  102. package/build/esm/surveyOrPremiumBanner.js +45 -0
  103. package/build/esm/surveyQuestionCard.js +13 -0
  104. package/build/esm/surveyThankyouCard-ec204631.js +446 -0
  105. package/build/esm/together.js +52 -45
  106. package/build/esm/togetherAtoms.js +41 -0
  107. package/build/esm/togetherComponentGlobalContext.js +12 -0
  108. package/build/esm/togetherMolecules.js +53 -0
  109. package/build/esm/togetherOrganisms.js +57 -0
  110. package/build/esm/treePopoverMenu-cb214db6.js +332 -0
  111. package/build/esm/types-721e7a66.js +5 -0
  112. package/build/esm/{types-ee1be1e3.js → types-ffcf5fb4.js} +13 -13
  113. package/build/esm/types.js +1 -1
  114. package/build/esm/{useCategory-7e020652.js → useCategory-553bee0b.js} +5 -5
  115. package/build/esm/{useHealthToolCache-c70e4fd5.js → useHealthToolCache-6ce1724e.js} +2 -2
  116. package/build/esm/{useMantineLocale-1373e175.js → useMantineLocale-453f8013.js} +3 -3
  117. package/build/esm/{usePlacesAutocomplete-4bfe976e.js → usePlacesAutocomplete-8925d4fb.js} +1 -1
  118. package/build/esm/useTogetherAuthRequiredAction.js +60 -0
  119. package/build/esm/{useTranslations-adad3b06.js → useTranslations-b970f667.js} +1 -1
  120. package/build/esm/{utils-dee27bfd.js → utils-3b29eb79.js} +8 -356
  121. package/build/esm/{utils-b14c10f9.js → utils-6d45bdd1.js} +1 -1
  122. package/build/esm/vaccination.js +18 -29
  123. package/build/fixedBottomAdBlock-0129a006.js +3521 -0
  124. package/build/footer.js +18 -18
  125. package/build/gAssets.js +4 -4
  126. package/build/{getDynamicHealthTool-357666f7.js → getDynamicHealthTool-f08b5fab.js} +4 -4
  127. package/build/{getSocialList-c1404aff.js → getSocialList-8cc32f7c.js} +8 -9
  128. package/build/healthToolsForm.js +54 -0
  129. package/build/healthToolsForms.d.ts +7 -0
  130. package/build/hooks.js +17 -17
  131. package/build/i18n.js +1 -1
  132. package/build/i18nV2.js +1 -1
  133. package/build/index-00a78d81.js +565 -0
  134. package/build/index-077bf48f.js +803 -0
  135. package/build/{index-bf6e5e4e.js → index-0b727664.js} +5 -5
  136. package/build/{index-917c975c.js → index-10760994.js} +37 -9
  137. package/build/index-130e0f35.js +1693 -0
  138. package/build/{index-82a3ba38.js → index-16ed0d98.js} +68 -33
  139. package/build/{index-040620f6.js → index-1e1d8eb1.js} +13 -12
  140. package/build/{index-e60c98f8.js → index-1fdf2f01.js} +2 -2
  141. package/build/{index-61ef343d.js → index-206afefb.js} +4 -4
  142. package/build/{types-c8956642.js → index-2afbeb3d.js} +761 -3727
  143. package/build/{index.styled-8aca5145.js → index-2fd9063e.js} +22 -4
  144. package/build/index-33432b02.js +270 -0
  145. package/build/index-3eb666e6.js +202 -0
  146. package/build/{index-94a2b0f9.js → index-405faafa.js} +2 -2
  147. package/build/index-4357a324.js +136 -0
  148. package/build/index-466a2c32.js +1362 -0
  149. package/build/index-4b7d4b5b.js +156 -0
  150. package/build/{index-5029b5d8.js → index-4bc690c9.js} +1 -1
  151. package/build/index-4cdcdbbe.js +498 -0
  152. package/build/index-53e14542.js +102 -0
  153. package/build/{index-91027d35.js → index-54aeefca.js} +2 -2
  154. package/build/index-60f6d762.js +1127 -0
  155. package/build/{index-858f60e0.js → index-64d8db08.js} +2 -2
  156. package/build/index-6aeb5ff5.js +866 -0
  157. package/build/index-71843eb4.js +61 -0
  158. package/build/index-765ed75d.js +209 -0
  159. package/build/index-7953fb8e.js +167 -0
  160. package/build/{index-d710511f.js → index-7ecc69af.js} +12 -11
  161. package/build/index-82c85f9d.js +277 -0
  162. package/build/index-9e8877c0.js +25 -0
  163. package/build/index-a2664204.js +107 -0
  164. package/build/{index-c67602d7.js → index-a6a9855f.js} +1 -13
  165. package/build/index-a8680a58.js +49 -0
  166. package/build/{index-ed587907.js → index-a9bbb5aa.js} +11 -10
  167. package/build/{utils-263a60f7.js → index-a9bdf889.js} +76 -120
  168. package/build/{index-f0a532c7.js → index-b66ae554.js} +6 -6
  169. package/build/index-ca616373.js +20 -0
  170. package/build/{index-b0414701.js → index-d9919cd2.js} +57 -200
  171. package/build/index-dd074159.js +32 -0
  172. package/build/{index-94fd9ea6.js → index-dff7ee1b.js} +32 -222
  173. package/build/{index-3a03bb34.js → index-e3bbd009.js} +2 -2
  174. package/build/index-ec34e358.js +343 -0
  175. package/build/{index-8c826f3e.js → index-f222ee45.js} +2 -2
  176. package/build/{index-2b32b21e.js → index-fd3e1d16.js} +2 -2
  177. package/build/index.js +251 -226
  178. package/build/labelSorting-f86081b7.js +53 -0
  179. package/build/lead.js +29 -39
  180. package/build/logoIcon-21a16853.js +110 -0
  181. package/build/mantine.js +24 -23
  182. package/build/misc.js +21 -21
  183. package/build/molecules.js +149 -0
  184. package/build/navigation.js +37 -37
  185. package/build/onboardingV2.js +45 -54
  186. package/build/organisms.js +74 -0
  187. package/build/pwg.js +19 -19
  188. package/build/{routing-bc8197d8.js → routing-d6c9099a.js} +2 -2
  189. package/build/subot.js +115 -111
  190. package/build/surveyOrPremiumBanner.js +53 -0
  191. package/build/surveyQuestionCard.js +22 -0
  192. package/build/surveyThankyouCard-5b23b8f6.js +454 -0
  193. package/build/together.js +100 -93
  194. package/build/togetherAtoms.js +55 -0
  195. package/build/togetherComponentGlobalContext.js +26 -0
  196. package/build/togetherMolecules.js +86 -0
  197. package/build/togetherOrganisms.js +71 -0
  198. package/build/treePopoverMenu-c0cb395f.js +343 -0
  199. package/build/{types-6996fb20.js → types-8d9c5f21.js} +13 -13
  200. package/build/types-b25ffde0.js +7 -0
  201. package/build/types.js +1 -1
  202. package/build/{useCategory-7d1f8a7d.js → useCategory-b695fd3a.js} +5 -5
  203. package/build/{useHealthToolCache-b7dea4aa.js → useHealthToolCache-048807ea.js} +2 -2
  204. package/build/{useMantineLocale-b243f628.js → useMantineLocale-0d63dfea.js} +3 -3
  205. package/build/{usePlacesAutocomplete-08b86d2d.js → usePlacesAutocomplete-9520e525.js} +1 -1
  206. package/build/useTogetherAuthRequiredAction.js +70 -0
  207. package/build/{useTranslations-d5456a98.js → useTranslations-685f989b.js} +1 -1
  208. package/build/{utils-9f62698f.js → utils-169c6a7d.js} +16 -375
  209. package/build/{utils-d421a448.js → utils-1a00c0f8.js} +1 -1
  210. package/build/vaccination.js +58 -69
  211. package/package.json +1 -1
  212. package/build/Instagram-91ba1e26.js +0 -32
  213. package/build/esm/Instagram-319a8e34.js +0 -26
  214. package/build/esm/index-13bf84f4.js +0 -298
  215. package/build/esm/index-1a3f36c3.js +0 -1086
  216. package/build/esm/index-800b956a.js +0 -7245
  217. package/build/esm/index-aebf96f3.js +0 -33
  218. package/build/esm/index-d48b5db6.js +0 -71
  219. package/build/esm/index-d5b66388.js +0 -23
  220. package/build/esm/index.styles-0ef0135c.js +0 -1322
  221. package/build/index-0523771b.js +0 -7324
  222. package/build/index-20ebc0bd.js +0 -30
  223. package/build/index-dbf560f2.js +0 -1100
  224. package/build/index-efcbac97.js +0 -39
  225. package/build/index-f5103542.js +0 -77
  226. package/build/index.styles-2bdfde5f.js +0 -1361
  227. /package/build/{BMI_BOYS.percentile.monthly-c38ce03a.js → BMI_BOYS.percentile.monthly-1aa95e30.js} +0 -0
  228. /package/build/{BMI_BOYS.percentile.weekly-1eccee42.js → BMI_BOYS.percentile.weekly-61d78e1c.js} +0 -0
  229. /package/build/{BMI_BOYS.percentile.yearly-0e7d5cb6.js → BMI_BOYS.percentile.yearly-f80e040e.js} +0 -0
  230. /package/build/{BMI_BOYS.zscore.monthly-f72f392f.js → BMI_BOYS.zscore.monthly-a6c7c8ff.js} +0 -0
  231. /package/build/{BMI_BOYS.zscore.weekly-94fd04e6.js → BMI_BOYS.zscore.weekly-742f7028.js} +0 -0
  232. /package/build/{BMI_BOYS.zscore.yearly-90d5e091.js → BMI_BOYS.zscore.yearly-c19cccd5.js} +0 -0
  233. /package/build/{BMI_GIRLS.percentile.monthly-de3a9a14.js → BMI_GIRLS.percentile.monthly-089d3981.js} +0 -0
  234. /package/build/{BMI_GIRLS.percentile.weekly-1e1ce2b7.js → BMI_GIRLS.percentile.weekly-0cc52cda.js} +0 -0
  235. /package/build/{BMI_GIRLS.percentile.yearly-70a44f31.js → BMI_GIRLS.percentile.yearly-10bc603f.js} +0 -0
  236. /package/build/{BMI_GIRLS.zscore.monthly-be4399a5.js → BMI_GIRLS.zscore.monthly-c3fe57f3.js} +0 -0
  237. /package/build/{BMI_GIRLS.zscore.weekly-6121376b.js → BMI_GIRLS.zscore.weekly-b83a54db.js} +0 -0
  238. /package/build/{BMI_GIRLS.zscore.yearly-822e7686.js → BMI_GIRLS.zscore.yearly-5f13cda2.js} +0 -0
  239. /package/build/{ChevronDown-f9d31306.js → ChevronDown-2fd86d66.js} +0 -0
  240. /package/build/{Close-27e0dcf1.js → Close-711196b0.js} +0 -0
  241. /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-5e094c3e.js → HEAD CIRCUM_BOYS.percentile.monthly-03b8d7fb.js} +0 -0
  242. /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-24f827d8.js → HEAD CIRCUM_BOYS.percentile.weekly-9ebd3eb6.js} +0 -0
  243. /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-d7478410.js → HEAD CIRCUM_BOYS.percentile.yearly-8e97b738.js} +0 -0
  244. /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-1123cad6.js → HEAD CIRCUM_BOYS.zscore.monthly-e7892261.js} +0 -0
  245. /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-a5b55615.js → HEAD CIRCUM_BOYS.zscore.weekly-47c5af84.js} +0 -0
  246. /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-0d818764.js → HEAD CIRCUM_BOYS.zscore.yearly-9a1bc325.js} +0 -0
  247. /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-dddf5ad9.js → HEAD CIRCUM_GIRLS.percentile.monthly-d84491d7.js} +0 -0
  248. /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-a80d6989.js → HEAD CIRCUM_GIRLS.percentile.weekly-a6f38c3e.js} +0 -0
  249. /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-01850b67.js → HEAD CIRCUM_GIRLS.percentile.yearly-5771d277.js} +0 -0
  250. /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-82890053.js → HEAD CIRCUM_GIRLS.zscore.monthly-e3633bcc.js} +0 -0
  251. /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-069f8c8f.js → HEAD CIRCUM_GIRLS.zscore.weekly-23b0ab1a.js} +0 -0
  252. /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-ae5ef237.js → HEAD CIRCUM_GIRLS.zscore.yearly-20f29cf1.js} +0 -0
  253. /package/build/{HEIGHT_BOYS.percentile.monthly-d0da1664.js → HEIGHT_BOYS.percentile.monthly-57cc12ee.js} +0 -0
  254. /package/build/{HEIGHT_BOYS.percentile.weekly-55446b8a.js → HEIGHT_BOYS.percentile.weekly-c788506a.js} +0 -0
  255. /package/build/{HEIGHT_BOYS.percentile.yearly-f2f5b19f.js → HEIGHT_BOYS.percentile.yearly-ac56c1f2.js} +0 -0
  256. /package/build/{HEIGHT_BOYS.zscore.monthly-e6ed98ef.js → HEIGHT_BOYS.zscore.monthly-1bb78253.js} +0 -0
  257. /package/build/{HEIGHT_BOYS.zscore.weekly-d0d37479.js → HEIGHT_BOYS.zscore.weekly-22737c43.js} +0 -0
  258. /package/build/{HEIGHT_BOYS.zscore.yearly-4023b808.js → HEIGHT_BOYS.zscore.yearly-90f6cd0a.js} +0 -0
  259. /package/build/{HEIGHT_GIRLS.percentile.monthly-6d9aeadc.js → HEIGHT_GIRLS.percentile.monthly-019f80d2.js} +0 -0
  260. /package/build/{HEIGHT_GIRLS.percentile.weekly-2087c9b4.js → HEIGHT_GIRLS.percentile.weekly-ceed9817.js} +0 -0
  261. /package/build/{HEIGHT_GIRLS.percentile.yearly-f98d8b05.js → HEIGHT_GIRLS.percentile.yearly-3e5192ac.js} +0 -0
  262. /package/build/{HEIGHT_GIRLS.zscore.monthly-99d299e3.js → HEIGHT_GIRLS.zscore.monthly-f8fca0b6.js} +0 -0
  263. /package/build/{HEIGHT_GIRLS.zscore.weekly-c46ed349.js → HEIGHT_GIRLS.zscore.weekly-827b17e8.js} +0 -0
  264. /package/build/{HEIGHT_GIRLS.zscore.yearly-fddefca4.js → HEIGHT_GIRLS.zscore.yearly-3cdb483d.js} +0 -0
  265. /package/build/{Visible-01dfaec9.js → Visible-515a4eec.js} +0 -0
  266. /package/build/{WEIGHT_BOYS.percentile.monthly-cead8ece.js → WEIGHT_BOYS.percentile.monthly-2ecbd498.js} +0 -0
  267. /package/build/{WEIGHT_BOYS.percentile.weekly-a97fa31a.js → WEIGHT_BOYS.percentile.weekly-75c9c25c.js} +0 -0
  268. /package/build/{WEIGHT_BOYS.percentile.yearly-c2c41945.js → WEIGHT_BOYS.percentile.yearly-03e7cea6.js} +0 -0
  269. /package/build/{WEIGHT_BOYS.zscore.monthly-d8de7dc2.js → WEIGHT_BOYS.zscore.monthly-2ff9fb56.js} +0 -0
  270. /package/build/{WEIGHT_BOYS.zscore.weekly-41a6f6bf.js → WEIGHT_BOYS.zscore.weekly-e9f7fe2d.js} +0 -0
  271. /package/build/{WEIGHT_BOYS.zscore.yearly-5762fa8a.js → WEIGHT_BOYS.zscore.yearly-4a96f34f.js} +0 -0
  272. /package/build/{WEIGHT_GIRLS.percentile.monthly-526fb18a.js → WEIGHT_GIRLS.percentile.monthly-5bf09e30.js} +0 -0
  273. /package/build/{WEIGHT_GIRLS.percentile.weekly-6c63ed2b.js → WEIGHT_GIRLS.percentile.weekly-f737ae23.js} +0 -0
  274. /package/build/{WEIGHT_GIRLS.percentile.yearly-0ecdbd3a.js → WEIGHT_GIRLS.percentile.yearly-56ebc8eb.js} +0 -0
  275. /package/build/{WEIGHT_GIRLS.zscore.monthly-0c353536.js → WEIGHT_GIRLS.zscore.monthly-4697d3b5.js} +0 -0
  276. /package/build/{WEIGHT_GIRLS.zscore.weekly-97898ff6.js → WEIGHT_GIRLS.zscore.weekly-3633820e.js} +0 -0
  277. /package/build/{WEIGHT_GIRLS.zscore.yearly-cbebe807.js → WEIGHT_GIRLS.zscore.yearly-a9a04790.js} +0 -0
  278. /package/build/{animation-8605b5bb.js → animation-85d012ee.js} +0 -0
  279. /package/build/{cart-ab5762b8.js → cart-8877bd63.js} +0 -0
  280. /package/build/{cookieHelper-b2132ffc.js → cookieHelper-86ae022e.js} +0 -0
  281. /package/build/{doctor-f121fd79.js → doctor-2c14fed1.js} +0 -0
  282. /package/build/esm/{BMI_BOYS.percentile.monthly-e507536d.js → BMI_BOYS.percentile.monthly-42ff2c64.js} +0 -0
  283. /package/build/esm/{BMI_BOYS.percentile.weekly-3cbf7392.js → BMI_BOYS.percentile.weekly-b4a6c521.js} +0 -0
  284. /package/build/esm/{BMI_BOYS.percentile.yearly-c7d54bc3.js → BMI_BOYS.percentile.yearly-d3bc1a77.js} +0 -0
  285. /package/build/esm/{BMI_BOYS.zscore.monthly-4d09aca0.js → BMI_BOYS.zscore.monthly-c4506dfa.js} +0 -0
  286. /package/build/esm/{BMI_BOYS.zscore.weekly-319b78c5.js → BMI_BOYS.zscore.weekly-ddf3b3f9.js} +0 -0
  287. /package/build/esm/{BMI_BOYS.zscore.yearly-764732c5.js → BMI_BOYS.zscore.yearly-e0e3139e.js} +0 -0
  288. /package/build/esm/{BMI_GIRLS.percentile.monthly-5a8e4069.js → BMI_GIRLS.percentile.monthly-96686bcc.js} +0 -0
  289. /package/build/esm/{BMI_GIRLS.percentile.weekly-a2fe6df1.js → BMI_GIRLS.percentile.weekly-c3106a65.js} +0 -0
  290. /package/build/esm/{BMI_GIRLS.percentile.yearly-810fe911.js → BMI_GIRLS.percentile.yearly-b38c1f1f.js} +0 -0
  291. /package/build/esm/{BMI_GIRLS.zscore.monthly-afab03b0.js → BMI_GIRLS.zscore.monthly-f8a7836f.js} +0 -0
  292. /package/build/esm/{BMI_GIRLS.zscore.weekly-8f4e7198.js → BMI_GIRLS.zscore.weekly-4c1fc771.js} +0 -0
  293. /package/build/esm/{BMI_GIRLS.zscore.yearly-7f043621.js → BMI_GIRLS.zscore.yearly-dce5e66a.js} +0 -0
  294. /package/build/esm/{ChevronDown-d24fd24b.js → ChevronDown-31ea3e19.js} +0 -0
  295. /package/build/esm/{Close-6243d246.js → Close-40d598bc.js} +0 -0
  296. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-91c12176.js → HEAD CIRCUM_BOYS.percentile.monthly-34e3fa1c.js} +0 -0
  297. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-40e77c68.js → HEAD CIRCUM_BOYS.percentile.weekly-d3f3568f.js} +0 -0
  298. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-1a284ec4.js → HEAD CIRCUM_BOYS.percentile.yearly-dfae3ad2.js} +0 -0
  299. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-16f716a6.js → HEAD CIRCUM_BOYS.zscore.monthly-95840c2f.js} +0 -0
  300. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-07d20112.js → HEAD CIRCUM_BOYS.zscore.weekly-8b198c1c.js} +0 -0
  301. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-1201a10a.js → HEAD CIRCUM_BOYS.zscore.yearly-b7d639ad.js} +0 -0
  302. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-a6348baf.js → HEAD CIRCUM_GIRLS.percentile.monthly-47caa070.js} +0 -0
  303. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-af26363f.js → HEAD CIRCUM_GIRLS.percentile.weekly-bae46665.js} +0 -0
  304. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-e7637928.js → HEAD CIRCUM_GIRLS.percentile.yearly-81989cdd.js} +0 -0
  305. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-9be0e0ca.js → HEAD CIRCUM_GIRLS.zscore.monthly-f2f7d985.js} +0 -0
  306. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-3ffe9dcd.js → HEAD CIRCUM_GIRLS.zscore.weekly-e287ddb7.js} +0 -0
  307. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-d7226db1.js → HEAD CIRCUM_GIRLS.zscore.yearly-8790b62a.js} +0 -0
  308. /package/build/esm/{HEIGHT_BOYS.percentile.monthly-c2e21892.js → HEIGHT_BOYS.percentile.monthly-5d2b6466.js} +0 -0
  309. /package/build/esm/{HEIGHT_BOYS.percentile.weekly-22018f1e.js → HEIGHT_BOYS.percentile.weekly-a38ad13e.js} +0 -0
  310. /package/build/esm/{HEIGHT_BOYS.percentile.yearly-391cd377.js → HEIGHT_BOYS.percentile.yearly-e4841712.js} +0 -0
  311. /package/build/esm/{HEIGHT_BOYS.zscore.monthly-e11f50f4.js → HEIGHT_BOYS.zscore.monthly-d8e722f8.js} +0 -0
  312. /package/build/esm/{HEIGHT_BOYS.zscore.weekly-8e2c8306.js → HEIGHT_BOYS.zscore.weekly-a92ea3ca.js} +0 -0
  313. /package/build/esm/{HEIGHT_BOYS.zscore.yearly-78e974bb.js → HEIGHT_BOYS.zscore.yearly-3af1adce.js} +0 -0
  314. /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-0a49ff89.js → HEIGHT_GIRLS.percentile.monthly-c5203801.js} +0 -0
  315. /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-5e158a8e.js → HEIGHT_GIRLS.percentile.weekly-4c25d07f.js} +0 -0
  316. /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-f5544ab2.js → HEIGHT_GIRLS.percentile.yearly-f91e2e27.js} +0 -0
  317. /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-92f67ec2.js → HEIGHT_GIRLS.zscore.monthly-b2a60aca.js} +0 -0
  318. /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-f5d11f32.js → HEIGHT_GIRLS.zscore.weekly-0a98c520.js} +0 -0
  319. /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-4fe6aad9.js → HEIGHT_GIRLS.zscore.yearly-8070d58f.js} +0 -0
  320. /package/build/esm/{Visible-7f408f98.js → Visible-e3e4fb6f.js} +0 -0
  321. /package/build/esm/{WEIGHT_BOYS.percentile.monthly-b09ae73a.js → WEIGHT_BOYS.percentile.monthly-b262b97d.js} +0 -0
  322. /package/build/esm/{WEIGHT_BOYS.percentile.weekly-733a24a9.js → WEIGHT_BOYS.percentile.weekly-7e817f9f.js} +0 -0
  323. /package/build/esm/{WEIGHT_BOYS.percentile.yearly-2bfcfc93.js → WEIGHT_BOYS.percentile.yearly-b7f1786a.js} +0 -0
  324. /package/build/esm/{WEIGHT_BOYS.zscore.monthly-c0d3a746.js → WEIGHT_BOYS.zscore.monthly-014af835.js} +0 -0
  325. /package/build/esm/{WEIGHT_BOYS.zscore.weekly-b41ff498.js → WEIGHT_BOYS.zscore.weekly-4577f724.js} +0 -0
  326. /package/build/esm/{WEIGHT_BOYS.zscore.yearly-15bb7570.js → WEIGHT_BOYS.zscore.yearly-08fd3f13.js} +0 -0
  327. /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-5b79dea8.js → WEIGHT_GIRLS.percentile.monthly-a6e1aa0d.js} +0 -0
  328. /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-33052637.js → WEIGHT_GIRLS.percentile.weekly-4c0b6f94.js} +0 -0
  329. /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-64382b53.js → WEIGHT_GIRLS.percentile.yearly-bf689a3a.js} +0 -0
  330. /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-63f19584.js → WEIGHT_GIRLS.zscore.monthly-f82fc3c8.js} +0 -0
  331. /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-938ebce2.js → WEIGHT_GIRLS.zscore.weekly-854ce987.js} +0 -0
  332. /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-016e1cfc.js → WEIGHT_GIRLS.zscore.yearly-2a3b869a.js} +0 -0
  333. /package/build/esm/{animation-bf170ee9.js → animation-85d9a0ed.js} +0 -0
  334. /package/build/esm/{cart-5bdb4fa5.js → cart-1ac23ce7.js} +0 -0
  335. /package/build/esm/{cookieHelper-ff6c13b4.js → cookieHelper-6c3b4790.js} +0 -0
  336. /package/build/esm/{doctor-f4cadffb.js → doctor-e0c2476d.js} +0 -0
  337. /package/build/esm/{index-eeedf0f0.js → index-189d7601.js} +0 -0
  338. /package/build/esm/{index-b87433a0.js → index-21bca818.js} +0 -0
  339. /package/build/esm/{index-6c0f560b.js → index-266a32ff.js} +0 -0
  340. /package/build/esm/{index-528e64f4.js → index-8684181f.js} +0 -0
  341. /package/build/esm/{isProduction-2838b9ae.js → isProduction-1937d355.js} +0 -0
  342. /package/build/esm/{localizeNumberFormat-9303c122.js → localizeNumberFormat-1f000110.js} +0 -0
  343. /package/build/esm/{normalizeLink-38ab69f4.js → normalizeLink-7a93ebb9.js} +0 -0
  344. /package/build/esm/{number-fcae69c7.js → number-1d1ba14a.js} +0 -0
  345. /package/build/esm/{paths-d1c61fa8.js → paths-b83be1a0.js} +0 -0
  346. /package/build/esm/{theme-0af1cc3d.js → theme-7dadf4a1.js} +0 -0
  347. /package/build/esm/{translationsContext-036458b7.js → translationsContext-42a1fa63.js} +0 -0
  348. /package/build/esm/{tslib.es6-2673b49d.js → tslib.es6-06ba3978.js} +0 -0
  349. /package/build/esm/{useIsInit-2c5ff93d.js → useIsInit-f4dec279.js} +0 -0
  350. /package/build/esm/{useOutsideClick-7023de23.js → useOutsideClick-210c1134.js} +0 -0
  351. /package/build/esm/{useScrollbarSize-dfdab229.js → useScrollbarSize-909ae7ec.js} +0 -0
  352. /package/build/esm/{useUniqueId-d4b0bdd3.js → useUniqueId-5885911d.js} +0 -0
  353. /package/build/esm/{utils-511a24f4.js → utils-d7bbdb52.js} +0 -0
  354. /package/build/{index-18ddaa1b.js → index-1f3fc2e3.js} +0 -0
  355. /package/build/{index-5c400e5e.js → index-2de1eb4a.js} +0 -0
  356. /package/build/{index-bced434a.js → index-6fdcd09d.js} +0 -0
  357. /package/build/{index-c524c362.js → index-bc9e8eae.js} +0 -0
  358. /package/build/{isProduction-2e55aee3.js → isProduction-20cd663d.js} +0 -0
  359. /package/build/{localizeNumberFormat-2befc6e4.js → localizeNumberFormat-7ff6bd3a.js} +0 -0
  360. /package/build/{normalizeLink-0fd36e61.js → normalizeLink-d307f624.js} +0 -0
  361. /package/build/{number-92da0262.js → number-dddf656c.js} +0 -0
  362. /package/build/{paths-350514c4.js → paths-7da79c64.js} +0 -0
  363. /package/build/{theme-f410baf6.js → theme-be20929b.js} +0 -0
  364. /package/build/{translationsContext-11cafcfc.js → translationsContext-00fdb62e.js} +0 -0
  365. /package/build/{tslib.es6-4bc45883.js → tslib.es6-bd3f8718.js} +0 -0
  366. /package/build/{useIsInit-0f6d1879.js → useIsInit-e06b96f5.js} +0 -0
  367. /package/build/{useOutsideClick-e067cc79.js → useOutsideClick-d95a32b6.js} +0 -0
  368. /package/build/{useScrollbarSize-ed50b4a6.js → useScrollbarSize-1499b1c3.js} +0 -0
  369. /package/build/{useUniqueId-4ce69bff.js → useUniqueId-1af8848e.js} +0 -0
  370. /package/build/{utils-4849d92a.js → utils-15a9772e.js} +0 -0
@@ -0,0 +1,1349 @@
1
+ import { a as __awaiter, _ as __rest } from './tslib.es6-06ba3978.js';
2
+ import React__default, { useContext, useState, useEffect, useMemo } from 'react';
3
+ import { B as Button } from './index-9b9c1499.js';
4
+ import { H as Heading } from './index-046778af.js';
5
+ import { u as useTranslations } from './useTranslations-b970f667.js';
6
+ import innertext from 'innertext';
7
+ import { S as SharePopup, P as PopupDanger, x as deletePost, y as IconAlertCircle, e as SubmitReportForm, z as deleteComment, C as CardAuthor, L as Loading, l as ProfileDetailModal, m as ProfileDetail, A as decodeCommentBody, g as PostContent, j as PostImagePreview, B as likeUnlikeComment, I as InputCommentBar, k as SocialLinkPreview, D as likeUnlikePost, s as getDefaultFailNoti } from './index-c430773c.js';
8
+ import { C as CommonGAssets } from './index-9471fca1.js';
9
+ import { R as REPORT_REASON_MAP, D as DEFAULT_IMG } from './constants-a5827634.js';
10
+ import { T as TogetherComponentGlobalContext, b as callApiWithAuth, d as getApiPath, P as PATHS, c as callApi, r as getMarryBabyApiPath, p as DISCOVER_PATHS, o as getDiscoverApiPath, g as getCarePath, C as CARE_PATHS, k as getCurrentBaseUrl$1, s as callApiWithOptionalAuth, l as domainLocales$1 } from './utils-3b29eb79.js';
11
+ import { useTogetherAuthRequiredAction, TogetherAuthConfigContextProvider } from './useTogetherAuthRequiredAction.js';
12
+ import { b as TreePopoverMenu, C as CardReactions, c as CardReactionType, a as LabelPin, T as TagTopic } from './treePopoverMenu-cb214db6.js';
13
+ import styled from '@emotion/styled';
14
+ import { M as MediaQueries } from './utils-d7bbdb52.js';
15
+ import { t as theme } from './theme-7dadf4a1.js';
16
+ import { e as formatArticle, h as formatCategory, c as formatComment } from './dataTransform-623716c3.js';
17
+ import { C as CardLink } from './index-10ab6596.js';
18
+ import { D as Divider } from './index-f4b938f2.js';
19
+ import { d as domainLocales } from './index-6210f454.js';
20
+ import { Plus } from '@hhgtech/icons/core';
21
+ import { ArrowRight, ArrowDown, Trash, Endorse } from '@hhgtech/icons/other';
22
+ import { Accordion } from '@mantine/core';
23
+ import { I as Input } from './index-f660abb7.js';
24
+ import { T as Text } from './index-5723381f.js';
25
+ import { g as getCurrentBaseUrl } from './routing-9e330438.js';
26
+
27
+ var img$8 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3e%3cpath fill='%233E3F58' d='M5 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2M19 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2'/%3e%3c/svg%3e";
28
+ var MBMoreSolid = img$8;
29
+
30
+ var img$7 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23595959'%3e%3cpath stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' d='M12 13.333 8 10.37l-4 2.963V3.852c0-.314.12-.616.335-.838.214-.222.505-.347.808-.347h5.714c.303 0 .594.125.808.347s.335.524.335.838z'/%3e%3c/svg%3e";
31
+ var IconBookmarkFill = img$7;
32
+
33
+ var img$6 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' d='M12 13.333 8 10.37l-4 2.963V3.852c0-.314.12-.616.335-.838.214-.222.505-.347.808-.347h5.714c.303 0 .594.125.808.347s.335.524.335.838z'/%3e%3c/svg%3e";
34
+ var IconBookmark = img$6;
35
+
36
+ var img$5 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='3' height='13' fill='none'%3e%3ccircle cx='1.583' cy='6.417' r='1.25' fill='%23595959' transform='rotate(90 1.583 6.417)'/%3e%3ccircle cx='1.583' cy='1.417' r='1.25' fill='%23595959' transform='rotate(90 1.583 1.417)'/%3e%3ccircle cx='1.583' cy='11.417' r='1.25' fill='%23595959' transform='rotate(90 1.583 11.417)'/%3e%3c/svg%3e";
37
+ var IconKebab = img$5;
38
+
39
+ var img$4 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' d='M12 5.333a2 2 0 1 0 0-4 2 2 0 0 0 0 4M4 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4M12 14.667a2 2 0 1 0 0-4 2 2 0 0 0 0 4M5.727 9.007l4.553 2.653M10.273 4.34 5.727 6.993'/%3e%3c/svg%3e";
40
+ var IconShareOnMedia = img$4;
41
+
42
+ var img$3 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' d='M7.17 3.236H2.995a1.193 1.193 0 0 0-1.193 1.192v8.35a1.193 1.193 0 0 0 1.193 1.192h8.35a1.193 1.193 0 0 0 1.192-1.192V8.603'/%3e%3cpath stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' d='M11.643 2.341a1.265 1.265 0 0 1 1.789 1.79L7.766 9.795l-2.385.596.596-2.385z'/%3e%3c/svg%3e";
43
+ var IconTabEdit = img$3;
44
+
45
+ var img$2 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='M2 4h12'/%3e%3cpath stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M5.333 4V2.667a1.333 1.333 0 0 1 1.334-1.334h2.666a1.334 1.334 0 0 1 1.334 1.334V4m2 0v9.333a1.334 1.334 0 0 1-1.334 1.334H4.667a1.334 1.334 0 0 1-1.334-1.334V4zM6.667 7.333v4M9.333 7.333v4'/%3e%3c/svg%3e";
46
+ var IconTrashBin = img$2;
47
+
48
+ // import IconBellOff from '../../../assets/svg/icon-bell-off.svg'
49
+ // import IconBellOn from '../../../assets/svg/icon-bell-on.svg'
50
+ const CardPostPopoverMore = ({ authorEmail, onDeletePost, shareUrl, post, className = '', popoverClassName = '', onBookmark, onRemoveBookmark, onEditPost, }) => {
51
+ const { data: { locale, userInfo, togetherUserId, env: { isMarryBaby }, }, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
52
+ const { t } = useTranslations();
53
+ // const [localHasNoti, setLocalHasNoti] = useState(false)
54
+ const [loading, setLoading] = useState(false);
55
+ const [isOpenLeavePopup, setIsOpenLeavePopup] = useState(false);
56
+ const [isOpenSharePopup, setIsOpenSharePopup] = useState(false);
57
+ const { authActionWrapper } = useTogetherAuthRequiredAction();
58
+ const isAuthor = authorEmail && (userInfo === null || userInfo === void 0 ? void 0 : userInfo.email) && authorEmail === String(userInfo === null || userInfo === void 0 ? void 0 : userInfo.email);
59
+ return (React__default.createElement("div", { className: className, onClick: (e) => {
60
+ e.preventDefault();
61
+ e.stopPropagation();
62
+ } },
63
+ isOpenSharePopup && (React__default.createElement(SharePopup, { url: shareUrl, text: post === null || post === void 0 ? void 0 : post.title, onClose: () => setIsOpenSharePopup(false) })),
64
+ isOpenLeavePopup && (React__default.createElement(PopupDanger, { thumbnail: CommonGAssets.getAssetPath('trash-bin.svg'), isThumbnailIcon: true, title: t('popup.deletePost.title'), description: t('popup.deletePost.description'), acceptText: t('popup.deletePost.accept'), cancelText: t('popup.deletePost.cancel'), onAccept: () => __awaiter(void 0, void 0, void 0, function* () {
65
+ if (!(post === null || post === void 0 ? void 0 : post.id) || loading)
66
+ return;
67
+ setLoading(true);
68
+ try {
69
+ const res = yield deletePost({
70
+ id: post.id,
71
+ locale,
72
+ });
73
+ if ((res === null || res === void 0 ? void 0 : res.status) === 1)
74
+ onDeletePost === null || onDeletePost === void 0 ? void 0 : onDeletePost();
75
+ }
76
+ catch (_a) { }
77
+ setLoading(false);
78
+ }), onClose: () => setIsOpenLeavePopup(false) })),
79
+ React__default.createElement(TreePopoverMenu, { className: popoverClassName, toggleButtonContent: React__default.createElement("img", { src: isMarryBaby ? MBMoreSolid : IconKebab, loading: "lazy" }), position: "bottom", align: "end", buttonProps: {
80
+ isLoading: loading,
81
+ }, data: isAuthor
82
+ ? {
83
+ isShowheader: false,
84
+ type: 'list',
85
+ list: [
86
+ {
87
+ icon: IconShareOnMedia,
88
+ label: t('morePopover.share'),
89
+ onClick: () => setIsOpenSharePopup(true),
90
+ },
91
+ {
92
+ icon: IconTabEdit,
93
+ label: t('actionPopover.edit'),
94
+ onClick: onEditPost,
95
+ },
96
+ {
97
+ icon: IconTrashBin,
98
+ label: t('actionPopover.delete'),
99
+ onClick: () => {
100
+ authActionWrapper(() => setIsOpenLeavePopup(true));
101
+ },
102
+ },
103
+ ],
104
+ }
105
+ : {
106
+ isShowheader: false,
107
+ type: 'list',
108
+ list: [
109
+ {
110
+ icon: IconShareOnMedia,
111
+ label: t('morePopover.share'),
112
+ onClick: () => setIsOpenSharePopup(true),
113
+ },
114
+ {
115
+ icon: !!(post === null || post === void 0 ? void 0 : post.bookmarked) ? IconBookmarkFill : IconBookmark,
116
+ label: !!(post === null || post === void 0 ? void 0 : post.bookmarked)
117
+ ? t('morePopover.unsavePost')
118
+ : t('morePopover.savePost'),
119
+ onClick: () => {
120
+ authActionWrapper(() => __awaiter(void 0, void 0, void 0, function* () {
121
+ if (!(userInfo === null || userInfo === void 0 ? void 0 : userInfo.id) || !(post === null || post === void 0 ? void 0 : post.id))
122
+ return;
123
+ if (post === null || post === void 0 ? void 0 : post.bookmarked) {
124
+ const res = yield callApiWithAuth(getApiPath(PATHS.BOOKMARK.DELETE, {
125
+ _locale: locale,
126
+ }), 'DELETE', {
127
+ data: {
128
+ post_id: String(post.id),
129
+ },
130
+ });
131
+ if ((res === null || res === void 0 ? void 0 : res.status) === 1) {
132
+ pushNotifications({
133
+ title: '',
134
+ message: 'Removed saved post',
135
+ type: 'success',
136
+ displayIcon: IconBookmark,
137
+ });
138
+ onRemoveBookmark && onRemoveBookmark();
139
+ }
140
+ else {
141
+ pushNotifications({
142
+ title: '',
143
+ message: 'Remove failed',
144
+ type: 'danger',
145
+ displayIcon: IconBookmark,
146
+ });
147
+ }
148
+ }
149
+ else {
150
+ const res = yield callApiWithAuth(getApiPath(PATHS.BOOKMARK.CREATE, {
151
+ _locale: locale,
152
+ }), 'POST', {
153
+ data: {
154
+ user_id: togetherUserId || userInfo.id,
155
+ post_id: post.id,
156
+ },
157
+ });
158
+ if ((res === null || res === void 0 ? void 0 : res.status) === 1) {
159
+ pushNotifications({
160
+ title: '',
161
+ message: 'Post saved',
162
+ type: 'success',
163
+ displayIcon: IconBookmarkFill,
164
+ });
165
+ onBookmark && onBookmark();
166
+ }
167
+ else {
168
+ pushNotifications({
169
+ title: '',
170
+ message: 'Post saved failed',
171
+ type: 'danger',
172
+ displayIcon: IconBookmark,
173
+ });
174
+ }
175
+ }
176
+ }));
177
+ },
178
+ },
179
+ // {
180
+ // icon: togetherBasePath + '/svg/icon-bell-on.svg',
181
+ // label: !localHasNoti
182
+ // ? t( 'morePopover.turnOnNotifications' })
183
+ // : t( 'morePopover.turnOffNotifications' }),
184
+ // onClick: () => {
185
+ // authActionWrapper(async () => {
186
+ // if (!post?.id || loading) return
187
+ // setLoading(true)
188
+ // try {
189
+ // const res = await followUnfollowPost({
190
+ // id: post?.id,
191
+ // locale,
192
+ // })
193
+ // if (res?.status === 1) {
194
+ // pushNotifications({
195
+ // message: !localHasNoti
196
+ // ? 'Notification on'
197
+ // : 'Notification off',
198
+ // type: !localHasNoti ? 'success' : 'danger',
199
+ // displayIcon: !localHasNoti ? IconBellOn : IconBellOff,
200
+ // })
201
+ // setLocalHasNoti((v) => !v)
202
+ // }
203
+ // } catch {}
204
+ // setLoading(false)
205
+ // })
206
+ // },
207
+ // },
208
+ {
209
+ icon: IconAlertCircle,
210
+ label: t('morePopover.report'),
211
+ subTree: {
212
+ title: t('morePopover.report.title'),
213
+ description: t('morePopover.report.description'),
214
+ isShowheader: true,
215
+ type: 'list',
216
+ list: Object.keys(REPORT_REASON_MAP)
217
+ .map((k) => ({
218
+ label: REPORT_REASON_MAP[k].label,
219
+ reason: REPORT_REASON_MAP[k].reportReasonText,
220
+ reasonValue: k,
221
+ }))
222
+ .map((item) => ({
223
+ label: t(item.label),
224
+ subTree: {
225
+ title: t('morePopover.reportSubmit.title'),
226
+ description: t('morePopover.reportSubmit.description'),
227
+ isShowheader: true,
228
+ type: 'jsx',
229
+ jsxRenderer: (setShow) => (React__default.createElement(SubmitReportForm, { reason: item.reasonValue, reasonText: t(item.reason), postId: post === null || post === void 0 ? void 0 : post.id, onClose: () => setShow && setShow(false) })),
230
+ },
231
+ })),
232
+ },
233
+ },
234
+ ],
235
+ } })));
236
+ };
237
+
238
+ const StyledCardPost$1 = styled.div `
239
+ position: relative;
240
+ margin-bottom: 24px;
241
+ background: white;
242
+ border-radius: ${theme.borderRadius};
243
+
244
+ a {
245
+ text-decoration: none;
246
+ }
247
+
248
+ ${MediaQueries.mbDown} {
249
+ margin-bottom: 8px;
250
+ }
251
+ &.flat-top {
252
+ border-top-left-radius: 0;
253
+ border-top-right-radius: 0;
254
+ }
255
+
256
+ .post-pin {
257
+ padding: 0.5rem 1rem;
258
+ border-radius: ${theme.borderRadius} 6px 0 0;
259
+ }
260
+ .post-author {
261
+ display: flex;
262
+ align-items: center;
263
+ justify-content: space-between;
264
+ &.comment {
265
+ padding-right: 2.6rem;
266
+ }
267
+ .author-avatar-wrapper {
268
+ width: 40px;
269
+ height: 40px;
270
+ font-size: 20px;
271
+ ${MediaQueries.mbDown} {
272
+ width: 32px;
273
+ height: 32px;
274
+ font-size: 16px;
275
+ }
276
+ }
277
+ }
278
+ .post-content-link-wrapper {
279
+ color: inherit;
280
+ cursor: pointer;
281
+ .post-content-title {
282
+ padding: 1rem 1rem 0;
283
+ word-break: break-word;
284
+ }
285
+ }
286
+ .social-preview-wrapper.has-image {
287
+ margin-bottom: 5px;
288
+ }
289
+ .social-preview-wrapper,
290
+ .image-preview-wrapper,
291
+ .link-preview-wrapper {
292
+ width: 100%;
293
+ &[data-is-reply='true'] {
294
+ padding-right: 1rem;
295
+ padding-left: 1rem;
296
+ }
297
+ }
298
+ .post-topics {
299
+ padding: 0 1rem;
300
+ }
301
+
302
+ .post-reaction {
303
+ background: none;
304
+ border-radius: 0 0 6px 6px;
305
+ &.hide-top-border {
306
+ ::before {
307
+ display: none;
308
+ }
309
+ }
310
+ }
311
+ .most-engaging-wrapper {
312
+ padding: 1rem;
313
+ cursor: pointer;
314
+ .author-avatar-wrapper {
315
+ width: 2rem;
316
+ height: 2rem;
317
+ font-size: 1rem;
318
+ }
319
+ .see-more-comments {
320
+ width: 100%;
321
+ padding: 12px 0 0;
322
+ text-align: unset;
323
+ }
324
+ }
325
+ &[data-most-engaging='true'] {
326
+ border: none;
327
+ ${MediaQueries.mbDown} {
328
+ margin: 1rem;
329
+ border: 1px solid #e4e8ec;
330
+ }
331
+ }
332
+ .top-divider {
333
+ border-color: #e4e8ec;
334
+ }
335
+ .popover {
336
+ .popover-menu__btn {
337
+ display: flex;
338
+ width: 1.5rem;
339
+ height: 1rem;
340
+ align-items: center;
341
+ justify-content: center;
342
+ padding: 0;
343
+ background: transparent;
344
+
345
+ &:hover {
346
+ background-color: transparent;
347
+ }
348
+ }
349
+ .popover-menu__content {
350
+ &.--position-bottom {
351
+ &.--align-end {
352
+ &::before {
353
+ right: 12.5px;
354
+ }
355
+ }
356
+ }
357
+ }
358
+ }
359
+
360
+ &[data-is-marrybaby='true'] {
361
+ border: 1px solid #f3f3f3;
362
+ border-radius: 1rem;
363
+ /* shadow */
364
+
365
+ box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.08);
366
+ .image-preview-wrapper,
367
+ .link-preview-wrapper {
368
+ padding-right: 1rem;
369
+ padding-left: 1rem;
370
+ }
371
+ .popover {
372
+ .popover-menu__btn {
373
+ width: 24px;
374
+ height: 24px;
375
+ ${MediaQueries.mbDown} {
376
+ width: 18px;
377
+ height: 18px;
378
+ }
379
+ }
380
+ .popover-menu__content {
381
+ &.--position-bottom {
382
+ &.--align-end {
383
+ &::before {
384
+ right: 1rem;
385
+ }
386
+ width: 350px;
387
+ ${MediaQueries.mbDown} {
388
+ max-width: calc(320px - 2rem);
389
+ }
390
+ }
391
+ }
392
+ }
393
+ }
394
+ .most-engaging-wrapper {
395
+ position: relative;
396
+ padding: 0;
397
+ &::before {
398
+ position: absolute;
399
+ z-index: 5;
400
+ top: 0;
401
+ left: 50%;
402
+ width: calc(100% - 2rem);
403
+ height: 1px;
404
+ background: #f3f3f3;
405
+ content: ' ';
406
+ transform: translateX(-50%);
407
+ }
408
+ }
409
+ ${MediaQueries.mbDown} {
410
+ margin-bottom: 12px;
411
+ }
412
+ }
413
+ `;
414
+
415
+ var img$1 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='17' fill='none'%3e%3cg stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' clip-path='url(%23a)'%3e%3cpath d='M2 4.008h12m-8.667 0V2.675a1.333 1.333 0 0 1 1.334-1.333h2.666a1.333 1.333 0 0 1 1.334 1.333v1.333m2 0v9.334a1.333 1.333 0 0 1-1.334 1.333H4.667a1.333 1.333 0 0 1-1.334-1.333V4.008zm-6 3.334v4m2.666-4v4'/%3e%3c/g%3e%3cdefs%3e%3cclipPath id='a'%3e%3cpath fill='white' d='M0 .008h16v16H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
416
+ var IconDelete = img$1;
417
+
418
+ const CardReplyPopover = ({ onDeleteComment, commentId, className = '', popoverClassName = '', }) => {
419
+ const { data: { env: { isMarryBaby }, locale, }, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
420
+ const { t } = useTranslations();
421
+ const [isOpenLeavePopup, setIsOpenLeavePopup] = useState(false);
422
+ const { authActionWrapper } = useTogetherAuthRequiredAction();
423
+ return (React__default.createElement("div", { className: className, onClick: (e) => {
424
+ e.preventDefault();
425
+ e.stopPropagation();
426
+ } },
427
+ isOpenLeavePopup && (React__default.createElement(PopupDanger, { thumbnail: IconDelete, isThumbnailIcon: true, title: t('popup.deleteComment.title'), description: t('popup.deleteComment.description'), acceptText: t('popup.deletePost.accept'), cancelText: t('popup.deletePost.cancel'), onAccept: () => __awaiter(void 0, void 0, void 0, function* () {
428
+ var _a;
429
+ if (!commentId)
430
+ return;
431
+ const res = yield deleteComment({ id: commentId, locale });
432
+ if ((res === null || res === void 0 ? void 0 : res.status) === 1) {
433
+ onDeleteComment && onDeleteComment();
434
+ pushNotifications({
435
+ title: '',
436
+ message: t('notification.success'),
437
+ type: 'success',
438
+ });
439
+ }
440
+ else {
441
+ pushNotifications({
442
+ title: '',
443
+ message: ((_a = res === null || res === void 0 ? void 0 : res.messages) === null || _a === void 0 ? void 0 : _a[0]) || t('notification.failure'),
444
+ type: 'danger',
445
+ });
446
+ }
447
+ }), onClose: () => setIsOpenLeavePopup(false) })),
448
+ React__default.createElement(TreePopoverMenu, { position: "bottom", align: "end", data: {
449
+ isShowheader: false,
450
+ type: 'list',
451
+ list: [
452
+ // {
453
+ // icon: _href('/svg/icon-share-on-media.svg'),
454
+ // label: f({ id: 'morePopover.share' }),
455
+ // subTree: {
456
+ // title: f({ id: 'morePopover.shareOn' }),
457
+ // isShowheader: true,
458
+ // type: 'jsx',
459
+ // jsxType: TreeJSXType.share,
460
+ // data: {
461
+ // shareUrl: shareUrl,
462
+ // shareTitle: shareTitle,
463
+ // },
464
+ // },
465
+ // },
466
+ // {
467
+ // icon: _href('/svg/icon-tab-edit-2.svg'),
468
+ // label: f({ id: 'actionPopover.edit' }),
469
+ // onClick: onEditPost,
470
+ // },
471
+ {
472
+ icon: IconTrashBin,
473
+ label: t('actionPopover.delete'),
474
+ onClick: () => {
475
+ authActionWrapper(() => {
476
+ setIsOpenLeavePopup(true);
477
+ });
478
+ },
479
+ },
480
+ ],
481
+ }, className: popoverClassName, toggleButtonContent: React__default.createElement("img", { src: isMarryBaby ? MBMoreSolid : IconKebab, loading: "lazy" }), buttonProps: {
482
+ // isLoading: loading,
483
+ } })));
484
+ };
485
+
486
+ const StyledContainer$1 = styled.div `
487
+ .add-link {
488
+ color: ${theme.colors.primaryBase};
489
+ }
490
+ `;
491
+ const StyledAlertTag = styled.div `
492
+ margin: 16px 0;
493
+ background: ${theme.colors.yellow50};
494
+ padding: 5px 10px;
495
+ border-radius: 2px;
496
+
497
+ .icon {
498
+ display: inline-block;
499
+ vertical-align: middle;
500
+ margin-right: 6px;
501
+ }
502
+ `;
503
+ const StyledSourceItemWrapper = styled.div `
504
+ display: flex;
505
+ align-items: center;
506
+ gap: 8px;
507
+ `;
508
+ const StyledListItems$1 = styled.div `
509
+ padding: 8px 16px;
510
+ `;
511
+ const StyledInputWrapper = styled.div `
512
+ margin-bottom: 12px;
513
+ width: 100%;
514
+ `;
515
+
516
+ const StyledContainer = styled.div ``;
517
+ const StyledHeader = styled.div `
518
+ margin-bottom: 16px;
519
+ `;
520
+ const StyledListItems = styled.div `
521
+ display: flex;
522
+ flex-wrap: wrap;
523
+ row-gap: 16px;
524
+ ${MediaQueries.tdUp} {
525
+ align-items: center;
526
+ column-gap: 24px;
527
+ }
528
+ `;
529
+ const StyledItem$1 = styled.a `
530
+ display: flex;
531
+ align-items: center;
532
+ gap: 16px;
533
+ ${MediaQueries.mbDown} {
534
+ width: 100%;
535
+ justify-content: space-between;
536
+ }
537
+ `;
538
+ const StyledItemInfo = styled.div `
539
+ display: flex;
540
+ align-items: center;
541
+ gap: 16px;
542
+ `;
543
+ const StyledThumb = styled.div `
544
+ border-radius: ${theme.borderRadius};
545
+ overflow: hidden;
546
+ width: 48px;
547
+ height: 48px;
548
+ img {
549
+ object-fit: cover;
550
+ width: 100%;
551
+ height: 100%;
552
+ }
553
+ `;
554
+
555
+ const RecommentCategories = ({ categories }) => {
556
+ const { t } = useTranslations();
557
+ const { data: { locale, env: { isMarryBaby }, }, } = useContext(TogetherComponentGlobalContext);
558
+ const url = getCurrentBaseUrl(locale, isMarryBaby);
559
+ return (React__default.createElement(StyledContainer, null,
560
+ React__default.createElement(StyledHeader, null,
561
+ React__default.createElement(Heading, { tag: "h6", as: "h5" }, t('cardReply.recommentCategories.heading'))),
562
+ React__default.createElement(StyledListItems, null, categories.map((i) => (React__default.createElement(StyledItem$1, { href: url + i.permalink, key: String(i.termId), target: "_blank" },
563
+ React__default.createElement(StyledItemInfo, null,
564
+ React__default.createElement(StyledThumb, null,
565
+ React__default.createElement("img", { src: i.featureImage ||
566
+ CommonGAssets.getAssetPath(isMarryBaby ? 'mb-logo.svg' : '/logo/logomark.png'), alt: i.displayName, loading: "lazy" })),
567
+ React__default.createElement(Text, { size: "s3", weight: "bold" }, i.displayName)),
568
+ React__default.createElement(ArrowRight, { size: 20, color: theme.colors.gray400 })))))));
569
+ };
570
+
571
+ const StyledItem = styled.a `
572
+ padding: 12px 0;
573
+ display: flex;
574
+ flex-direction: column;
575
+ gap: 8px;
576
+ border-top: 1px solid ${theme.colors.neutral100};
577
+ text-decoration: none;
578
+
579
+ &:first-child {
580
+ border-top: 0;
581
+ }
582
+ `;
583
+
584
+ const SourceItem = ({ postTitle, articleReviewed, modifiedTime, href, }) => {
585
+ const { t } = useTranslations();
586
+ const getDetail = (() => {
587
+ const { expert, editor, is_author } = articleReviewed;
588
+ if (expert) {
589
+ const result = {
590
+ name: expert.display_name,
591
+ role: 'expert',
592
+ avatar: expert.avatar,
593
+ };
594
+ if (is_author) {
595
+ return Object.assign({ title: t('articleAuthor.title.written-by') }, result);
596
+ }
597
+ else {
598
+ if (expert.role === 'expert') {
599
+ // Is Expert
600
+ return Object.assign({ title: t('articleAuthor.title.expert') }, result);
601
+ }
602
+ else {
603
+ // Is medical
604
+ return Object.assign({ title: t('articleAuthor.title.medical') }, result);
605
+ }
606
+ }
607
+ }
608
+ else if (editor) {
609
+ return {
610
+ title: t('articleAuthor.title.fact-check'),
611
+ name: editor.display_name,
612
+ avatar: editor.avatar,
613
+ };
614
+ }
615
+ })();
616
+ return (React__default.createElement(StyledItem, { href: href, title: postTitle, target: "_blank" },
617
+ React__default.createElement(Text, { size: "s3", as: "h5", weight: "bold" }, postTitle),
618
+ React__default.createElement("div", null,
619
+ React__default.createElement(CardAuthor, { avatar: getDetail === null || getDetail === void 0 ? void 0 : getDetail.avatar, avatarProps: {
620
+ size: 32,
621
+ }, name: getDetail === null || getDetail === void 0 ? void 0 : getDetail.name, role: getDetail === null || getDetail === void 0 ? void 0 : getDetail.role, hideBackground: true },
622
+ React__default.createElement(CardAuthor.SubTextRow, null,
623
+ React__default.createElement(CardAuthor.SubText, null, getDetail === null || getDetail === void 0 ? void 0 :
624
+ getDetail.title,
625
+ ' ',
626
+ React__default.createElement("span", { style: { color: theme.colors.gray800 } }, getDetail === null || getDetail === void 0 ? void 0 : getDetail.name)),
627
+ React__default.createElement(CardAuthor.SubDivider, null),
628
+ React__default.createElement(CardAuthor.SubText, null, modifiedTime))))));
629
+ };
630
+
631
+ var styles$1 = {"accordion":"CnNZq8D","header":"F4mmgSy","heading":"_8jLruY3","headingIcon":"FE8w-fe","panel":"Yd2a9Nj","chevron":"A7QrQ7A"};
632
+
633
+ const SourceList = (_a) => {
634
+ var { listUrl: listUrlInit, hideSourceList, categorySlug, editMode, collapseSource, onListChange, isMarryBaby } = _a, rest = __rest(_a, ["listUrl", "hideSourceList", "categorySlug", "editMode", "collapseSource", "onListChange", "isMarryBaby"]);
635
+ const { t } = useTranslations();
636
+ const [listUrl, setListUrl] = useState(listUrlInit || []);
637
+ const [data, setData] = useState([]);
638
+ const [categories, setCategories] = useState([]);
639
+ const [loading, setLoading] = useState(false);
640
+ useEffect(() => {
641
+ !hideSourceList &&
642
+ (() => __awaiter(void 0, void 0, void 0, function* () {
643
+ setLoading(true);
644
+ const listPaths = listUrl.map((i) => {
645
+ const url = new URL(i);
646
+ const pathArr = String(url.pathname)
647
+ .split('/')
648
+ .filter((i) => i != '');
649
+ const origin = url.origin;
650
+ const isMarrySite = origin.search('marrybaby.vn') !== -1;
651
+ return {
652
+ isMarrySite,
653
+ path: pathArr[pathArr.length - 1],
654
+ href: i,
655
+ };
656
+ });
657
+ const listApi = [
658
+ ...listPaths.map((i) => callApi(i.isMarrySite
659
+ ? getMarryBabyApiPath(DISCOVER_PATHS.GET_PREVIEW_ARTICLE, {
660
+ fullSlug: i.path,
661
+ }, true)
662
+ : getDiscoverApiPath(DISCOVER_PATHS.GET_PREVIEW_ARTICLE, {
663
+ fullSlug: i.path,
664
+ }, true), 'GET')),
665
+ ];
666
+ const res = yield Promise.all(listApi);
667
+ setData(res
668
+ .map((i, index) => {
669
+ var _a, _b;
670
+ return ((_a = i === null || i === void 0 ? void 0 : i.data) === null || _a === void 0 ? void 0 : _a.post) && Object.assign(Object.assign({}, formatArticle((_b = i === null || i === void 0 ? void 0 : i.data) === null || _b === void 0 ? void 0 : _b.post)), { href: listPaths[index].href });
671
+ })
672
+ .filter(Boolean));
673
+ setLoading(false);
674
+ }))();
675
+ }, []);
676
+ useEffect(() => {
677
+ !hideSourceList &&
678
+ (data === null || data === void 0 ? void 0 : data.length) === 0 &&
679
+ categorySlug &&
680
+ (() => __awaiter(void 0, void 0, void 0, function* () {
681
+ var _a;
682
+ const res = yield callApi(isMarryBaby
683
+ ? getMarryBabyApiPath(DISCOVER_PATHS.GET_CATEGORY_OR_ARTICLE_DETAIL, {
684
+ fullSlug: categorySlug,
685
+ }, true)
686
+ : getDiscoverApiPath(DISCOVER_PATHS.GET_CATEGORY_OR_ARTICLE_DETAIL, {
687
+ fullSlug: categorySlug,
688
+ }, true), 'GET');
689
+ (res === null || res === void 0 ? void 0 : res.data) && setCategories([formatCategory((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.category)]);
690
+ }))();
691
+ }, [data]);
692
+ const handleRemoveItem = (idx) => {
693
+ setListUrl((old) => {
694
+ const tmp = [...old];
695
+ tmp.splice(idx, 1);
696
+ return tmp;
697
+ });
698
+ setData((old) => {
699
+ const tmp = [...old];
700
+ tmp.splice(idx, 1);
701
+ return tmp;
702
+ });
703
+ };
704
+ useEffect(() => {
705
+ onListChange === null || onListChange === void 0 ? void 0 : onListChange(listUrl);
706
+ }, [listUrl]);
707
+ return (React__default.createElement("div", Object.assign({}, rest),
708
+ !editMode && (React__default.createElement(StyledAlertTag, null,
709
+ React__default.createElement("img", { className: "icon", src: CommonGAssets.getAssetPath('warning.svg'), alt: "warning", style: { marginBottom: '3px', width: '18px' }, loading: "lazy" }),
710
+ React__default.createElement(Text, { size: "s3", as: "span", dangerouslySetInnerHTML: {
711
+ __html: t('cardReply.disclaimer'),
712
+ } }))),
713
+ !hideSourceList ? (loading ? (React__default.createElement(Loading, null)) : data.length > 0 || editMode ? (React__default.createElement(StyledContainer$1, null,
714
+ React__default.createElement(Accordion, { defaultValue: !collapseSource && 'accordion', styles: {
715
+ control: {
716
+ borderRadius: 'inherit',
717
+ '&[aria-expanded="false"]': {
718
+ borderBottom: 0,
719
+ },
720
+ },
721
+ chevron: {
722
+ width: '32px',
723
+ height: '32px',
724
+ },
725
+ content: {
726
+ padding: 0,
727
+ borderBottom: 0,
728
+ borderTop: `1px solid ${theme.colors.neutral100}`,
729
+ },
730
+ item: {
731
+ marginBottom: '16px',
732
+ borderTopLeftRadius: '8px',
733
+ borderTopRightRadius: '8px',
734
+ border: `1px solid ${theme.colors.neutral100}`,
735
+ borderBottomLeftRadius: '8px',
736
+ borderBottomRightRadius: '8px',
737
+ '&[data-active]': {
738
+ borderBottomLeftRadius: 0,
739
+ borderBottomRightRadius: 0,
740
+ },
741
+ },
742
+ }, chevron: React__default.createElement("div", { className: styles$1.chevron },
743
+ React__default.createElement(ArrowDown, { color: theme.colors.gray600, size: 20 })) },
744
+ React__default.createElement(Accordion.Item, { value: "accordion" },
745
+ React__default.createElement(Accordion.Control, null,
746
+ React__default.createElement("div", { className: styles$1.header },
747
+ React__default.createElement(Heading, { as: "h4", tag: "h6" }, t('cardReply.source')))),
748
+ React__default.createElement(Accordion.Panel, null,
749
+ React__default.createElement(StyledListItems$1, null,
750
+ (data || []).map((i, idx) => (React__default.createElement(StyledSourceItemWrapper, { key: String(idx) },
751
+ typeof i === 'object' ? (React__default.createElement(SourceItem, Object.assign({}, i))) : (React__default.createElement(StyledInputWrapper, null,
752
+ React__default.createElement(Input, { style: { width: '100%' }, name: "source-list", value: i || '', size: "sm", onChange: (v) => {
753
+ setListUrl((old) => {
754
+ const tmp = [...old];
755
+ tmp[idx] = v;
756
+ return tmp;
757
+ });
758
+ setData((old) => {
759
+ const tmp = [...old];
760
+ tmp[idx] = v;
761
+ return tmp;
762
+ });
763
+ } }))),
764
+ editMode && (React__default.createElement(Button, { size: "md", color: "transparent", icon: React__default.createElement(Trash, null), onClick: () => handleRemoveItem(idx) }))))),
765
+ editMode && (React__default.createElement(Button, { className: "add-link", color: "transparent", size: "md", icon: React__default.createElement(Plus, { color: theme.colors.primaryBase, size: 18 }), onClick: () => {
766
+ setListUrl((old) => [...old, '']);
767
+ setData((old) => [...old, '']);
768
+ } }, "Add source")))))))) : (React__default.createElement(RecommentCategories, { categories: categories }))) : null));
769
+ };
770
+
771
+ const StyledCardPost = styled.div `
772
+ position: relative;
773
+ margin-bottom: 0;
774
+ background: white;
775
+ border-radius: ${theme.borderRadius};
776
+
777
+ .verify-tag {
778
+ margin-top: 12px;
779
+ }
780
+
781
+ .post-author {
782
+ &.with-popover {
783
+ padding-right: 2.6rem;
784
+ }
785
+ .author-avatar-wrapper {
786
+ width: 40px;
787
+ height: 40px;
788
+ font-size: 20px;
789
+ ${MediaQueries.mbDown} {
790
+ width: 32px;
791
+ height: 32px;
792
+ font-size: 16px;
793
+ }
794
+ }
795
+ }
796
+ .image-preview-wrapper,
797
+ .link-preview-wrapper {
798
+ width: 100%;
799
+ &[data-is-reply='true'] {
800
+ padding-right: 1rem;
801
+ padding-left: 1rem;
802
+ }
803
+ }
804
+ .post-reaction {
805
+ background: none;
806
+ border-radius: 0 0 6px 6px;
807
+ }
808
+ &[data-is-reply='true'] {
809
+ > .post-author .author-avatar-wrapper {
810
+ width: 20px;
811
+ height: 20px;
812
+ font-size: 10px;
813
+ }
814
+ }
815
+ &[data-is-reply='false'] {
816
+ border: 1px solid #e4e8ec;
817
+ }
818
+ .expert-wrapper {
819
+ width: 100%;
820
+ }
821
+ &[data-has-booking='true'] {
822
+ display: grid;
823
+ .post-author {
824
+ background-color: ${theme.colors.primary50};
825
+ }
826
+ .btn-wrapper {
827
+ padding: 0 16px;
828
+ .btn-booking {
829
+ width: 100%;
830
+ margin: 12px 0;
831
+ }
832
+ }
833
+ }
834
+
835
+ .comment-reply-wrapper {
836
+ padding: 0 1rem;
837
+ .more-cmt {
838
+ .chevron-right {
839
+ height: 1rem;
840
+ width: 1rem;
841
+ vertical-align: middle;
842
+ }
843
+ }
844
+ }
845
+ .top-divider {
846
+ border-color: #e4e8ec;
847
+ }
848
+ .popover {
849
+ position: absolute;
850
+ top: 1.5rem;
851
+ right: 1rem;
852
+ .popover-menu__btn {
853
+ display: flex;
854
+ width: 1rem;
855
+ height: 1rem;
856
+ align-items: center;
857
+ justify-content: center;
858
+ padding: 0;
859
+ background: transparent;
860
+
861
+ &:hover {
862
+ background-color: transparent;
863
+ }
864
+
865
+ .popover-menu__content {
866
+ &.--position-bottom {
867
+ &.--align-end {
868
+ &::before {
869
+ right: 12.5px;
870
+ }
871
+ }
872
+ }
873
+ }
874
+ }
875
+ }
876
+
877
+ &[data-is-marrybaby='true'] {
878
+ &[data-is-reply='false'] {
879
+ border: none;
880
+ }
881
+ .image-preview-wrapper,
882
+ .link-preview-wrapper {
883
+ padding-right: 1rem;
884
+ padding-left: 1rem;
885
+ }
886
+ .popover {
887
+ .popover-menu__btn {
888
+ width: 24px;
889
+ height: 24px;
890
+ }
891
+ }
892
+
893
+ margin-left: 56px;
894
+ ${MediaQueries.mbDown} {
895
+ margin-left: 40px;
896
+ }
897
+ > .post-author {
898
+ margin-left: -56px;
899
+ ${MediaQueries.mbDown} {
900
+ margin-left: -40px;
901
+ }
902
+ .author-info {
903
+ align-items: center;
904
+ display: flex;
905
+ align-items: center;
906
+ .author-info-top {
907
+ width: 100%;
908
+ }
909
+ .author-info-text-wrapper {
910
+ justify-content: space-between;
911
+ }
912
+ }
913
+ .author-avatar-wrapper {
914
+ width: 40px;
915
+ height: 40px;
916
+ font-size: 20px;
917
+ ${MediaQueries.mbDown} {
918
+ width: 24px;
919
+ height: 24px;
920
+ font-size: 12px;
921
+ }
922
+ }
923
+ }
924
+ &[data-is-reply] {
925
+ > .post-author {
926
+ .author-avatar-wrapper {
927
+ width: 40px;
928
+ height: 40px;
929
+ font-size: 20px;
930
+ ${MediaQueries.mbDown} {
931
+ width: 24px;
932
+ height: 24px;
933
+ font-size: 12px;
934
+ }
935
+ }
936
+ }
937
+ }
938
+
939
+ .comment-reply-wrapper {
940
+ padding-right: 0;
941
+ padding-left: 0;
942
+ }
943
+ .post-reaction {
944
+ &::after {
945
+ position: absolute;
946
+ bottom: 0;
947
+ left: 50%;
948
+ width: calc(100% - 2rem);
949
+ height: 1px;
950
+ background: #f3f3f3;
951
+ content: ' ';
952
+ transform: translateX(-50%);
953
+ }
954
+ }
955
+ .post-content-wrapper {
956
+ padding-top: 0;
957
+ padding-bottom: 0;
958
+ ${MediaQueries.mbDown} {
959
+ padding-left: 0.5rem;
960
+ }
961
+ }
962
+
963
+ ${MediaQueries.mbDown} {
964
+ margin-bottom: 12px;
965
+ }
966
+ }
967
+ `;
968
+ const StyledSourceList = styled(SourceList) `
969
+ margin-top: 12px;
970
+ padding: 0.5rem 1rem 1rem;
971
+ `;
972
+
973
+ var styles = {"button":"-dzIuHr"};
974
+
975
+ const VerifiedTag = ({ userId, avatar, name, role, title, className, }) => {
976
+ const { t } = useTranslations();
977
+ const [openPopup, setOpenPopup] = useState(false);
978
+ return (React__default.createElement(React__default.Fragment, null,
979
+ React__default.createElement(Button, { className: `${styles.button} ${className}`, color: "success", size: "xs", onClick: () => setOpenPopup(true), style: {
980
+ padding: '5px 8px',
981
+ marginBottom: '12px',
982
+ borderRadius: '4px',
983
+ } },
984
+ React__default.createElement("span", { className: "text" },
985
+ React__default.createElement(Endorse, { isSolid: true, size: 18, color: theme.colors.green800, className: "icon" }),
986
+ t('cardReply.verifyBy', {
987
+ name: `${name || ''}`,
988
+ }))),
989
+ React__default.createElement(ProfileDetailModal, { open: openPopup, onClose: () => setOpenPopup(false), profileModalProps: { zIndex: 1000 } },
990
+ React__default.createElement(ProfileDetail, { authorProps: {
991
+ userId,
992
+ avatar: avatar,
993
+ name,
994
+ role,
995
+ title,
996
+ }, hideQuestionTab: true }))));
997
+ };
998
+
999
+ var img = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%232D87F3' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 12 4-4-4-4'/%3e%3c/svg%3e";
1000
+ var ChevronRightActive = img;
1001
+
1002
+ const COMMENT_LIMIT = 4;
1003
+ const CardReply = ({ className, style, comment: CommentProps, type = 'comment', level = 0, replyingId, onPostCommentSuccess, post, onDeleteComment, refetchComment, hasQuickBookingEnable, handleMakeAppointment, cardAuthorProps, maxChars = 600, disableShortenContent, }) => {
1004
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1005
+ const { data: { locale, userInfo, env: { isMarryBaby }, }, } = useContext(TogetherComponentGlobalContext);
1006
+ const { t } = useTranslations();
1007
+ const [comment, setComment] = useState(CommentProps || null);
1008
+ const { id, countLikes, content, replies = [], images = [], author, liked, link, mentionedUser, mentions, } = comment;
1009
+ const { text, replyingTo } = decodeCommentBody(content);
1010
+ const { authActionWrapper } = useTogetherAuthRequiredAction({
1011
+ _joinCommunityIds: [(_a = post === null || post === void 0 ? void 0 : post.community) === null || _a === void 0 ? void 0 : _a.id],
1012
+ _joinTopicIds: (_b = post === null || post === void 0 ? void 0 : post.topics) === null || _b === void 0 ? void 0 : _b.map((t) => t.id),
1013
+ });
1014
+ const [maxRepliesShow, setMaxRepliesShow] = useState(COMMENT_LIMIT);
1015
+ const isCommented = (userInfo === null || userInfo === void 0 ? void 0 : userInfo.id)
1016
+ ? replies === null || replies === void 0 ? void 0 : replies.some((c) => c.author.id === userInfo.id)
1017
+ : false;
1018
+ const addNewReply = (comment) => {
1019
+ setComment((old) => {
1020
+ // somehow this set state run twice
1021
+ // => we need to check unique comment id before add to array
1022
+ if (!old.replies.find((c) => c.id === comment.id)) {
1023
+ old.replies.unshift(comment);
1024
+ const newComment = Object.assign(Object.assign({}, old), { replies: old.replies.slice(), countReplies: old.countReplies + 1 });
1025
+ refetchComment && refetchComment(newComment);
1026
+ return newComment;
1027
+ }
1028
+ return old;
1029
+ });
1030
+ };
1031
+ const [showInputComment, setShowInputComment] = useState(false);
1032
+ const sortedReplies = useMemo(() => {
1033
+ if (type !== 'comment' || !replies || replies.length == 0)
1034
+ return replies;
1035
+ return replies.sort((a, b) => {
1036
+ const timeA = new Date(a.createdAt).getTime();
1037
+ const timeB = new Date(b.createdAt).getTime();
1038
+ if (timeA > timeB)
1039
+ return -1;
1040
+ if (timeA < timeB)
1041
+ return 1;
1042
+ return 0;
1043
+ });
1044
+ }, [type, replies]);
1045
+ const mergeCountReplies = (replies === null || replies === void 0 ? void 0 : replies.length) || 0;
1046
+ const hasPopover = String(author === null || author === void 0 ? void 0 : author.email) &&
1047
+ (userInfo === null || userInfo === void 0 ? void 0 : userInfo.email) &&
1048
+ String(author === null || author === void 0 ? void 0 : author.email) === String(userInfo === null || userInfo === void 0 ? void 0 : userInfo.email);
1049
+ // const isAnonymousOfCurAuthor =
1050
+ // post?.isAnonymous && post?.author?.username === author?.username
1051
+ // const name = isAnonymousOfCurAuthor
1052
+ // ? t('cardPost.anonymous')
1053
+ // : author?.name || author?.username || ''
1054
+ // const avatar = isAnonymousOfCurAuthor ? DEFAULT_AVATAR_IMG : author?.avatar
1055
+ // const username = isAnonymousOfCurAuthor
1056
+ // ? t('cardPost.anonymous')
1057
+ // : author?.username || author?.name || ''
1058
+ const name = (author === null || author === void 0 ? void 0 : author.name) || (author === null || author === void 0 ? void 0 : author.username) || '';
1059
+ const username = (author === null || author === void 0 ? void 0 : author.username) || (author === null || author === void 0 ? void 0 : author.name) || '';
1060
+ const avatar = author === null || author === void 0 ? void 0 : author.avatar;
1061
+ const authorRole = (post === null || post === void 0 ? void 0 : post.isAnonymous) ? undefined : author === null || author === void 0 ? void 0 : author.role;
1062
+ const listMentions = [
1063
+ ...((post === null || post === void 0 ? void 0 : post.isAnonymous)
1064
+ ? [
1065
+ {
1066
+ id: ((_c = post === null || post === void 0 ? void 0 : post.author) === null || _c === void 0 ? void 0 : _c.id) || 0,
1067
+ name: t('cardPost.anonymous'),
1068
+ },
1069
+ ]
1070
+ : []),
1071
+ ...(mentions || []),
1072
+ ];
1073
+ const [hospitalInfo, setHospitalInfo] = useState(null);
1074
+ const [doctorInfo, setDoctorInfo] = useState(null);
1075
+ useEffect(() => {
1076
+ if (author === null || author === void 0 ? void 0 : author.hospitalId) {
1077
+ const fetchHospitalDetail = (hospitalId) => __awaiter(void 0, void 0, void 0, function* () {
1078
+ var _a;
1079
+ const response = yield callApi(getCarePath(CARE_PATHS.GET_HOSPITAL_INFO, {
1080
+ hospital_branch_id: hospitalId,
1081
+ website_url: domainLocales[locale],
1082
+ }), 'get');
1083
+ if ((_a = response === null || response === void 0 ? void 0 : response._data) === null || _a === void 0 ? void 0 : _a.branch) {
1084
+ setHospitalInfo(response === null || response === void 0 ? void 0 : response._data.branch);
1085
+ }
1086
+ });
1087
+ fetchHospitalDetail(author.hospitalId);
1088
+ }
1089
+ if (author === null || author === void 0 ? void 0 : author.doctorId) {
1090
+ const fetchDoctorDetail = (doctorId) => __awaiter(void 0, void 0, void 0, function* () {
1091
+ var _b;
1092
+ const response = yield callApi(getCarePath(CARE_PATHS.GET_DOCTOR_INFO, {
1093
+ doctorId: doctorId,
1094
+ website_url: domainLocales[locale],
1095
+ }), 'get');
1096
+ if ((_b = response === null || response === void 0 ? void 0 : response._data) === null || _b === void 0 ? void 0 : _b.doctor) {
1097
+ setDoctorInfo(response === null || response === void 0 ? void 0 : response._data.doctor);
1098
+ }
1099
+ });
1100
+ fetchDoctorDetail(author.doctorId);
1101
+ }
1102
+ }, [author.hospitalId, author.doctorId]);
1103
+ const isDoctorAvailable = (doctorInfo === null || doctorInfo === void 0 ? void 0 : doctorInfo.valid_outpatient) || (doctorInfo === null || doctorInfo === void 0 ? void 0 : doctorInfo.valid_telemedicine);
1104
+ const isHospitalAvailable = ((hospitalInfo === null || hospitalInfo === void 0 ? void 0 : hospitalInfo.total_available_service) ||
1105
+ (hospitalInfo === null || hospitalInfo === void 0 ? void 0 : hospitalInfo.total_available_doctor)) > 0;
1106
+ const hasQuickBooking = hasQuickBookingEnable && (isDoctorAvailable || isHospitalAvailable);
1107
+ const isChatbotAuthor = ((_d = comment === null || comment === void 0 ? void 0 : comment.author) === null || _d === void 0 ? void 0 : _d.type) === 'chatbot';
1108
+ return (React__default.createElement(TogetherAuthConfigContextProvider, { defaultParams: {
1109
+ _joinCommunityIds: [(_e = post === null || post === void 0 ? void 0 : post.community) === null || _e === void 0 ? void 0 : _e.id],
1110
+ _joinTopicIds: (_f = post === null || post === void 0 ? void 0 : post.topics) === null || _f === void 0 ? void 0 : _f.map((t) => t.id),
1111
+ } },
1112
+ React__default.createElement(StyledCardPost, { className: className, style: style, "data-is-reply": !!level, "data-is-marrybaby": isMarryBaby, "data-has-booking": hasQuickBooking },
1113
+ type === 'reply' && React__default.createElement(Divider, { className: "top-divider", type: "solid" }),
1114
+ React__default.createElement("div", { style: { padding: '16px 16px 0' } },
1115
+ React__default.createElement(CardAuthor, Object.assign({ avatar: avatar, name: name, username: username, timeText: post === null || post === void 0 ? void 0 : post.createdTime, community: post === null || post === void 0 ? void 0 : post.community,
1116
+ // miniIcon="./svg/icon-tag.svg"
1117
+ // authorLabelType={getAuthorLabelFromRoles(author?.role || [])}
1118
+ className: `post-author ${hasPopover ? 'with-popover' : ''}`, type: type, userId: author === null || author === void 0 ? void 0 : author.id, role: authorRole, expertId: author === null || author === void 0 ? void 0 : author.partnerId, title: author === null || author === void 0 ? void 0 : author.title, doctorId: author === null || author === void 0 ? void 0 : author.doctorId, hospitalId: author === null || author === void 0 ? void 0 : author.hospitalId, hasQuickBooking: hasQuickBooking, handleMakeAppointment: handleMakeAppointment, isAnonymous: (comment === null || comment === void 0 ? void 0 : comment.isAnonymous) ||
1119
+ (Boolean(post === null || post === void 0 ? void 0 : post.isAnonymous) &&
1120
+ ((_g = post === null || post === void 0 ? void 0 : post.author) === null || _g === void 0 ? void 0 : _g.username) === (author === null || author === void 0 ? void 0 : author.username)), hideBackground: isChatbotAuthor, userType: author === null || author === void 0 ? void 0 : author.type }, cardAuthorProps)),
1121
+ Boolean(comment === null || comment === void 0 ? void 0 : comment.isVerify) && !Boolean(comment === null || comment === void 0 ? void 0 : comment.isOppose) && (React__default.createElement(VerifiedTag, { title: (_h = comment === null || comment === void 0 ? void 0 : comment.userVerify) === null || _h === void 0 ? void 0 : _h.title, name: (_j = comment === null || comment === void 0 ? void 0 : comment.userVerify) === null || _j === void 0 ? void 0 : _j.name, userId: (_k = comment === null || comment === void 0 ? void 0 : comment.userVerify) === null || _k === void 0 ? void 0 : _k.id, role: (_l = comment === null || comment === void 0 ? void 0 : comment.userVerify) === null || _l === void 0 ? void 0 : _l.role, avatar: (_m = comment === null || comment === void 0 ? void 0 : comment.userVerify) === null || _m === void 0 ? void 0 : _m.avatar, className: "verify-tag" }))),
1122
+ React__default.createElement(PostContent, { className: "post-content-wrapper", replyingTo: replyingTo, mentionedUser: mentionedUser, description: text, mentions: listMentions, maxChars: maxChars, disableShortenContent: disableShortenContent }),
1123
+ React__default.createElement("span", null),
1124
+ React__default.createElement("span", null),
1125
+ images && images.length > 0 ? (React__default.createElement("div", { key: "image-preview", className: "image-preview-wrapper", "data-is-reply": true },
1126
+ React__default.createElement(PostImagePreview, { images: images, authorName: author === null || author === void 0 ? void 0 : author.username }))) : null,
1127
+ (!images || images.length === 0) && link ? (React__default.createElement("div", { key: "link-preview", className: "link-preview-wrapper", "data-is-reply": true },
1128
+ React__default.createElement(CardLink, { url: link }))) : null,
1129
+ type !== 'most-engaging' ? (React__default.createElement(React__default.Fragment, null,
1130
+ isChatbotAuthor && (React__default.createElement(StyledSourceList, { listUrl: comment === null || comment === void 0 ? void 0 : comment.source, categorySlug: comment === null || comment === void 0 ? void 0 : comment.categorySlug })),
1131
+ React__default.createElement(CardReactions, { type: CardReactionType.reply, loveCount: countLikes, replyCount: mergeCountReplies, className: "post-reaction", liked: liked, isReplied: isCommented, hideCommentIcon: type === 'reply' || isChatbotAuthor, hasShare: false, onCommentClick: () => authActionWrapper(() => setShowInputComment((v) => !v)), onCommentCountClick: () => authActionWrapper(() => {
1132
+ setShowInputComment(true);
1133
+ }), onLikeClick: () => authActionWrapper(() => __awaiter(void 0, void 0, void 0, function* () {
1134
+ if (id) {
1135
+ const res = yield likeUnlikeComment({
1136
+ commentId: id,
1137
+ setLike: !liked,
1138
+ locale,
1139
+ });
1140
+ if (res.status === 1) {
1141
+ setComment((old) => {
1142
+ return Object.assign(Object.assign({}, old), { liked: !liked, countLikes: old.countLikes + (!liked ? 1 : -1) });
1143
+ });
1144
+ }
1145
+ }
1146
+ })) }),
1147
+ showInputComment && (React__default.createElement(InputCommentBar, { replyingId: replyingId || comment.id, replyToName: name, isReply: true, onClose: () => setShowInputComment(false), onPostSuccess: (comment) => {
1148
+ if (type === 'reply') {
1149
+ onPostCommentSuccess && onPostCommentSuccess(comment);
1150
+ }
1151
+ else {
1152
+ addNewReply(comment);
1153
+ }
1154
+ }, post: post, replyingUser: author })),
1155
+ type === 'comment' && replies && replies.length > 0 ? (React__default.createElement("div", { className: "comment-reply-wrapper" }, (_o = sortedReplies === null || sortedReplies === void 0 ? void 0 : sortedReplies.slice(0, maxRepliesShow)) === null || _o === void 0 ? void 0 :
1156
+ _o.map((reply) => (React__default.createElement(CardReply, { key: reply.id, comment: reply, type: "reply", className: "comment-reply-item", level: level + 1, replyingId: id, onPostCommentSuccess: addNewReply, post: post, onDeleteComment: () => {
1157
+ setComment((old) => {
1158
+ return Object.assign(Object.assign({}, old), { replies: old.replies.filter((r) => r.id !== reply.id), countReplies: old.countReplies - 1 });
1159
+ });
1160
+ }, handleMakeAppointment: handleMakeAppointment, hasQuickBookingEnable: hasQuickBookingEnable }))),
1161
+ mergeCountReplies > maxRepliesShow && (React__default.createElement(React__default.Fragment, null,
1162
+ React__default.createElement(Divider, { className: "top-divider", type: "solid" }),
1163
+ React__default.createElement(Button, { className: "more-cmt", size: "lg", color: "ghost", onClick: () => setMaxRepliesShow((m) => m + COMMENT_LIMIT) },
1164
+ t('comment.seeMoreReplies', {
1165
+ count: mergeCountReplies - maxRepliesShow,
1166
+ }),
1167
+ React__default.createElement("img", { className: "chevron-right", src: ChevronRightActive, loading: "lazy" })))))) : null)) : null,
1168
+ hasPopover && (React__default.createElement(CardReplyPopover, { onDeleteComment: onDeleteComment, className: "popover", commentId: comment.id })))));
1169
+ };
1170
+
1171
+ const getMostEngagingComment = (postId, locale) => __awaiter(void 0, void 0, void 0, function* () {
1172
+ var _a, _b, _c;
1173
+ const commentsRes = yield callApiWithOptionalAuth(getApiPath(PATHS.COMMENT.LIST, {
1174
+ postId: postId,
1175
+ _locale: locale,
1176
+ sort: 'popularity',
1177
+ perPage: 1,
1178
+ withoutReply: 1,
1179
+ }), 'GET');
1180
+ return (_c = (_b = (_a = commentsRes === null || commentsRes === void 0 ? void 0 : commentsRes.data) === null || _a === void 0 ? void 0 : _a.comments) === null || _b === void 0 ? void 0 : _b.map(formatComment)) === null || _c === void 0 ? void 0 : _c[0];
1181
+ });
1182
+ const CardPost = ({ className, style, hideViewMoreComment, showMostEngaging, onCommentClick, onCommentCountClick, onMostEngagingCommentClick, onPostCommentSuccess: onPostCommentSuccessProp, disableCardLink, disableShortenContent, onDeletePost, onEditPost, post: postProp, mostEngagingComment: mostEngagingCommentProp, onDeleteComment: onDeleteCommentProp, showInputComment: propsShowInputComment, InlineCommentsComponent, hasQuickBookingEnable, handleMakeAppointment, cardAuthorProps, }) => {
1183
+ const [post, setPost] = useState(postProp);
1184
+ const [isOpenSharePopup, setIsOpenSharePopup] = useState(false);
1185
+ const [mostEngagingComment, setMostEngagingComment] = useState(mostEngagingCommentProp);
1186
+ const { community, topics, author, slug, isPin, liked, photos, mentions, title, description, previewUrl, likesCount, commentsCount, id, commented, } = post;
1187
+ const { data: { locale, env: { isMarryBaby, togetherBasePath }, }, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
1188
+ const { t } = useTranslations();
1189
+ const [showInputComment, setShowInputComment] = useState(propsShowInputComment);
1190
+ const postRelativeHref = `${togetherBasePath}/${(community === null || community === void 0 ? void 0 : community.slug) || '_'}/${slug || ''}`;
1191
+ const postHref = `${getCurrentBaseUrl$1(locale)}${postRelativeHref}`;
1192
+ const { authActionWrapper } = useTogetherAuthRequiredAction((community === null || community === void 0 ? void 0 : community.slug)
1193
+ ? {
1194
+ _joinCommunityIds: [community.id],
1195
+ _joinTopicIds: topics === null || topics === void 0 ? void 0 : topics.map((t) => t.id),
1196
+ // _location: postHref,
1197
+ }
1198
+ : undefined);
1199
+ const [isLikeLoading, setIsLikeLoading] = useState(false);
1200
+ useEffect(() => {
1201
+ setShowInputComment(propsShowInputComment);
1202
+ }, [propsShowInputComment]);
1203
+ const name = (author === null || author === void 0 ? void 0 : author.name) || (author === null || author === void 0 ? void 0 : author.username) || '';
1204
+ const username = (author === null || author === void 0 ? void 0 : author.username) || (author === null || author === void 0 ? void 0 : author.name) || '';
1205
+ const avatar = author === null || author === void 0 ? void 0 : author.avatar;
1206
+ const authorRole = (post === null || post === void 0 ? void 0 : post.isAnonymous) ? undefined : author === null || author === void 0 ? void 0 : author.role;
1207
+ const [hospitalInfo, setHospitalInfo] = useState(null);
1208
+ const [doctorInfo, setDoctorInfo] = useState(null);
1209
+ useEffect(() => {
1210
+ if (author === null || author === void 0 ? void 0 : author.hospitalId) {
1211
+ const fetchHospitalDetail = (hospitalId) => __awaiter(void 0, void 0, void 0, function* () {
1212
+ var _a;
1213
+ const response = yield callApi(getCarePath(CARE_PATHS.GET_HOSPITAL_INFO, {
1214
+ hospital_branch_id: hospitalId,
1215
+ website_url: domainLocales$1[locale],
1216
+ }), 'get');
1217
+ if ((_a = response === null || response === void 0 ? void 0 : response._data) === null || _a === void 0 ? void 0 : _a.branch) {
1218
+ setHospitalInfo(response === null || response === void 0 ? void 0 : response._data.branch);
1219
+ }
1220
+ });
1221
+ fetchHospitalDetail(author.hospitalId);
1222
+ }
1223
+ if (author === null || author === void 0 ? void 0 : author.doctorId) {
1224
+ const fetchDoctorDetail = (doctorId) => __awaiter(void 0, void 0, void 0, function* () {
1225
+ var _b;
1226
+ const response = yield callApi(getCarePath(CARE_PATHS.GET_DOCTOR_INFO, {
1227
+ doctorId: doctorId,
1228
+ website_url: domainLocales$1[locale],
1229
+ }), 'get');
1230
+ if ((_b = response === null || response === void 0 ? void 0 : response._data) === null || _b === void 0 ? void 0 : _b.doctor) {
1231
+ setDoctorInfo(response === null || response === void 0 ? void 0 : response._data.doctor);
1232
+ }
1233
+ });
1234
+ fetchDoctorDetail(author.doctorId);
1235
+ }
1236
+ }, [author.hospitalId, author.doctorId]);
1237
+ const isDoctorAvailable = (doctorInfo === null || doctorInfo === void 0 ? void 0 : doctorInfo.valid_outpatient) || (doctorInfo === null || doctorInfo === void 0 ? void 0 : doctorInfo.valid_telemedicine);
1238
+ const isHospitalAvailable = ((hospitalInfo === null || hospitalInfo === void 0 ? void 0 : hospitalInfo.total_available_service) ||
1239
+ (hospitalInfo === null || hospitalInfo === void 0 ? void 0 : hospitalInfo.total_available_doctor)) > 0;
1240
+ const hasQuickBooking = hasQuickBookingEnable && (isDoctorAvailable || isHospitalAvailable);
1241
+ useEffect(() => {
1242
+ (() => __awaiter(void 0, void 0, void 0, function* () {
1243
+ if (id &&
1244
+ commentsCount &&
1245
+ showMostEngaging &&
1246
+ !(mostEngagingCommentProp === null || mostEngagingCommentProp === void 0 ? void 0 : mostEngagingCommentProp.id)) {
1247
+ const comment = yield getMostEngagingComment(id, locale);
1248
+ setMostEngagingComment(comment);
1249
+ }
1250
+ }))();
1251
+ }, [id, locale, commentsCount, showMostEngaging, mostEngagingCommentProp === null || mostEngagingCommentProp === void 0 ? void 0 : mostEngagingCommentProp.id]);
1252
+ useEffect(() => {
1253
+ setMostEngagingComment(mostEngagingCommentProp);
1254
+ }, [mostEngagingCommentProp === null || mostEngagingCommentProp === void 0 ? void 0 : mostEngagingCommentProp.id]);
1255
+ const onPostCommentSuccess = (comment) => {
1256
+ if (commentsCount === 0 && !(mostEngagingComment === null || mostEngagingComment === void 0 ? void 0 : mostEngagingComment.id)) {
1257
+ setMostEngagingComment(comment);
1258
+ }
1259
+ setPost((p) => (Object.assign(Object.assign({}, p), { commentsCount: p.commentsCount + 1, commented: true })));
1260
+ onPostCommentSuccessProp && onPostCommentSuccessProp(comment);
1261
+ };
1262
+ const onDeleteComment = (comment) => __awaiter(void 0, void 0, void 0, function* () {
1263
+ if (commentsCount > 1 &&
1264
+ (mostEngagingComment === null || mostEngagingComment === void 0 ? void 0 : mostEngagingComment.id) &&
1265
+ (mostEngagingComment === null || mostEngagingComment === void 0 ? void 0 : mostEngagingComment.id) === (comment === null || comment === void 0 ? void 0 : comment.id)) {
1266
+ const newMostEngaging = yield getMostEngagingComment(id, locale);
1267
+ setMostEngagingComment(newMostEngaging);
1268
+ }
1269
+ setPost((p) => (Object.assign(Object.assign({}, p), { commentsCount: p.commentsCount - 1 })));
1270
+ onDeleteCommentProp && onDeleteCommentProp(comment);
1271
+ });
1272
+ return (React__default.createElement(TogetherAuthConfigContextProvider, { defaultParams: (community === null || community === void 0 ? void 0 : community.slug)
1273
+ ? {
1274
+ _joinCommunityIds: [community.id],
1275
+ _joinTopicIds: topics === null || topics === void 0 ? void 0 : topics.map((t) => t.id),
1276
+ // _location: postHref,
1277
+ }
1278
+ : undefined },
1279
+ isOpenSharePopup && (React__default.createElement(SharePopup, { url: postHref, avatar: DEFAULT_IMG, text: title, onClose: () => setIsOpenSharePopup(false) })),
1280
+ React__default.createElement(StyledCardPost$1, { className: className, style: style, "data-is-marrybaby": isMarryBaby },
1281
+ isPin ? React__default.createElement(LabelPin, { className: "post-pin" }) : null,
1282
+ React__default.createElement("div", { style: { position: 'relative', padding: '1rem 1rem 0' } },
1283
+ React__default.createElement(CardAuthor, Object.assign({ avatar: avatar, name: name, username: username, url: disableCardLink ? undefined : postRelativeHref, community: community,
1284
+ // miniIcon="./svg/icon-tag.svg"
1285
+ timeText: post === null || post === void 0 ? void 0 : post.createdTime, className: "post-author", role: authorRole, userId: author === null || author === void 0 ? void 0 : author.id, expertId: author === null || author === void 0 ? void 0 : author.partnerId, doctorId: author === null || author === void 0 ? void 0 : author.doctorId, hospitalId: author === null || author === void 0 ? void 0 : author.hospitalId, title: author === null || author === void 0 ? void 0 : author.title, hasQuickBooking: hasQuickBooking, handleMakeAppointment: handleMakeAppointment, "data-testid": "name", isAnonymous: !!(post === null || post === void 0 ? void 0 : post.isAnonymous), extendEle: React__default.createElement(CardPostPopoverMore, { authorEmail: String(author === null || author === void 0 ? void 0 : author.email), onDeletePost: onDeletePost, shareUrl: postHref, post: post, className: "popover", onEditPost: onEditPost }) }, cardAuthorProps))),
1286
+ React__default.createElement("a", { href: disableCardLink ? undefined : postRelativeHref, className: "post-content-link-wrapper" },
1287
+ title && (React__default.createElement(Heading, { className: "post-content-title", as: "h2", tag: "h5", fontWeight: "bold", "data-testid": "Title of the Post" }, innertext(title))),
1288
+ React__default.createElement(PostContent, { className: "post-content-wrapper", description: description, disableShortenContent: disableShortenContent, mentions: mentions, "data-testid": "Content of the Post" })),
1289
+ React__default.createElement("span", null),
1290
+ React__default.createElement("span", null),
1291
+ React__default.createElement("div", { key: "tag-topic" }, topics && topics.length > 0 ? (React__default.createElement(TagTopic, { topics: topics, className: "post-topics" })) : null),
1292
+ React__default.createElement("div", { key: "social-preview" }, (post === null || post === void 0 ? void 0 : post.introUrl) ? (React__default.createElement("div", { className: `social-preview-wrapper ${!!(photos === null || photos === void 0 ? void 0 : photos.length) ? 'has-image' : ''}` },
1293
+ React__default.createElement(SocialLinkPreview, { url: post.introUrl, image: post.bannerImage }))) : null),
1294
+ React__default.createElement("div", { key: "image-preview" }, !!(photos === null || photos === void 0 ? void 0 : photos.length) ? (React__default.createElement("div", { className: "image-preview-wrapper" },
1295
+ React__default.createElement(PostImagePreview, { images: photos, authorName: author === null || author === void 0 ? void 0 : author.name }))) : null),
1296
+ React__default.createElement("div", { key: "link-preview" }, !(post === null || post === void 0 ? void 0 : post.introUrl) && !(photos === null || photos === void 0 ? void 0 : photos.length) && (previewUrl === null || previewUrl === void 0 ? void 0 : previewUrl.url) ? (React__default.createElement("div", { className: "link-preview-wrapper" },
1297
+ React__default.createElement(CardLink, { title: previewUrl.title, url: previewUrl.url, image: previewUrl.image }))) : null),
1298
+ React__default.createElement(CardReactions, { isMarryBaby: isMarryBaby, type: CardReactionType.post, loveCount: likesCount, replyCount: commentsCount, className: `post-reaction ${(photos === null || photos === void 0 ? void 0 : photos.length) || (previewUrl === null || previewUrl === void 0 ? void 0 : previewUrl.url) ? 'hide-top-border' : ''}`, liked: isLikeLoading ? !liked : liked, isReplied: commented, onCommentClick: () => authActionWrapper(() => {
1299
+ onCommentClick ? onCommentClick() : setShowInputComment((v) => !v);
1300
+ }), onCommentCountClick: () => {
1301
+ authActionWrapper(() => {
1302
+ isMarryBaby
1303
+ ? setShowInputComment(true)
1304
+ : onCommentCountClick
1305
+ ? onCommentCountClick()
1306
+ : !disableCardLink && (window.location.href = postRelativeHref);
1307
+ });
1308
+ }, onShareClick: () => {
1309
+ setIsOpenSharePopup(true);
1310
+ }, onLikeClick: () => __awaiter(void 0, void 0, void 0, function* () {
1311
+ if (!id || isLikeLoading)
1312
+ return;
1313
+ setIsLikeLoading(true);
1314
+ try {
1315
+ const res = yield likeUnlikePost({
1316
+ id,
1317
+ locale,
1318
+ });
1319
+ if ((res === null || res === void 0 ? void 0 : res.status) !== 1) {
1320
+ pushNotifications(getDefaultFailNoti(t));
1321
+ }
1322
+ else {
1323
+ setPost((p) => (Object.assign(Object.assign({}, p), { likesCount: (p.likesCount || 0) + (!p.liked ? 1 : -1), liked: !p.liked })));
1324
+ }
1325
+ }
1326
+ catch (_a) {
1327
+ pushNotifications(getDefaultFailNoti(t));
1328
+ }
1329
+ setIsLikeLoading(false);
1330
+ }), showingMostEngaging: !!(showMostEngaging && (mostEngagingComment === null || mostEngagingComment === void 0 ? void 0 : mostEngagingComment.id)) }),
1331
+ showInputComment && (React__default.createElement(InputCommentBar, { isMainCmt: !propsShowInputComment, onClose: () => setShowInputComment(false), onPostSuccess: onPostCommentSuccess, post: post })),
1332
+ showMostEngaging && (mostEngagingComment === null || mostEngagingComment === void 0 ? void 0 : mostEngagingComment.id) ? (React__default.createElement("div", { className: "most-engaging-wrapper", onClick: (e) => {
1333
+ if (onMostEngagingCommentClick) {
1334
+ e.stopPropagation();
1335
+ onMostEngagingCommentClick();
1336
+ }
1337
+ else
1338
+ window.location.href = postRelativeHref;
1339
+ } },
1340
+ React__default.createElement(CardReply, { hasQuickBookingEnable: hasQuickBookingEnable, handleMakeAppointment: handleMakeAppointment, comment: mostEngagingComment, post: post, onDeleteComment: () => {
1341
+ onDeleteComment && onDeleteComment(mostEngagingComment);
1342
+ }, className: "most-engaging-comment", type: "most-engaging", key: mostEngagingComment.id, cardAuthorProps: cardAuthorProps }),
1343
+ commentsCount > 1 && !hideViewMoreComment && (React__default.createElement(Button, { className: "see-more-comments", color: "ghost", size: "md" }, t('comment.seeMoreComments', {
1344
+ count: commentsCount - 1,
1345
+ }))))) : null,
1346
+ InlineCommentsComponent)));
1347
+ };
1348
+
1349
+ export { CardPost as C, SourceList as S, VerifiedTag as V, CardPostPopoverMore as a, CardReply as b, CardReplyPopover as c };