@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,1681 @@
1
+ import React__default, { createContext, useContext, useMemo, useCallback, useState, useEffect, forwardRef, useRef } from 'react';
2
+ import { rem, Container, createStyles, Box, Stack, Flex, AspectRatio, ScrollArea, Chip, Group, Badge, MultiSelect, Stepper } from '@mantine/core';
3
+ import { C as CommonGAssets } from './index-9471fca1.js';
4
+ import { b as callApiWithAuth, d as getApiPath, P as PATHS$2, T as TogetherComponentGlobalContext, e as getPremiumApiPath, f as getWebsiteUrlApi, h as getSsoApiPath } from './utils-3b29eb79.js';
5
+ import { R as RISK_SCREENER_NAME, d as domainLocales, a as RISK_SCREENER_SLUG, G as GA_TOKEN_COOKIE } from './index-6210f454.js';
6
+ import { _ as __rest, a as __awaiter } from './tslib.es6-06ba3978.js';
7
+ import { I as ImageWrap, e as Checkbox, f as ChipButton, c as Input, t as themeColors, b as AspectRatio$1 } from './index-9b3a8b6d.js';
8
+ import { g as getCurrentBaseUrl, a as getCurrentSsoUrl } from './routing-9e330438.js';
9
+ import { u as useTranslations } from './useTranslations-b970f667.js';
10
+ import { useForm, isNotEmpty } from '@mantine/form';
11
+ import '@mantine/dates';
12
+ import { L as LOCALE } from './index-189d7601.js';
13
+ import './useMantineLocale-453f8013.js';
14
+ import { T as Text } from './index-5723381f.js';
15
+ import { B as Button } from './index-1d3c6ce7.js';
16
+ import './theme-7dadf4a1.js';
17
+ import { useViewportSize } from '@mantine/hooks';
18
+ import './utils-d7bbdb52.js';
19
+ import './translationsContext-42a1fa63.js';
20
+ import 'string-format';
21
+ import { H as Heading } from './index-046778af.js';
22
+ import { u as useHealthToolsCache } from './useHealthToolCache-6ce1724e.js';
23
+ import { I as Icon } from './index-049e0270.js';
24
+ import { i as isProduction } from './isProduction-1937d355.js';
25
+ import { Close, Plus } from '@hhgtech/icons/core';
26
+ import { M as Modal } from './index-cfedca38.js';
27
+ import Cookies from 'js-cookie';
28
+ import flatten from 'lodash/flatten';
29
+ import uniqBy from 'lodash/uniqBy';
30
+
31
+ const PREFER_TOPICS = [
32
+ {
33
+ title: 'Health News & Current Affairs',
34
+ description: 'Covering the latest happenings in the health field, including medical breakthroughs, policies, and disease outbreaks',
35
+ icon: CommonGAssets.getAssetPath('newsletter-prefer/newsletter-health.svg'),
36
+ checked: false,
37
+ id: 1,
38
+ },
39
+ {
40
+ title: 'Educational Medical Hello Bacsi Content',
41
+ description: 'Covering the latest happenings in the health field, including medical breakthroughs, policies, and disease outbreaks',
42
+ icon: CommonGAssets.getAssetPath('newsletter-prefer/newsletter-education.svg'),
43
+ checked: false,
44
+ id: 2,
45
+ },
46
+ {
47
+ title: 'Hello Health Community Feed',
48
+ description: 'Covering the latest happenings in the health field, including medical breakthroughs, policies, and disease outbreaks',
49
+ icon: CommonGAssets.getAssetPath('newsletter-prefer/newsletter-community.svg'),
50
+ checked: false,
51
+ id: 3,
52
+ },
53
+ ];
54
+
55
+ var HEALTH_TOOL_NAME;
56
+ (function (HEALTH_TOOL_NAME) {
57
+ HEALTH_TOOL_NAME["DUE_DATE"] = "due-date-calculator";
58
+ HEALTH_TOOL_NAME["BMI"] = "bmi";
59
+ HEALTH_TOOL_NAME["BMR"] = "bmr";
60
+ HEALTH_TOOL_NAME["OVULATION"] = "ovulation";
61
+ HEALTH_TOOL_NAME["IFRAME"] = "IFRAME";
62
+ HEALTH_TOOL_NAME["PWG"] = "pregnancy-weight-gain";
63
+ HEALTH_TOOL_NAME["THR"] = "heart-rate";
64
+ HEALTH_TOOL_NAME["BABY_VACCINE"] = "vaccination-tool";
65
+ HEALTH_TOOL_NAME["BABY_GROWTH"] = "baby-growth-tracking";
66
+ HEALTH_TOOL_NAME["BABY_POOP"] = "baby-poop-checking";
67
+ })(HEALTH_TOOL_NAME || (HEALTH_TOOL_NAME = {}));
68
+ const HEALTH_TOOL_TYPE = {
69
+ DUE_DATE: HEALTH_TOOL_NAME.DUE_DATE,
70
+ BMI: HEALTH_TOOL_NAME.BMI,
71
+ BMR: HEALTH_TOOL_NAME.BMR,
72
+ OVULATION: HEALTH_TOOL_NAME.OVULATION,
73
+ IFRAME: HEALTH_TOOL_NAME.IFRAME,
74
+ PWG: HEALTH_TOOL_NAME.PWG,
75
+ THR: HEALTH_TOOL_NAME.THR,
76
+ BABY_VACCINE: HEALTH_TOOL_NAME.BABY_VACCINE,
77
+ BABY_GROWTH: HEALTH_TOOL_NAME.BABY_GROWTH,
78
+ BABY_POOP: HEALTH_TOOL_NAME.BABY_POOP,
79
+ };
80
+ const HEALTH_TOOL_DEFAULT_IMG = {
81
+ [HEALTH_TOOL_TYPE.DUE_DATE]: CommonGAssets.getAssetPath('health-tools/due-date-icon.svg'),
82
+ };
83
+
84
+ var BannerCategory;
85
+ (function (BannerCategory) {
86
+ BannerCategory["Pregnant"] = "pregnant";
87
+ BannerCategory["Parenting"] = "parenting";
88
+ })(BannerCategory || (BannerCategory = {}));
89
+ var BannerType;
90
+ (function (BannerType) {
91
+ BannerType["Option"] = "option";
92
+ })(BannerType || (BannerType = {}));
93
+ var OptionBannerStyleType;
94
+ (function (OptionBannerStyleType) {
95
+ OptionBannerStyleType["Button"] = "button";
96
+ OptionBannerStyleType["Checkbox"] = "checkbox";
97
+ })(OptionBannerStyleType || (OptionBannerStyleType = {}));
98
+ var BannerAction;
99
+ (function (BannerAction) {
100
+ BannerAction["ShowTool"] = "showTool";
101
+ BannerAction["ShowPremiumModal"] = "showPremiumModal";
102
+ BannerAction["ShowOptionBanner"] = "showOptionBanner";
103
+ BannerAction["Hide"] = "hide";
104
+ })(BannerAction || (BannerAction = {}));
105
+ const MAPPING_CATEGORY_PREMIUM_TYPE = {
106
+ pregnancy: BannerCategory.Pregnant,
107
+ parenting: BannerCategory.Parenting,
108
+ };
109
+ const MAPPING_CATEGORY_PREMIUM_API_TYPE = {
110
+ [BannerCategory.Pregnant]: 'pregnant',
111
+ [BannerCategory.Parenting]: 'parent',
112
+ };
113
+
114
+ const FLOW = (t, currentUrl) => ({
115
+ [BannerCategory.Pregnant]: {
116
+ action: BannerAction.ShowOptionBanner,
117
+ props: {
118
+ heading: t('pnBanner.pregnancy.heading'),
119
+ description: t('pnBanner.pregnancy.desc'),
120
+ styleType: OptionBannerStyleType.Button,
121
+ thumbnail: {
122
+ desktop: CommonGAssets.getAssetPath(`newsletter/banner-option-pregnancy-desktop.png`),
123
+ mobile: CommonGAssets.getAssetPath(`newsletter/banner-option-pregnancy-mobile.png`),
124
+ },
125
+ buttonProps: {
126
+ variant: 'white',
127
+ styles: (theme) => ({
128
+ minWidth: rem(80),
129
+ [theme.fn.largerThan('sm')]: {
130
+ minWidth: rem(120),
131
+ },
132
+ }),
133
+ },
134
+ items: [
135
+ {
136
+ label: t('switchBtn.yes'),
137
+ value: 'yes',
138
+ tracking: {
139
+ dataEventCategory: 'Focused Audience',
140
+ dataEventAction: 'Are you navigating the world of pregnancy - Yes Click',
141
+ dataEventLabel: currentUrl,
142
+ },
143
+ },
144
+ {
145
+ label: t('switchBtn.no'),
146
+ value: 'no',
147
+ tracking: {
148
+ dataEventCategory: 'Focused Audience',
149
+ dataEventAction: 'Are you navigating the world of pregnancy - No Click',
150
+ dataEventLabel: currentUrl,
151
+ },
152
+ },
153
+ ],
154
+ },
155
+ submitHandler: {
156
+ yes: {
157
+ action: BannerAction.ShowTool,
158
+ props: {
159
+ value: HEALTH_TOOL_TYPE.DUE_DATE,
160
+ },
161
+ },
162
+ no: {
163
+ action: BannerAction.ShowPremiumModal,
164
+ },
165
+ },
166
+ },
167
+ [BannerCategory.Parenting]: {
168
+ action: BannerAction.ShowOptionBanner,
169
+ props: {
170
+ heading: t('pnBanner.parenting.heading'),
171
+ description: t('pnBanner.parenting.desc'),
172
+ thumbnail: {
173
+ desktop: CommonGAssets.getAssetPath(`newsletter/banner-option-parenting-desktop.png`),
174
+ mobile: CommonGAssets.getAssetPath(`newsletter/banner-option-parenting-mobile.png`),
175
+ },
176
+ hideDescOnMobile: true,
177
+ styleType: OptionBannerStyleType.Checkbox,
178
+ items: [
179
+ {
180
+ label: t('pnBanner.toddlers'),
181
+ value: 'todders',
182
+ },
183
+ {
184
+ label: t('pnBanner.teenager'),
185
+ value: 'teenager',
186
+ },
187
+ ],
188
+ submitBtnTracking: {
189
+ dataEventCategory: 'Focused Audience',
190
+ dataEventAction: 'What is the age range of your kids Click',
191
+ dataEventLabel: currentUrl,
192
+ },
193
+ },
194
+ submitHandler: {
195
+ todders: {
196
+ action: BannerAction.ShowTool,
197
+ props: {
198
+ value: HEALTH_TOOL_TYPE.BABY_VACCINE,
199
+ },
200
+ },
201
+ teenager: {
202
+ action: BannerAction.ShowOptionBanner,
203
+ props: {
204
+ styleType: OptionBannerStyleType.Button,
205
+ heading: t('pnBanner.teenager.heading'),
206
+ description: t('pnBanner.parenting.desc'),
207
+ thumbnail: {
208
+ desktop: CommonGAssets.getAssetPath(`newsletter/banner-option-parenting-desktop.png`),
209
+ mobile: CommonGAssets.getAssetPath(`newsletter/banner-option-parenting-mobile.png`),
210
+ },
211
+ buttonProps: {
212
+ variant: 'white',
213
+ },
214
+ items: [
215
+ {
216
+ label: t('childCard.boy'),
217
+ value: 'teenager.boy',
218
+ tracking: {
219
+ dataEventCategory: 'Focused Audience',
220
+ dataEventAction: 'What is the gender of your kids - Boy Click',
221
+ dataEventLabel: currentUrl,
222
+ },
223
+ },
224
+ {
225
+ label: t('childCard.girl'),
226
+ value: 'teenager.girl',
227
+ tracking: {
228
+ dataEventCategory: 'Focused Audience',
229
+ dataEventAction: 'What is the gender of your kids - Girl Click',
230
+ dataEventLabel: currentUrl,
231
+ },
232
+ },
233
+ ],
234
+ },
235
+ },
236
+ 'teenager.boy': {
237
+ action: BannerAction.ShowPremiumModal,
238
+ },
239
+ 'teenager.girl': {
240
+ action: BannerAction.ShowTool,
241
+ activeTool: RISK_SCREENER_NAME.HPV,
242
+ props: {
243
+ value: RISK_SCREENER_NAME.HPV,
244
+ },
245
+ },
246
+ 'todders|teenager': {
247
+ action: BannerAction.ShowOptionBanner,
248
+ props: {
249
+ styleType: OptionBannerStyleType.Button,
250
+ heading: t('pnBanner.both.heading'),
251
+ description: t('pnBanner.both.desc'),
252
+ thumbnail: {
253
+ desktop: CommonGAssets.getAssetPath(`newsletter/banner-option-parenting-desktop.png`),
254
+ mobile: CommonGAssets.getAssetPath(`newsletter/banner-option-parenting-mobile.png`),
255
+ },
256
+ hideDescOnMobile: true,
257
+ buttonProps: {
258
+ variant: 'secondary',
259
+ },
260
+ styles: (theme) => ({
261
+ wrapper: {
262
+ [theme.fn.smallerThan('sm')]: {
263
+ flexDirection: 'column',
264
+ },
265
+ },
266
+ button: {
267
+ background: theme.colors.blue[0],
268
+ },
269
+ }),
270
+ items: [
271
+ {
272
+ label: t('pnBanner.vaccine.btnLabel'),
273
+ activeTool: HEALTH_TOOL_TYPE.BABY_VACCINE,
274
+ isLink: true,
275
+ tracking: {
276
+ dataEventCategory: 'Focused Audience',
277
+ dataEventAction: 'Experience our tools for parent - Baby Vaccine Click',
278
+ dataEventLabel: currentUrl,
279
+ },
280
+ },
281
+ {
282
+ label: t('pnBanner.pn.btnLabel'),
283
+ value: 'todders|teenager.showPN',
284
+ isPNBtn: true,
285
+ tracking: {
286
+ dataEventCategory: 'Focused Audience',
287
+ dataEventAction: 'Experience our tools for parent - Premium Newsletter Click',
288
+ dataEventLabel: currentUrl,
289
+ },
290
+ },
291
+ ],
292
+ },
293
+ },
294
+ 'todders|teenager.showPN': {
295
+ action: BannerAction.ShowOptionBanner,
296
+ props: {
297
+ styleType: OptionBannerStyleType.Button,
298
+ heading: t('pnBanner.both.heading'),
299
+ description: t('pnBanner.both.desc'),
300
+ thumbnail: {
301
+ desktop: CommonGAssets.getAssetPath(`newsletter/banner-option-parenting-desktop.png`),
302
+ mobile: CommonGAssets.getAssetPath(`newsletter/banner-option-parenting-mobile.png`),
303
+ },
304
+ hideDescOnMobile: true,
305
+ buttonProps: {
306
+ variant: 'secondary',
307
+ },
308
+ styles: (theme) => ({
309
+ wrapper: {
310
+ [theme.fn.smallerThan('sm')]: {
311
+ flexDirection: 'column',
312
+ },
313
+ },
314
+ button: {
315
+ background: theme.colors.blue[0],
316
+ },
317
+ }),
318
+ items: [
319
+ {
320
+ label: t('pnBanner.vaccine.btnLabel'),
321
+ activeTool: HEALTH_TOOL_TYPE.BABY_VACCINE,
322
+ isLink: true,
323
+ tracking: {
324
+ dataEventCategory: 'Focused Audience',
325
+ dataEventAction: 'Experience our tools for parent - Baby Vaccine Click',
326
+ dataEventLabel: currentUrl,
327
+ },
328
+ },
329
+ ],
330
+ },
331
+ },
332
+ },
333
+ },
334
+ });
335
+ const TOOL_BANNERS_PROPS = (t) => ({
336
+ [HEALTH_TOOL_TYPE.DUE_DATE]: {
337
+ heading: t('pnBanner.dueDateTool.heading'),
338
+ description: t('pnBanner.dueDateTool.desc'),
339
+ btnLabel: t('pnBanner.caclNow'),
340
+ value: HEALTH_TOOL_TYPE.DUE_DATE,
341
+ dataEventAction: 'Try our Due Date Calculator Click',
342
+ },
343
+ [HEALTH_TOOL_TYPE.BABY_VACCINE]: {
344
+ heading: t('pnBanner.vaccination.heading'),
345
+ description: t('pnBanner.vaccination.desc'),
346
+ btnLabel: t('pnBanner.caclNow'),
347
+ value: HEALTH_TOOL_TYPE.BABY_VACCINE,
348
+ dataEventAction: 'Try our Baby Vaccine Scheduler Click',
349
+ },
350
+ [HEALTH_TOOL_TYPE.BABY_GROWTH]: {
351
+ heading: 'Baby Growth',
352
+ description: t('pnBanner.vaccination.desc'),
353
+ btnLabel: t('pnBanner.caclNow'),
354
+ value: HEALTH_TOOL_TYPE.BABY_GROWTH,
355
+ },
356
+ [RISK_SCREENER_NAME.HPV]: {
357
+ heading: t('pnBanner.hpv.heading'),
358
+ description: t('pnBanner.hpv.desc'),
359
+ thumbnail: {
360
+ desktop: CommonGAssets.getAssetPath(`newsletter/banner-option-hpv-desktop.png`),
361
+ mobile: CommonGAssets.getAssetPath(`newsletter/banner-option-hpv-mobile.png`),
362
+ },
363
+ isRiskScreener: true,
364
+ btnLabel: t('pnBanner.checkNow'),
365
+ value: RISK_SCREENER_NAME.HPV,
366
+ hideDescOnMobile: true,
367
+ dataEventAction: 'Keep safe from HPV virus Click',
368
+ },
369
+ });
370
+
371
+ const SurveyOrPremiumBannerContext = createContext({});
372
+
373
+ const PnBannerEle = (_a) => {
374
+ var rest = __rest(_a, []);
375
+ const { locale } = useTranslations();
376
+ const { type, isMobile, currentUrl, isMarketing, isLoggedIn, setShouldAcquisitionModalOpen, } = useContext(SurveyOrPremiumBannerContext);
377
+ const bannerClick = () => __awaiter(void 0, void 0, void 0, function* () {
378
+ const url = isMarketing
379
+ ? getCurrentBaseUrl(locale) + '/dang-ky-nhan-tin/'
380
+ : `${window.location.href}?source=acquisition`;
381
+ if (isLoggedIn) {
382
+ setShouldAcquisitionModalOpen === null || setShouldAcquisitionModalOpen === void 0 ? void 0 : setShouldAcquisitionModalOpen();
383
+ }
384
+ else {
385
+ window.location.href = `${getCurrentSsoUrl(locale)}/?returnUrl=${encodeURIComponent(url)}`;
386
+ }
387
+ });
388
+ return (React__default.createElement(Container, Object.assign({ mih: { base: 144, md: 160 }, fluid: true, p: 0, sx: {
389
+ borderRadius: 4,
390
+ cursor: 'pointer',
391
+ }, onClick: bannerClick, "data-event-category": "Newsletter", "data-event-action": "Banner Click", "data-event-label": currentUrl, className: "pointer-event-child-none" }, rest),
392
+ React__default.createElement(ImageWrap, { src: isMarketing
393
+ ? CommonGAssets.getAssetPath(`newsletter/${isMobile ? 'Mobile' : 'Desktop'}_Marketing.png`)
394
+ : CommonGAssets.getAssetPath(`newsletter/${isMobile ? 'Mobile' : 'Desktop'}_${type}.png`), style: { maxWidth: '100%' }, alt: "newsletter banner" })));
395
+ };
396
+
397
+ const PATHS$1 = {
398
+ GET_SUGGESTED_TOPIC: 'api/v1/categories?external_id={externalId}&site={website_url}',
399
+ GET_NEWSLETTER_CATEGORIES: 'api/v1/categories?site={website_url}',
400
+ POST_SUBSCRIPTION: 'api/v1/subscription?site={website_url}',
401
+ TEMP_POST_SUBSCRIPTION: 'api/v1/subscription/temporary?site={website_url}',
402
+ TEMP_POST_SUBSCRIPTION_OFFICIAL: 'api/v1/subscription/official?site={website_url}',
403
+ TEMP_GET_NEWSLETTER_CATEGORIES: 'api/v1/categories/temporary?site={website_url}',
404
+ GET_SUBSCRIPTION_CATEGORIES: 'api/v1/categories?site={website_url}',
405
+ };
406
+
407
+ var useStyles = createStyles((theme) => {
408
+ return {
409
+ root: {},
410
+ wrapper: {
411
+ [theme.fn.smallerThan('sm')]: {
412
+ width: '70%',
413
+ },
414
+ },
415
+ button: {
416
+ [theme.fn.smallerThan('sm')]: {
417
+ height: 'auto',
418
+ minHeight: rem(32),
419
+ padding: `${rem(6)} ${rem(16)}`,
420
+ textAlign: 'center',
421
+ width: '100%',
422
+ },
423
+ },
424
+ buttonLabel: {
425
+ whiteSpace: 'normal',
426
+ },
427
+ };
428
+ });
429
+
430
+ const BannerLayout = ({ heading, description, thumbnail = {
431
+ desktop: '',
432
+ mobile: '',
433
+ }, hideDescOnMobile, children, }) => {
434
+ const { isMobile, minHeight } = useContext(SurveyOrPremiumBannerContext);
435
+ return (React__default.createElement(Box, { sx: () => ({
436
+ borderRadius: rem(8),
437
+ background: 'linear-gradient(180deg, #FAFDFF 0%, #E3F2FF 100%)',
438
+ }) },
439
+ React__default.createElement(Box, { sx: (theme) => ({
440
+ minHeight: rem(minHeight),
441
+ borderRadius: 'inherit',
442
+ background: `url(${isMobile ? thumbnail.mobile : thumbnail.desktop})`,
443
+ backgroundPosition: 'center right',
444
+ backgroundRepeat: 'no-repeat',
445
+ backgroundSize: 'contain',
446
+ padding: `${rem(24)} ${rem(16)}`,
447
+ display: 'flex',
448
+ flexDirection: 'column',
449
+ justifyContent: 'center',
450
+ [theme.fn.largerThan('sm')]: {
451
+ padding: `${rem(22)} ${rem(32)}`,
452
+ },
453
+ }) },
454
+ React__default.createElement(Stack, { spacing: rem(16) },
455
+ React__default.createElement(Stack, { spacing: rem(4), sx: (theme) => ({
456
+ maxWidth: '60%',
457
+ [theme.fn.largerThan('sm')]: {
458
+ maxWidth: '70%',
459
+ },
460
+ }) },
461
+ heading && React__default.createElement(Heading, { tag: "h4" }, heading),
462
+ !(hideDescOnMobile && isMobile) && description && (React__default.createElement(Text, { size: "p4" }, description))),
463
+ React__default.createElement(Box, null, children)))));
464
+ };
465
+
466
+ const BannerWithOptions = (props) => {
467
+ const { styleType = OptionBannerStyleType.Button, items: itemsProp = [], buttonProps, styles, submitBtnTracking, } = props;
468
+ const { classes } = useStyles(undefined, {
469
+ name: 'PremiumBannerWithOptions',
470
+ styles,
471
+ });
472
+ const { t, locale } = useTranslations();
473
+ const { surveyType, articleId, handleClickOption, hasPremiumBanner, source, isMobile, setShowPNModal, } = useContext(SurveyOrPremiumBannerContext);
474
+ const items = useMemo(() => !hasPremiumBanner
475
+ ? itemsProp.filter((i) => !Boolean(i.isPNBtn)).filter(Boolean)
476
+ : itemsProp, [itemsProp]);
477
+ const { getHealthToolLink } = useHealthToolsCache(locale);
478
+ const form = useForm({
479
+ initialValues: {
480
+ bannerOptions: [],
481
+ },
482
+ });
483
+ const saveStep = (value) => __awaiter(void 0, void 0, void 0, function* () {
484
+ return yield callApiWithAuth(getApiPath(PATHS$2.HEALTH_TOOL.CREATE, {
485
+ _locale: locale,
486
+ type: MAPPING_CATEGORY_PREMIUM_API_TYPE[surveyType],
487
+ }), 'POST', {
488
+ headers: {
489
+ 'Content-Type': 'application/json',
490
+ },
491
+ data: {
492
+ value,
493
+ article: articleId,
494
+ source,
495
+ },
496
+ });
497
+ });
498
+ const renderButtonChoice = useCallback(() => (React__default.createElement(Flex, { gap: rem(8), className: classes.wrapper }, items.map((i, idx) => (React__default.createElement(Box, { key: String(idx), component: i.isLink ? 'a' : 'div', href: i.isRiskScreener
499
+ ? `https://${domainLocales[locale]}/bot/${RISK_SCREENER_SLUG[locale][i.activeTool]}/`
500
+ : i.isLink
501
+ ? getHealthToolLink(i.activeTool)
502
+ : undefined },
503
+ React__default.createElement(Button, Object.assign({ className: classes.button, classNames: {
504
+ label: classes.buttonLabel,
505
+ }, size: "sm" }, i.tracking, buttonProps, { onClick: () => {
506
+ if (!i.isLink) {
507
+ if (i.isPNBtn) {
508
+ setShowPNModal(true);
509
+ }
510
+ saveStep(i.value);
511
+ handleClickOption(i.value);
512
+ }
513
+ } }), i.label)))))), [items, form]);
514
+ const renderCheckboxChoice = useCallback(() => (React__default.createElement(Flex, null,
515
+ React__default.createElement(Flex, { align: 'center', gap: rem(24), sx: (theme) => ({
516
+ background: 'white',
517
+ borderRadius: rem(8),
518
+ padding: rem(4),
519
+ [theme.fn.largerThan('sm')]: {
520
+ paddingLeft: rem(16),
521
+ },
522
+ }) },
523
+ React__default.createElement(Checkbox.Group, Object.assign({}, form.getInputProps('bannerOptions', { type: 'checkbox' })),
524
+ React__default.createElement(Flex, { gap: rem(16) }, items.map((i, idx) => (React__default.createElement(Checkbox, { key: String(idx), value: i.value, label: i.label, styles: {
525
+ label: {
526
+ cursor: 'pointer',
527
+ },
528
+ } }))))),
529
+ React__default.createElement(Button, Object.assign({ size: "sm" }, submitBtnTracking, buttonProps, { disabled: form.getInputProps('bannerOptions').value.length === 0, leftIcon: isMobile ? (React__default.createElement(Icon.ArrowRightTail, { size: 18, useCurrentColor: true })) : undefined, onClick: () => {
530
+ const curValues = form.getInputProps('bannerOptions').value;
531
+ saveStep(curValues.join('|'));
532
+ handleClickOption(curValues.join('|'));
533
+ }, styles: (theme) => ({
534
+ root: {
535
+ [theme.fn.smallerThan('sm')]: {
536
+ width: rem(38),
537
+ minWidth: 'auto',
538
+ padding: 0,
539
+ },
540
+ },
541
+ }) }), !isMobile && t('pnBanner.submit'))))), [items, form]);
542
+ return (React__default.createElement(BannerLayout, Object.assign({}, props), styleType === OptionBannerStyleType.Button
543
+ ? renderButtonChoice()
544
+ : styleType === OptionBannerStyleType.Checkbox
545
+ ? renderCheckboxChoice()
546
+ : null));
547
+ };
548
+
549
+ const ToolBanner = (props) => {
550
+ var _a, _b;
551
+ const { t } = useTranslations();
552
+ const { heading, description, thumbnail, btnLabel, value, isRiskScreener, hideDescOnMobile, dataEventAction, } = props;
553
+ const { locale } = useTranslations();
554
+ const { isMobile } = useContext(SurveyOrPremiumBannerContext);
555
+ const { getHealthToolLink, allTools } = useHealthToolsCache(locale);
556
+ const layout = isRiskScreener ? 'mainBanner' : 'toolBanner';
557
+ const btnEle = useMemo(() => {
558
+ const toolUrl = isRiskScreener
559
+ ? `https://${!isProduction ? 'discover.' : ''}${domainLocales[locale]}/bot/${RISK_SCREENER_SLUG[locale][value]}`
560
+ : getHealthToolLink(value);
561
+ return (React__default.createElement("a", { href: toolUrl },
562
+ React__default.createElement(Button, { size: "sm", "data-event-category": "Focused Audience", "data-event-action": dataEventAction, "data-event-label": toolUrl }, btnLabel || t('pnBanner.caclNow'))));
563
+ }, [allTools]);
564
+ return layout === 'mainBanner' ? (React__default.createElement(BannerLayout, Object.assign({}, Object.assign(Object.assign({}, props), { thumbnail: props.thumbnail })), btnEle)) : (React__default.createElement(Flex, { gap: rem(7), align: 'center', justify: 'space-between', sx: (theme) => ({
565
+ borderRadius: rem(8),
566
+ background: theme.colors.blue[0],
567
+ minHeight: rem(180),
568
+ padding: `${rem(24)} ${rem(16)}`,
569
+ [theme.fn.largerThan('sm')]: {
570
+ padding: `${rem(34)} ${rem(32)}`,
571
+ },
572
+ }) },
573
+ React__default.createElement(Stack, { spacing: rem(12) },
574
+ React__default.createElement(Stack, { spacing: rem(4) },
575
+ heading && React__default.createElement(Heading, { tag: "h4" }, heading),
576
+ !(isMobile && hideDescOnMobile) && description && (React__default.createElement(Text, { size: "p4" }, description))),
577
+ React__default.createElement(Flex, { gap: rem(8), sx: {
578
+ button: {
579
+ minWidth: rem(120),
580
+ },
581
+ } }, btnEle)),
582
+ React__default.createElement(Flex, { align: 'center', justify: 'center', sx: (theme) => ({
583
+ width: rem(96),
584
+ height: rem(96),
585
+ borderRadius: '50%',
586
+ background: 'white',
587
+ flexShrink: 0,
588
+ [theme.fn.largerThan('sm')]: {
589
+ width: rem(112),
590
+ height: rem(112),
591
+ },
592
+ img: {
593
+ maxWidth: rem(64),
594
+ [theme.fn.largerThan('sm')]: {
595
+ maxWidth: rem(73),
596
+ },
597
+ },
598
+ }) },
599
+ React__default.createElement("img", { alt: "health-tool-icon", src: thumbnail ||
600
+ ((_b = (_a = allTools.filter((i) => i.template === value)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.icon) ||
601
+ HEALTH_TOOL_DEFAULT_IMG[value] ||
602
+ '', loading: "lazy" }))));
603
+ };
604
+
605
+ const HandlerBanner = () => {
606
+ var _a, _b, _c;
607
+ const { t } = useTranslations();
608
+ const { state, Outside } = useContext(SurveyOrPremiumBannerContext);
609
+ return (state === null || state === void 0 ? void 0 : state.action) === BannerAction.ShowTool ? (React__default.createElement(Outside, null, TOOL_BANNERS_PROPS(t)[(_a = state === null || state === void 0 ? void 0 : state.props) === null || _a === void 0 ? void 0 : _a.value] ? (React__default.createElement(ToolBanner, Object.assign({}, TOOL_BANNERS_PROPS(t)[(_b = state === null || state === void 0 ? void 0 : state.props) === null || _b === void 0 ? void 0 : _b.value], { value: (_c = state === null || state === void 0 ? void 0 : state.props) === null || _c === void 0 ? void 0 : _c.value }))) : null)) : (state === null || state === void 0 ? void 0 : state.action) === BannerAction.ShowOptionBanner ? (React__default.createElement(Outside, null,
610
+ React__default.createElement(BannerWithOptions, Object.assign({}, state === null || state === void 0 ? void 0 : state.props)))) : null;
611
+ };
612
+
613
+ const SideBannerModal = (_a) => {
614
+ var { isMobile, children, desktopBanner = CommonGAssets.getAssetPath('friso/onboarding-banner.jpg'), mobileBanner = CommonGAssets.getAssetPath('friso/onboarding-banner-mobile.jpg'), modalRatio = {
615
+ width: 937,
616
+ height: 536,
617
+ }, mobileBannerRatio = {
618
+ width: 750,
619
+ height: 480,
620
+ }, desktopBannerRatio = {
621
+ width: 420,
622
+ height: 536,
623
+ }, closeProps } = _a, modalProps = __rest(_a, ["isMobile", "children", "desktopBanner", "mobileBanner", "modalRatio", "mobileBannerRatio", "desktopBannerRatio", "closeProps"]);
624
+ const { width: viewportWidth, height: viewportHeight } = useViewportSize();
625
+ const curBannerHeight = (viewportWidth * mobileBannerRatio.height) / mobileBannerRatio.width;
626
+ const minHeightNha = (viewportHeight <= 667 ? 190 : 265) + curBannerHeight + 74;
627
+ const [isFullScreen, setIsFullScreen] = useState(false);
628
+ return (React__default.createElement(Modal, Object.assign({ styles: (theme) => ({
629
+ header: {
630
+ display: 'none',
631
+ },
632
+ content: {
633
+ flex: 'auto',
634
+ background: 'transparent',
635
+ [theme.fn.smallerThan('sm')]: {
636
+ maxHeight: '100%',
637
+ height: '100%',
638
+ position: 'relative',
639
+ borderRadius: 0,
640
+ },
641
+ [theme.fn.largerThan('sm')]: {
642
+ maxWidth: rem(modalRatio.width),
643
+ width: '100%',
644
+ height: '100%',
645
+ maxHeight: rem(modalRatio.height),
646
+ boxShadow: 'none',
647
+ },
648
+ },
649
+ body: {
650
+ padding: 0,
651
+ width: '100%',
652
+ height: '100%',
653
+ [theme.fn.largerThan('sm')]: {
654
+ display: 'flex',
655
+ alignItems: 'center',
656
+ },
657
+ },
658
+ inner: {
659
+ padding: 0,
660
+ [theme.fn.smallerThan('sm')]: {
661
+ display: 'flex',
662
+ alignItems: 'flex-end',
663
+ },
664
+ },
665
+ }) }, modalProps), isMobile ? (React__default.createElement(Box, { sx: {
666
+ position: 'relative',
667
+ width: '100%',
668
+ height: '100%',
669
+ }, onTouchStart: () => setIsFullScreen(true) },
670
+ React__default.createElement(Box, { className: "mobile-template", sx: {
671
+ position: 'absolute',
672
+ height: `${(isFullScreen ? 1 : minHeightNha / viewportHeight) * 100}%`,
673
+ left: 0,
674
+ bottom: 0,
675
+ right: 0,
676
+ transition: 'height 0.4s ease',
677
+ } },
678
+ React__default.createElement(Box, { className: "mobile-template-wrapper", sx: {
679
+ height: '100%',
680
+ backgroundColor: 'white',
681
+ borderTopLeftRadius: isFullScreen ? 0 : rem(12),
682
+ borderTopRightRadius: isFullScreen ? 0 : rem(12),
683
+ } },
684
+ React__default.createElement(Box, { sx: {
685
+ // height: 'calc(100% - 74px)',
686
+ height: '100%',
687
+ background: `url(${mobileBanner})`,
688
+ backgroundSize: 'contain',
689
+ backgroundRepeat: 'no-repeat',
690
+ backgroundPosition: 'top center',
691
+ overflowY: 'auto',
692
+ borderRadius: 'inherit',
693
+ } },
694
+ React__default.createElement(Button, Object.assign({ variant: "white", leftIcon: React__default.createElement(Close, null), sx: {
695
+ position: 'absolute',
696
+ right: 0,
697
+ top: 0,
698
+ zIndex: 1,
699
+ padding: rem(10),
700
+ // backgroundColor: 'transparent',
701
+ } }, closeProps, { onClick: () => modalProps === null || modalProps === void 0 ? void 0 : modalProps.onClose() })),
702
+ React__default.createElement(AspectRatio, { ratio: (mobileBannerRatio === null || mobileBannerRatio === void 0 ? void 0 : mobileBannerRatio.width) / (mobileBannerRatio === null || mobileBannerRatio === void 0 ? void 0 : mobileBannerRatio.height), w: "100%" }),
703
+ React__default.createElement(Box, { className: "inner", sx: {
704
+ padding: `${rem(28)} ${rem(16)} ${rem(16)}`,
705
+ background: 'white',
706
+ } }, children)))))) : (React__default.createElement(AspectRatio, { className: "desktop-template", ratio: modalRatio.width / modalRatio.height, w: "100%", sx: {
707
+ position: 'relative',
708
+ '& > div': {
709
+ justifyContent: 'flex-end',
710
+ },
711
+ } },
712
+ React__default.createElement(Box, { sx: {
713
+ width: '100%',
714
+ height: '100%',
715
+ justifyContent: 'flex-end',
716
+ alignItems: 'stretch',
717
+ borderRadius: rem(8),
718
+ background: 'white',
719
+ boxShadow: '0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem',
720
+ } },
721
+ React__default.createElement("img", { alt: "", src: desktopBanner, loading: "lazy", style: {
722
+ borderTopLeftRadius: rem(8),
723
+ borderBottomLeftRadius: rem(8),
724
+ height: '100%',
725
+ display: 'block',
726
+ } }),
727
+ React__default.createElement(Box, { sx: {
728
+ position: 'relative',
729
+ height: '100%',
730
+ width: `${((modalRatio.width - desktopBannerRatio.width) /
731
+ modalRatio.width) *
732
+ 100}%`,
733
+ } },
734
+ React__default.createElement(Button, Object.assign({ variant: "white", leftIcon: React__default.createElement(Close, null) }, closeProps, { onClick: () => modalProps === null || modalProps === void 0 ? void 0 : modalProps.onClose(), sx: {
735
+ position: 'absolute',
736
+ right: 0,
737
+ top: 0,
738
+ backgroundColor: 'transparent',
739
+ } })),
740
+ React__default.createElement(Box, { className: "side-banner-modal-container", sx: {
741
+ height: '100%',
742
+ padding: `${rem(40)} ${rem(24)} 0`,
743
+ } }, children)))))));
744
+ };
745
+
746
+ const PATHS = {
747
+ UPDATE_SUBSCRIPTION: 'user/subscription',
748
+ };
749
+
750
+ const PremiumNewsletterModalContext = createContext({});
751
+
752
+ const _NormalTopic = (_a) => {
753
+ var { value, name } = _a, rest = __rest(_a, ["value", "name"]);
754
+ return (React__default.createElement(ChipButton, Object.assign({ value: value, withIcon: true }, rest, { buttonProps: {
755
+ styles: () => ({
756
+ leftIcon: {
757
+ marginRight: rem(6),
758
+ },
759
+ root: {
760
+ paddingLeft: rem(10),
761
+ paddingRight: rem(10),
762
+ },
763
+ }),
764
+ } }), name));
765
+ };
766
+
767
+ const TopicSection = ({ topicsGroup, onTopicChange, isBlock = false, selectedTopics = [], inputProps, labelProps, maxSelect = 5, hasScroll, readonly, }) => {
768
+ const { action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
769
+ const topics = flatten(topicsGroup.map((i) => i.topics || []));
770
+ const { t } = useTranslations();
771
+ const [value, setValue] = useState([]);
772
+ useEffect(() => {
773
+ setValue(selectedTopics);
774
+ }, [selectedTopics.length]);
775
+ useEffect(() => {
776
+ onTopicChange === null || onTopicChange === void 0 ? void 0 : onTopicChange(value);
777
+ }, [value]);
778
+ const onValueChange = (v) => {
779
+ if (v.length > 5) {
780
+ pushNotifications({
781
+ type: 'danger',
782
+ title: t('pnTopicSection.maxSelectError.title', {
783
+ maxSelect,
784
+ }),
785
+ message: t('pnTopicSection.maxSelectError.desc'),
786
+ });
787
+ return;
788
+ }
789
+ else {
790
+ !readonly &&
791
+ setValue(() => {
792
+ return topics.filter((topicObj) => v.some((tValue) => topicObj.catId === tValue));
793
+ });
794
+ }
795
+ };
796
+ return (React__default.createElement(Stack, { spacing: 12 }, topicsGroup.map((i, idx) => (React__default.createElement(Stack, { key: String(idx), spacing: 12 },
797
+ i.label && (React__default.createElement(Text, Object.assign({ size: "s5", color: "gray.4", weight: "semiBold" }, labelProps), i.label)),
798
+ hasScroll ? (React__default.createElement(ScrollArea, { w: "100%", offsetScrollbars: true, scrollbarSize: 4, p: 16, m: -16, styles: {
799
+ viewport: {
800
+ margin: -16,
801
+ padding: 16,
802
+ },
803
+ } },
804
+ React__default.createElement(Box, { w: 800 },
805
+ React__default.createElement(Chip.Group, Object.assign({ value: value.map((v) => v.catId), multiple: true }, inputProps, { onChange: onValueChange }),
806
+ React__default.createElement(Flex, { gap: 8, wrap: "wrap" }, i.topics.map((v) => (React__default.createElement(_NormalTopic, Object.assign({ key: v.catId, value: v.catId, name: v.localName, isBlock: isBlock }, i.tracking))))))))) : (React__default.createElement(Chip.Group, Object.assign({ value: value.map((v) => v.catId), multiple: true }, inputProps, { onChange: onValueChange }),
807
+ React__default.createElement(Flex, { gap: 8, wrap: "wrap" }, i.topics.map((v) => v.catId ? (React__default.createElement(_NormalTopic, Object.assign({ key: v.catId, value: v.catId, name: v.localName, isBlock: isBlock }, i.tracking))) : React__default.isValidElement(v.component) ? (v.component) : null)))))))));
808
+ };
809
+
810
+ const Layout = (_a) => {
811
+ var { heading, children, stickyActions } = _a, scrollAreaProps = __rest(_a, ["heading", "children", "stickyActions"]);
812
+ const { isMobile } = useContext(PremiumNewsletterModalContext);
813
+ const content = (React__default.createElement(Stack, { spacing: rem(24), sx: { height: '100%' } },
814
+ React__default.createElement(Heading, { tag: "h4", style: {
815
+ textAlign: 'center',
816
+ } }, heading),
817
+ React__default.createElement(Box, null, children)));
818
+ return (React__default.createElement(Box, { sx: (theme) => ({
819
+ [theme.fn.largerThan('sm')]: {
820
+ position: 'relative',
821
+ height: '100%',
822
+ },
823
+ }) },
824
+ isMobile ? (content) : (React__default.createElement(ScrollArea, Object.assign({ className: "layout-body", h: stickyActions ? 'calc(100% - 90px)' : '100%' }, scrollAreaProps), content)),
825
+ stickyActions && (React__default.createElement(Flex, { gap: rem(8), sx: (theme) => ({
826
+ position: 'absolute',
827
+ left: 0,
828
+ right: 0,
829
+ bottom: 0,
830
+ padding: rem(16),
831
+ button: {
832
+ flexGrow: 1,
833
+ },
834
+ justifyContent: 'center',
835
+ [theme.fn.largerThan('sm')]: {
836
+ padding: `${rem(24)} 0`,
837
+ },
838
+ }) }, stickyActions))));
839
+ };
840
+
841
+ const MainForm = () => {
842
+ const { t, locale } = useTranslations();
843
+ const { data: { userInfo }, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
844
+ const isLoggedIn = userInfo === null || userInfo === void 0 ? void 0 : userInfo.id;
845
+ const { currentUrl, isMobile, pnSuggestCategory = [], nextStep, formValues, setFormValues, onSubmit: _onSubmit, submitLoading, selectCategory, setCategoryLibs, setSelectCategory, maxSelectCategory, } = useContext(PremiumNewsletterModalContext);
846
+ const pnSuggestCategoryIds = pnSuggestCategory.map((i) => i.catId);
847
+ const form = useForm({
848
+ validate: {
849
+ name: isNotEmpty(t('healthToolPNModal.mainForm.requireName')),
850
+ },
851
+ initialValues: Object.assign(Object.assign({}, formValues), { fitnessTopics: pnSuggestCategoryIds }),
852
+ });
853
+ const [fitnessTopics, setFitnessTopics] = useState([]);
854
+ const [interestedTopics, setInterestedTopics] = useState([]);
855
+ useEffect(() => {
856
+ (() => __awaiter(void 0, void 0, void 0, function* () {
857
+ var _a;
858
+ try {
859
+ const interestedRes = yield callApiWithAuth(getPremiumApiPath(PATHS$1.GET_SUBSCRIPTION_CATEGORIES, {
860
+ _locale: locale,
861
+ }), 'get');
862
+ const interestedList = (((_a = interestedRes === null || interestedRes === void 0 ? void 0 : interestedRes.data) === null || _a === void 0 ? void 0 : _a.subscription) || []).filter((i) => !pnSuggestCategoryIds.includes(i.catId));
863
+ setFitnessTopics(pnSuggestCategory);
864
+ setInterestedTopics(interestedList);
865
+ setCategoryLibs([...pnSuggestCategory, ...interestedList]);
866
+ }
867
+ catch (err) {
868
+ console.log(err);
869
+ }
870
+ }))();
871
+ }, []);
872
+ useEffect(() => {
873
+ isLoggedIn && form.setFieldValue('name', (userInfo === null || userInfo === void 0 ? void 0 : userInfo.name) || '');
874
+ }, [isLoggedIn]);
875
+ const onMore = () => {
876
+ if (form.getInputProps('name').value !== '') {
877
+ setFormValues(form.getTransformedValues());
878
+ nextStep();
879
+ }
880
+ else {
881
+ form.validateField('name');
882
+ }
883
+ };
884
+ const onSubmit = (formValues) => {
885
+ if (selectCategory.length === 0) {
886
+ pushNotifications({
887
+ type: 'danger',
888
+ title: t('newsletter.error.minTitle'),
889
+ message: t('newsletter.error.minCotennt'),
890
+ });
891
+ return false;
892
+ }
893
+ setFormValues(formValues);
894
+ _onSubmit === null || _onSubmit === void 0 ? void 0 : _onSubmit(formValues.name);
895
+ };
896
+ const MoreButton = useMemo(() => (React__default.createElement(Button, { variant: "tertiary", dataEventCategory: "Newsletter", dataEventAction: "More Category Click", dataEventLabel: currentUrl, leftIcon: React__default.createElement(Plus, { size: 16, color: 'currentColor' }), onClick: onMore, styles: (theme) => ({
897
+ root: {
898
+ borderRadius: rem(6),
899
+ padding: '2px 15px',
900
+ height: rem(40),
901
+ },
902
+ label: {
903
+ fontSize: rem(14),
904
+ fontWeight: 400,
905
+ [theme.fn.smallerThan('sm')]: {
906
+ fontSize: rem(12),
907
+ lineHeight: rem(16),
908
+ height: rem(40),
909
+ },
910
+ },
911
+ leftIcon: {
912
+ marginRight: '5px',
913
+ },
914
+ }) },
915
+ React__default.createElement(Text, { size: isMobile ? 'p3' : 'p4' }, t('home.seeMore')))), [form]);
916
+ useEffect(() => {
917
+ form.setFieldValue('fitnessTopics', selectCategory.map((i) => i.catId));
918
+ }, [selectCategory]);
919
+ return (React__default.createElement("form", { style: { height: '100%' }, onSubmit: form.onSubmit(onSubmit) },
920
+ React__default.createElement(Layout, { heading: t('healthToolPNModal.heading'), stickyActions: React__default.createElement(React__default.Fragment, null,
921
+ React__default.createElement(Button, { fullWidth: true, type: "submit", dataEventCategory: "Newsletter", dataEventAction: "Register Click", dataEventLabel: currentUrl, loading: submitLoading, sx: { maxWidth: rem(240) } }, t('healthToolPNModal.register'))) },
922
+ React__default.createElement(Stack, { spacing: rem(16) },
923
+ React__default.createElement(Input, Object.assign({ label: t('newsletter.welcome.description') }, form.getInputProps('name'))),
924
+ React__default.createElement(TopicSection, { topicsGroup: [
925
+ ...(pnSuggestCategory.length === 0 &&
926
+ interestedTopics.length === 0
927
+ ? [
928
+ {
929
+ topics: [
930
+ {
931
+ component: MoreButton,
932
+ },
933
+ ],
934
+ },
935
+ ]
936
+ : []),
937
+ ...(pnSuggestCategory.length > 0
938
+ ? [
939
+ {
940
+ label: t('healthToolPNModal.mainForm.tailorTopicsHeading'),
941
+ topics: [
942
+ ...pnSuggestCategory,
943
+ ...(interestedTopics.length === 0
944
+ ? [
945
+ {
946
+ component: MoreButton,
947
+ },
948
+ ]
949
+ : []),
950
+ ],
951
+ },
952
+ ]
953
+ : []),
954
+ ...(interestedTopics.length > 0
955
+ ? [
956
+ {
957
+ label: t('healthToolPNModal.findMore.chooseFav'),
958
+ topics: [
959
+ ...interestedTopics,
960
+ ...(interestedTopics.length > 0
961
+ ? [
962
+ {
963
+ component: MoreButton,
964
+ },
965
+ ]
966
+ : []),
967
+ ],
968
+ },
969
+ ]
970
+ : []),
971
+ ], selectedTopics: [...fitnessTopics], labelProps: {
972
+ size: isMobile ? 'p3' : 'p4',
973
+ color: 'gray.6',
974
+ }, onTopicChange: setSelectCategory, maxSelect: maxSelectCategory })))));
975
+ };
976
+
977
+ const _SuggestedTopic = forwardRef(function SuggestedTopic(_a, ref) {
978
+ var { label } = _a, others = __rest(_a, ["label"]);
979
+ return (React__default.createElement("div", Object.assign({ ref: ref }, others),
980
+ React__default.createElement(Group, { noWrap: true },
981
+ React__default.createElement("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" },
982
+ React__default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.97887 8.15493C2.97887 5.29627 5.29627 2.97887 8.15493 2.97887C11.0136 2.97887 13.331 5.29627 13.331 8.15493C13.331 11.0136 11.0136 13.331 8.15493 13.331C5.29627 13.331 2.97887 11.0136 2.97887 8.15493ZM8.15493 1.5C4.47951 1.5 1.5 4.47951 1.5 8.15493C1.5 11.8303 4.47951 14.8099 8.15493 14.8099C9.72615 14.8099 11.1702 14.2653 12.3086 13.3547L15.2376 16.2837C15.5264 16.5725 15.9946 16.5725 16.2833 16.2837C16.5721 15.9949 16.5721 15.5267 16.2833 15.238L13.3544 12.3091C14.2652 11.1705 14.8099 9.72634 14.8099 8.15493C14.8099 4.47951 11.8303 1.5 8.15493 1.5Z", fill: "#8C8C8C" })),
983
+ React__default.createElement(Text, { size: "p3" }, label))));
984
+ });
985
+
986
+ const _Topic = forwardRef(function Baby(_a, ref) {
987
+ var { label } = _a, others = __rest(_a, ["label"]);
988
+ return (React__default.createElement("div", Object.assign({ ref: ref }, others),
989
+ React__default.createElement(Text, { size: "p3" }, label)));
990
+ });
991
+
992
+ const HistorySection = ({ history, onDelete }) => {
993
+ return (React__default.createElement(Flex, { wrap: 'wrap', gap: 8 }, uniqBy(history, 'catId').map((h) => (React__default.createElement(Badge, { key: h.catId, rightSection: React__default.createElement("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", onClick: () => onDelete === null || onDelete === void 0 ? void 0 : onDelete(h) },
994
+ React__default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1.5 9C1.5 4.8525 4.8525 1.5 9 1.5C13.1475 1.5 16.5 4.8525 16.5 9C16.5 13.1475 13.1475 16.5 9 16.5C4.8525 16.5 1.5 13.1475 1.5 9ZM11.1677 12.2248C11.4602 12.5173 11.9327 12.5173 12.2252 12.2248C12.5101 11.9323 12.5101 11.4523 12.2252 11.1673L10.0577 8.99979L12.2252 6.83229C12.5177 6.53979 12.5177 6.0673 12.2252 5.7748C11.9327 5.4823 11.4602 5.4823 11.1677 5.7748L9.00015 7.9423L6.83265 5.7748C6.54015 5.4823 6.06765 5.4823 5.77515 5.7748C5.63471 5.91492 5.55579 6.10516 5.55579 6.30354C5.55579 6.50193 5.63471 6.69217 5.77515 6.83229L7.94265 8.99979L5.77515 11.1673C5.63471 11.3074 5.55579 11.4977 5.55579 11.696C5.55579 11.8944 5.63471 12.0847 5.77515 12.2248C6.06765 12.5173 6.54015 12.5173 6.83265 12.2248L9.00015 10.0573L11.1677 12.2248Z", fill: "#8C8C8C" })), styles: {
995
+ root: {
996
+ height: 32,
997
+ background: '#ffffff',
998
+ padding: '5px 12px',
999
+ border: `1px solid ${themeColors.neutral[4]}`,
1000
+ borderRadius: 32,
1001
+ textTransform: 'unset',
1002
+ },
1003
+ rightSection: {
1004
+ height: 18,
1005
+ cursor: 'pointer',
1006
+ },
1007
+ } },
1008
+ React__default.createElement(Text, { size: "p4" }, h.localName))))));
1009
+ };
1010
+
1011
+ const RecentlyViewedSection = ({ topics, onTopicChange, isBlock = false, selectedTopics, labelProps, maxSelect = 5, }) => {
1012
+ const { action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
1013
+ const [value, setValue] = useState([]);
1014
+ const { t } = useTranslations();
1015
+ useEffect(() => {
1016
+ setValue(selectedTopics);
1017
+ }, [selectedTopics.length]);
1018
+ useEffect(() => {
1019
+ onTopicChange(value);
1020
+ }, [value]);
1021
+ const onValueChange = (v) => {
1022
+ if (isBlock && value.length < v.length) {
1023
+ pushNotifications({
1024
+ type: 'danger',
1025
+ title: t('pnTopicSection.maxSelectError.title', {
1026
+ maxSelect,
1027
+ }),
1028
+ message: t('pnTopicSection.maxSelectError.desc'),
1029
+ });
1030
+ return;
1031
+ }
1032
+ else {
1033
+ setValue(() => {
1034
+ return topics.filter((topicObj) => v.some((tValue) => topicObj.catId === tValue));
1035
+ });
1036
+ }
1037
+ };
1038
+ if (!topics || topics.length === 0)
1039
+ return null;
1040
+ return (React__default.createElement(Stack, { spacing: 12, px: 16, mx: -16 },
1041
+ React__default.createElement(Text, Object.assign({ size: "s5", color: "gray.4", weight: "semiBold" }, labelProps), t('pnTopicSection.recentView')),
1042
+ React__default.createElement(Chip.Group, { value: value.map((v) => v.catId), onChange: onValueChange, multiple: true },
1043
+ React__default.createElement(Flex, { gap: 8, wrap: 'wrap' }, topics.map((v, i) => (React__default.createElement(_NormalTopic, { key: i, value: v.catId, name: v.localName, isBlock: isBlock })))))));
1044
+ };
1045
+
1046
+ const _TopicSlide = (_a) => {
1047
+ var { topic, active, onClick } = _a, rest = __rest(_a, ["topic", "active", "onClick"]);
1048
+ return (React__default.createElement(Box, Object.assign({ sx: (theme) => ({
1049
+ position: 'relative',
1050
+ cursor: 'pointer',
1051
+ padding: 2,
1052
+ borderRadius: 8,
1053
+ boxShadow: '0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 2px rgba(0, 0, 0, 0.06), 0px 0px 1px rgba(0, 0, 0, 0.04)',
1054
+ minHeight: rem(130),
1055
+ [theme.fn.largerThan('sm')]: {
1056
+ minHeight: rem(138),
1057
+ },
1058
+ }), onClick: () => onClick(topic, active) }, rest),
1059
+ active && (React__default.createElement(Box, { id: "test", sx: {
1060
+ position: 'absolute',
1061
+ top: 2,
1062
+ right: 2,
1063
+ width: 20,
1064
+ height: 20,
1065
+ zIndex: 1,
1066
+ } },
1067
+ React__default.createElement("svg", { id: "test", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" },
1068
+ React__default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1.66699 9.99984C1.66699 5.39984 5.40033 1.6665 10.0003 1.6665C14.6003 1.6665 18.3337 5.39984 18.3337 9.99984C18.3337 14.5998 14.6003 18.3332 10.0003 18.3332C5.40033 18.3332 1.66699 14.5998 1.66699 9.99984ZM4.75066 10.5827L7.74232 13.5744C8.06732 13.8994 8.60066 13.8994 8.91732 13.5744L15.2423 7.2494C15.5673 6.9244 15.5673 6.3994 15.2423 6.0744C14.9173 5.7494 14.3923 5.7494 14.0673 6.0744L8.33399 11.8077L5.92566 9.40773C5.60066 9.08273 5.07566 9.08273 4.75066 9.40773C4.59461 9.56342 4.50692 9.7748 4.50692 9.99523C4.50692 10.2157 4.59461 10.427 4.75066 10.5827Z", fill: "#2D87F3" }),
1069
+ React__default.createElement("path", { d: "M7.74224 13.5772L4.75057 10.5856C4.59453 10.4299 4.50684 10.2185 4.50684 9.99808C4.50684 9.77765 4.59453 9.56627 4.75057 9.41058C5.07557 9.08558 5.60057 9.08558 5.92557 9.41058L8.33391 11.8106L14.0672 6.07725C14.3922 5.75225 14.9172 5.75225 15.2422 6.07725C15.5672 6.40225 15.5672 6.92725 15.2422 7.25225L8.91724 13.5772C8.60057 13.9022 8.06724 13.9022 7.74224 13.5772Z", fill: "white" })))),
1070
+ React__default.createElement(Box, { sx: { borderRadius: '8px' } },
1071
+ React__default.createElement(AspectRatio$1, { ratio: 3 / 2, mb: 10, sx: (theme) => ({
1072
+ background: theme.colors.neutral[0],
1073
+ }) },
1074
+ React__default.createElement(Box, null,
1075
+ React__default.createElement("img", { src: topic.guid || '', alt: "cat", loading: "lazy", style: {
1076
+ maxHeight: '63px',
1077
+ } })))),
1078
+ React__default.createElement(Text, { size: "p4", ta: "center", px: 6, sx: {
1079
+ display: '-webkit-box',
1080
+ '-webkit-line-clamp': '2',
1081
+ '-webkit-box-orient': 'vertical',
1082
+ overflow: 'hidden',
1083
+ } }, topic.localName || '')));
1084
+ };
1085
+
1086
+ const TrendingCarousel = ({ topics, selectedTopics = [], onTopicChange, isBlock = false, labelProps, pushNotifications, maxSelect = 5, }) => {
1087
+ const { t } = useTranslations();
1088
+ const [carouselTopics, setCarouselTopics] = useState([]);
1089
+ const onSelect = (topic, status) => {
1090
+ if (status) {
1091
+ setCarouselTopics((pre) => pre.filter((t) => t.catId !== topic.catId));
1092
+ }
1093
+ else {
1094
+ if (isBlock) {
1095
+ pushNotifications({
1096
+ type: 'danger',
1097
+ title: t('pnTopicSection.maxSelectError.title', {
1098
+ maxSelect,
1099
+ }),
1100
+ message: t('pnTopicSection.maxSelectError.desc'),
1101
+ });
1102
+ return;
1103
+ }
1104
+ setCarouselTopics((pre) => [...pre, topic]);
1105
+ }
1106
+ };
1107
+ useEffect(() => {
1108
+ setCarouselTopics(selectedTopics);
1109
+ }, [selectedTopics.length]);
1110
+ useEffect(() => {
1111
+ onTopicChange(carouselTopics);
1112
+ }, [carouselTopics]);
1113
+ const [isDragging, setIsDragging] = useState(false);
1114
+ const [startX, setStartX] = useState(0);
1115
+ const [scrollLeft, setScrollLeft] = useState(0);
1116
+ const containerRef = useRef(null);
1117
+ const handleMouseDown = (e) => {
1118
+ e.preventDefault();
1119
+ if (!containerRef.current)
1120
+ return;
1121
+ setIsDragging(true);
1122
+ setStartX(e.pageX - containerRef.current.offsetLeft);
1123
+ setScrollLeft(containerRef.current.scrollLeft);
1124
+ };
1125
+ const handleMouseUp = () => {
1126
+ setIsDragging(false);
1127
+ };
1128
+ const handleMouseMove = (e) => {
1129
+ e.preventDefault();
1130
+ if (!isDragging || !containerRef.current)
1131
+ return;
1132
+ const x = e.pageX - containerRef.current.offsetLeft;
1133
+ const walk = (x - startX) * 2; // adjust scroll speed
1134
+ containerRef.current.scrollLeft = scrollLeft - walk;
1135
+ };
1136
+ return (React__default.createElement(Stack, { spacing: 10 },
1137
+ React__default.createElement(Flex, { justify: 'space-between', align: 'center', w: "100%" },
1138
+ React__default.createElement(Text, Object.assign({ size: "s5", color: "gray.4", weight: "semiBold", span: true }, labelProps), t('pnTopicSection.trending'))),
1139
+ React__default.createElement(Box, null,
1140
+ React__default.createElement(ScrollArea, { type: "always", w: "100%", offsetScrollbars: true, scrollbarSize: 4, px: 4, viewportRef: containerRef, viewportProps: {
1141
+ onMouseDown: handleMouseDown,
1142
+ onMouseUp: handleMouseUp,
1143
+ onMouseLeave: handleMouseUp,
1144
+ onMouseMove: handleMouseMove,
1145
+ }, styles: {
1146
+ viewport: {
1147
+ paddingBottom: 16,
1148
+ },
1149
+ } },
1150
+ React__default.createElement(Box, { w: { base: 112 * topics.length + 8 * (topics.length - 1) + 10 } },
1151
+ React__default.createElement(Flex, { gap: 8 }, topics.map((topic, index) => (React__default.createElement(_TopicSlide, { key: index, topic: topic, onClick: onSelect, active: carouselTopics.some((t) => t.catId === topic.catId), w: { base: 112 } })))))))));
1152
+ };
1153
+
1154
+ const PremiumTopicSelect = (_a) => {
1155
+ var { isLoggedIn, maxSelect = 5, values: _values = [], labelProps, onChange } = _a, rest = __rest(_a, ["isLoggedIn", "maxSelect", "values", "labelProps", "onChange"]);
1156
+ const { action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
1157
+ const [searchValue, onSearchChange] = useState('');
1158
+ const { t, locale } = useTranslations();
1159
+ const ref = useRef(null);
1160
+ const [history, setHistory] = useState([]);
1161
+ const [carouselTopics, setCarouselTopics] = useState([]);
1162
+ const [recentlyViewedTopics, setRecentlyViewedTopics] = useState([]);
1163
+ const [interestedTopics, setInterestedTopics] = useState([]);
1164
+ const [newsletterCategory, setNewsletterCategory] = useState(null);
1165
+ const [options, setOptions] = useState([]);
1166
+ useEffect(() => {
1167
+ (() => __awaiter(void 0, void 0, void 0, function* () {
1168
+ var _a, _b;
1169
+ const response = yield callApiWithAuth(getPremiumApiPath(PATHS$1.GET_NEWSLETTER_CATEGORIES, { _locale: locale }), 'get');
1170
+ const interested = ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.interested) || [];
1171
+ const trending = ((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.trending) || [];
1172
+ const uniqueTopics = uniqBy([...interested, ...trending], 'catId');
1173
+ const _options = uniqueTopics.map((topic) => (Object.assign(Object.assign({}, topic), { value: topic.catId || '', label: topic.localName || '' })));
1174
+ setOptions(_options || []);
1175
+ setNewsletterCategory((response === null || response === void 0 ? void 0 : response.data) || null);
1176
+ if (_values.length > 0) {
1177
+ const interestedSelectedTopics = interested
1178
+ .filter((i) => _values.includes(i.catId))
1179
+ .map((i) => (Object.assign(Object.assign({}, i), { template: 'interested' })));
1180
+ const trendingSelectedTopics = trending
1181
+ .filter((i) => _values.includes(i.catId))
1182
+ .map((i) => (Object.assign(Object.assign({}, i), { template: 'trending' })));
1183
+ setInterestedTopics(interestedSelectedTopics);
1184
+ setCarouselTopics(trendingSelectedTopics);
1185
+ }
1186
+ }))();
1187
+ }, [isLoggedIn]);
1188
+ const onDelete = (category) => {
1189
+ const reducers = {
1190
+ trending: setCarouselTopics,
1191
+ recently: setRecentlyViewedTopics,
1192
+ interested: setInterestedTopics,
1193
+ default: setHistory,
1194
+ };
1195
+ const reducer = reducers[category.template] || reducers['default'];
1196
+ reducer((pre) => {
1197
+ const newHistory = [...pre];
1198
+ const position = newHistory.findIndex((t) => t.catId === category.catId);
1199
+ newHistory.splice(position, 1);
1200
+ return newHistory;
1201
+ });
1202
+ };
1203
+ const uniqueTopic = useMemo(() => uniqBy([
1204
+ ...history,
1205
+ ...carouselTopics,
1206
+ ...interestedTopics,
1207
+ ...recentlyViewedTopics,
1208
+ ], 'catId'), [history, carouselTopics, interestedTopics, recentlyViewedTopics]);
1209
+ const [isBlock, setIsBlock] = useState(false);
1210
+ useEffect(() => {
1211
+ if (uniqueTopic.length >= maxSelect) {
1212
+ setIsBlock(true);
1213
+ }
1214
+ else {
1215
+ setIsBlock(false);
1216
+ }
1217
+ onChange === null || onChange === void 0 ? void 0 : onChange(uniqueTopic);
1218
+ }, [uniqueTopic]);
1219
+ const onValueChange = (value) => __awaiter(void 0, void 0, void 0, function* () {
1220
+ var _b;
1221
+ const reducers = {
1222
+ trending: setCarouselTopics,
1223
+ recently: setRecentlyViewedTopics,
1224
+ interested: setInterestedTopics,
1225
+ default: setHistory,
1226
+ };
1227
+ let key = 'default';
1228
+ if (!isBlock) {
1229
+ const categoryArrays = [
1230
+ { key: 'trending', array: newsletterCategory === null || newsletterCategory === void 0 ? void 0 : newsletterCategory.trending },
1231
+ { key: 'recently', array: newsletterCategory === null || newsletterCategory === void 0 ? void 0 : newsletterCategory.recently },
1232
+ { key: 'interested', array: newsletterCategory === null || newsletterCategory === void 0 ? void 0 : newsletterCategory.interested },
1233
+ ];
1234
+ const matchingArray = categoryArrays.find((category) => { var _a; return (_a = category.array) === null || _a === void 0 ? void 0 : _a.some((cat) => cat.catId === value[0]); });
1235
+ key = (matchingArray === null || matchingArray === void 0 ? void 0 : matchingArray.key) || 'default';
1236
+ reducers[key]((pre) => [
1237
+ ...pre,
1238
+ ...options.filter((topicObj) => value.some((tValue) => topicObj.catId === tValue)),
1239
+ ].map((t) => (Object.assign(Object.assign({}, t), { template: key }))));
1240
+ (_b = ref.current) === null || _b === void 0 ? void 0 : _b.blur();
1241
+ }
1242
+ else {
1243
+ pushNotifications({
1244
+ type: 'danger',
1245
+ title: t('pnTopicSection.maxSelectError.title', {
1246
+ maxSelect,
1247
+ }),
1248
+ message: t('pnTopicSection.maxSelectError.desc'),
1249
+ });
1250
+ }
1251
+ return null;
1252
+ });
1253
+ return (React__default.createElement(Stack, Object.assign({ spacing: rem(16) }, rest),
1254
+ React__default.createElement(Stack, { spacing: rem(8) },
1255
+ React__default.createElement(Text, { size: "p3" }, t('pnTopicSection.maxSelectError.detail', {
1256
+ max: maxSelect,
1257
+ maxTopic: uniqueTopic.length,
1258
+ })),
1259
+ React__default.createElement(MultiSelect, { ref: ref, maxSelectedValues: 3, styles: {
1260
+ wrapper: {
1261
+ overflow: 'initial !important',
1262
+ },
1263
+ separator: {
1264
+ padding: 16,
1265
+ },
1266
+ separatorLabel: {
1267
+ fontWeight: 600,
1268
+ fontSize: 12,
1269
+ lineHeight: '18px',
1270
+ textTransform: 'uppercase',
1271
+ color: themeColors.gray[4],
1272
+ '&::after': { display: 'none' },
1273
+ },
1274
+ searchInput: {
1275
+ fontSize: 'inherit',
1276
+ },
1277
+ input: {
1278
+ paddingRight: 16,
1279
+ },
1280
+ }, nothingFound: React__default.createElement(Text, { size: "s4", color: "gray.6" }, t('pnTopicSection.notFound')), itemComponent: searchValue === '' ? _SuggestedTopic : _Topic, size: "lg", placeholder: t('pnTopicSection.plsEnterFavTopics'), data: options, onSearchChange: onSearchChange, searchValue: searchValue, icon: React__default.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" },
1281
+ React__default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.97183 10.8732C3.97183 7.0617 7.0617 3.97183 10.8732 3.97183C14.6848 3.97183 17.7746 7.0617 17.7746 10.8732C17.7746 14.6848 14.6848 17.7746 10.8732 17.7746C7.0617 17.7746 3.97183 14.6848 3.97183 10.8732ZM10.8732 2C5.97268 2 2 5.97268 2 10.8732C2 15.7738 5.97268 19.7465 10.8732 19.7465C12.9682 19.7465 14.8936 19.0205 16.4115 17.8063L20.3168 21.7116C20.7018 22.0966 21.3261 22.0966 21.7111 21.7116C22.0961 21.3266 22.0961 20.7023 21.7111 20.3173L17.8059 16.4121C19.0203 14.894 19.7465 12.9684 19.7465 10.8732C19.7465 5.97268 15.7738 2 10.8732 2Z", fill: "#595959" })), rightSection: React__default.createElement(React__default.Fragment, null), zIndex: 500, searchable: true, withinPortal: true, onChange: (val) => onValueChange(val), value: [] }),
1282
+ uniqueTopic && uniqueTopic.length > 0 && (React__default.createElement(HistorySection, { history: uniqueTopic, onDelete: onDelete }))),
1283
+ React__default.createElement(Box, { sx: (theme) => ({
1284
+ position: 'relative',
1285
+ height: rem(175),
1286
+ [theme.fn.largerThan('sm')]: {
1287
+ height: rem(190),
1288
+ },
1289
+ }) },
1290
+ React__default.createElement(Box, { sx: {
1291
+ position: 'absolute',
1292
+ top: 0,
1293
+ right: 0,
1294
+ left: 0,
1295
+ } },
1296
+ React__default.createElement(TrendingCarousel, { topics: ((newsletterCategory === null || newsletterCategory === void 0 ? void 0 : newsletterCategory.trending) || []).map((t) => (Object.assign(Object.assign({}, t), { template: 'trending' }))), selectedTopics: carouselTopics, onTopicChange: setCarouselTopics, isBlock: isBlock, labelProps: labelProps }))),
1297
+ React__default.createElement(RecentlyViewedSection, { topics: ((newsletterCategory === null || newsletterCategory === void 0 ? void 0 : newsletterCategory.recently) || []).map((t) => (Object.assign(Object.assign({}, t), { template: 'recently' }))), selectedTopics: recentlyViewedTopics, onTopicChange: setRecentlyViewedTopics, isBlock: isBlock, labelProps: labelProps }),
1298
+ React__default.createElement(TopicSection, { labelProps: labelProps, topicsGroup: [
1299
+ {
1300
+ label: t('pnTopicSection.ppAlsoInterested'),
1301
+ topics: ((newsletterCategory === null || newsletterCategory === void 0 ? void 0 : newsletterCategory.interested) || []).map((t) => (Object.assign(Object.assign({}, t), { template: 'interested' }))),
1302
+ },
1303
+ ], selectedTopics: interestedTopics, onTopicChange: setInterestedTopics, isBlock: isBlock })));
1304
+ };
1305
+
1306
+ const MoreTopics = () => {
1307
+ const { t } = useTranslations();
1308
+ const { action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
1309
+ const { prevStep, formValues, submitLoading, onSubmit, selectCategory, maxSelectCategory, setSelectCategory, currentUrl, isLoggedIn, } = useContext(PremiumNewsletterModalContext);
1310
+ const handleOnSubmit = () => {
1311
+ if (selectCategory.length === 0) {
1312
+ pushNotifications({
1313
+ type: 'danger',
1314
+ title: t('newsletter.error.minTitle'),
1315
+ message: t('newsletter.error.minCotennt'),
1316
+ });
1317
+ return false;
1318
+ }
1319
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(formValues.name);
1320
+ };
1321
+ return (React__default.createElement(Layout, { heading: t('newsletter.topic.title'), type: "always", styles: {
1322
+ root: {
1323
+ paddingRight: rem(25),
1324
+ },
1325
+ }, stickyActions: React__default.createElement(React__default.Fragment, null,
1326
+ React__default.createElement(Button, { fullWidth: true, variant: "secondary", dataEventCategory: "Newsletter", dataEventAction: "Back Click", dataEventLabel: currentUrl, onClick: prevStep }, t('healthToolPNModal.back')),
1327
+ React__default.createElement(Button, { fullWidth: true, type: "submit", dataEventCategory: "Newsletter", dataEventAction: "Next Click", dataEventLabel: currentUrl, onClick: handleOnSubmit, loading: submitLoading }, t('healthToolPNModal.next'))) },
1328
+ React__default.createElement(PremiumTopicSelect, { isLoggedIn: isLoggedIn, maxSelect: maxSelectCategory, values: formValues.fitnessTopics, onChange: setSelectCategory, labelProps: {
1329
+ size: 's5',
1330
+ sx: {
1331
+ textTransform: 'uppercase',
1332
+ },
1333
+ } })));
1334
+ };
1335
+
1336
+ const Result = () => {
1337
+ const { t } = useTranslations();
1338
+ const { close, selectCategory, onRegisterSuccess, currentUrl, finishLabelOnResult, disclaimerText, } = useContext(PremiumNewsletterModalContext);
1339
+ useEffect(() => {
1340
+ return () => {
1341
+ setTimeout(() => {
1342
+ onRegisterSuccess === null || onRegisterSuccess === void 0 ? void 0 : onRegisterSuccess();
1343
+ }, 400);
1344
+ };
1345
+ }, []);
1346
+ return (React__default.createElement(Layout, { heading: t('healthToolPNModal.heading'), stickyActions: React__default.createElement(Button, { fullWidth: true, sx: { maxWidth: rem(300) }, dataEventCategory: "Newsletter", dataEventAction: "Continue Reading Click", dataEventLabel: currentUrl, onClick: () => {
1347
+ close();
1348
+ } }, finishLabelOnResult || t('healthToolPNModal.finish')) },
1349
+ React__default.createElement(Stack, null,
1350
+ React__default.createElement(Flex, { gap: rem(8), sx: (theme) => ({
1351
+ background: theme.colors.green[0],
1352
+ border: `1px solid ${theme.colors.green[1]}`,
1353
+ borderRadius: rem(8),
1354
+ padding: rem(8),
1355
+ }) },
1356
+ React__default.createElement(Box, null,
1357
+ React__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" },
1358
+ React__default.createElement("path", { d: "M9.99984 18.3334C14.6022 18.3334 18.3332 14.6025 18.3332 10.0001C18.3332 5.39771 14.6022 1.66675 9.99984 1.66675C5.39746 1.66675 1.6665 5.39771 1.6665 10.0001C1.6665 14.6025 5.39746 18.3334 9.99984 18.3334Z", fill: "#00B16A" }),
1359
+ React__default.createElement("path", { d: "M9.58558 12.6674C9.22944 12.668 8.87668 12.5983 8.54752 12.4623C8.21835 12.3264 7.91925 12.1268 7.66732 11.8751L6.68587 10.8931C6.55607 10.7587 6.48424 10.5787 6.48587 10.3919C6.48749 10.2051 6.56243 10.0263 6.69455 9.89422C6.82667 9.7621 7.00539 9.68716 7.19222 9.68554C7.37906 9.68391 7.55906 9.75574 7.69345 9.88554L8.67491 10.8675C8.79344 10.986 8.93415 11.08 9.08902 11.1442C9.24389 11.2083 9.40987 11.2413 9.5775 11.2413C9.74513 11.2413 9.91111 11.2083 10.066 11.1442C10.2208 11.08 10.3616 10.986 10.4801 10.8675L16.7033 5.24335C16.8443 5.12184 17.0272 5.06032 17.213 5.07195C17.3987 5.08358 17.5726 5.16744 17.6973 5.30558C17.8221 5.44373 17.8878 5.6252 17.8805 5.81118C17.8731 5.99717 17.7933 6.17291 17.6581 6.30081L11.4592 11.8998C11.2128 12.1448 10.9205 12.3387 10.5989 12.4705C10.2774 12.6022 9.93304 12.6692 9.58558 12.6674Z", fill: "white" }))),
1360
+ React__default.createElement(Text, { size: "p3" }, disclaimerText || t('pnModal.disclaimer'))),
1361
+ React__default.createElement(Heading, { tag: "h5" }, t('healthToolPNModal.yourPre')),
1362
+ selectCategory.length > 0 && (React__default.createElement(TopicSection, { topicsGroup: [{ label: '', topics: selectCategory }], selectedTopics: selectCategory, readonly: true })))));
1363
+ };
1364
+
1365
+ const PremiumNewsletterModal = ({ isMobile, isLoggedIn, pnSuggestCategory = [], acquisitionInfo, currentUrl, opened, close, finishLabelOnResult, onRegisterSuccess, disclaimerText, }) => {
1366
+ const { t, locale } = useTranslations();
1367
+ const { action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
1368
+ const desktopBanner = CommonGAssets.getAssetPath('premiumNewsletter/side-banner-desktop.jpg');
1369
+ const mobileBanner = CommonGAssets.getAssetPath('premiumNewsletter/side-banner-mobile.jpg');
1370
+ const [categoryLibs, setCategoryLibs] = useState([]);
1371
+ const [selectCategory, setSelectCategory] = useState([]);
1372
+ const [activeStep, setActiveStep] = useState(0);
1373
+ const [formValues, setFormValues] = useState({
1374
+ name: '',
1375
+ fitnessTopics: [],
1376
+ });
1377
+ const [submitLoading, setSubmitLoading] = useState(false);
1378
+ const nextStep = () => setActiveStep((current) => (current < 3 ? current + 1 : current));
1379
+ const prevStep = () => setActiveStep((current) => (current > 0 ? current - 1 : current));
1380
+ const lastStep = () => setActiveStep(2);
1381
+ const handleSubscription = useCallback((name) => __awaiter(void 0, void 0, void 0, function* () {
1382
+ try {
1383
+ setSubmitLoading(true);
1384
+ yield callApiWithAuth(getPremiumApiPath(PATHS$1.POST_SUBSCRIPTION, {
1385
+ website_url: getWebsiteUrlApi(locale),
1386
+ }), 'post', {
1387
+ headers: {
1388
+ 'Content-Type': 'application/json',
1389
+ },
1390
+ method: 'POST',
1391
+ data: {
1392
+ ga_client_id: Cookies.get(GA_TOKEN_COOKIE),
1393
+ client_ip: window.clientIP || '',
1394
+ user_info: Object.assign(Object.assign({}, acquisitionInfo.userInfo), { name: name || formValues.name, type_subscription: 1 }),
1395
+ domain: domainLocales[locale || LOCALE.Vietnam],
1396
+ category: selectCategory,
1397
+ perferred: acquisitionInfo.preferredTopics.map(({ id }) => ({
1398
+ id,
1399
+ })),
1400
+ },
1401
+ });
1402
+ setSubmitLoading(false);
1403
+ // if (subscripRes?._data?.status === 1) {
1404
+ yield callApiWithAuth(getSsoApiPath(PATHS.UPDATE_SUBSCRIPTION), 'post', {
1405
+ headers: {
1406
+ 'Content-Type': 'application/json',
1407
+ },
1408
+ method: 'PUT',
1409
+ data: {
1410
+ subscription: 1,
1411
+ },
1412
+ });
1413
+ // if (res?.code === 0) {
1414
+ // onRegisterSuccess?.()
1415
+ lastStep();
1416
+ // } else {
1417
+ // pushNotifications({
1418
+ // title: f({ id: 'notification.comment.somethingWrong' }),
1419
+ // message: '',
1420
+ // type: 'danger',
1421
+ // })
1422
+ // }
1423
+ // } else {
1424
+ // pushNotifications({
1425
+ // title: f({ id: 'notification.comment.somethingWrong' }),
1426
+ // message: '',
1427
+ // type: 'danger',
1428
+ // })
1429
+ // }
1430
+ }
1431
+ catch (err) {
1432
+ console.log({ err });
1433
+ setSubmitLoading(false);
1434
+ pushNotifications({
1435
+ title: t('notification.comment.somethingWrong'),
1436
+ message: '',
1437
+ type: 'danger',
1438
+ });
1439
+ }
1440
+ }), [formValues, selectCategory]);
1441
+ useEffect(() => {
1442
+ const preloadList = [desktopBanner, mobileBanner];
1443
+ preloadList.forEach((image) => {
1444
+ const newImage = new Image();
1445
+ newImage.src = image;
1446
+ });
1447
+ }, []);
1448
+ return (React__default.createElement(PremiumNewsletterModalContext.Provider, { value: {
1449
+ currentUrl,
1450
+ isMobile,
1451
+ isLoggedIn,
1452
+ opened,
1453
+ close: close,
1454
+ pnSuggestCategory,
1455
+ nextStep,
1456
+ prevStep,
1457
+ lastStep,
1458
+ categoryLibs,
1459
+ setCategoryLibs,
1460
+ selectCategory,
1461
+ setSelectCategory,
1462
+ formValues,
1463
+ setFormValues,
1464
+ maxSelectCategory: 5,
1465
+ submitLoading,
1466
+ onSubmit: handleSubscription,
1467
+ onRegisterSuccess,
1468
+ finishLabelOnResult,
1469
+ disclaimerText,
1470
+ } },
1471
+ React__default.createElement(SideBannerModal, { isMobile: isMobile, desktopBanner: CommonGAssets.getAssetPath('premiumNewsletter/side-banner-desktop.jpg'), mobileBanner: CommonGAssets.getAssetPath('premiumNewsletter/side-banner-mobile.jpg'), modalRatio: {
1472
+ width: 960,
1473
+ height: 588,
1474
+ }, desktopBannerRatio: {
1475
+ width: 384,
1476
+ height: 588,
1477
+ }, opened: opened, onClose: close, zIndex: 305, closeProps: {
1478
+ dataEventCategory: 'Newsletter',
1479
+ dataEventAction: 'Close Click',
1480
+ dataEventLabel: currentUrl,
1481
+ } },
1482
+ React__default.createElement(Stepper, { active: activeStep, onStepClick: setActiveStep, styles: {
1483
+ root: {
1484
+ height: '100%',
1485
+ },
1486
+ content: {
1487
+ padding: 0,
1488
+ height: '100%',
1489
+ width: '100%',
1490
+ },
1491
+ steps: {
1492
+ display: 'none',
1493
+ },
1494
+ } },
1495
+ React__default.createElement(Stepper.Step, null,
1496
+ React__default.createElement(MainForm, null)),
1497
+ React__default.createElement(Stepper.Step, null,
1498
+ React__default.createElement(MoreTopics, null)),
1499
+ React__default.createElement(Stepper.Step, null,
1500
+ React__default.createElement(Result, null))))));
1501
+ };
1502
+
1503
+ const SurveyBanner = () => {
1504
+ const { locale } = useTranslations();
1505
+ const { isMobile, isLoggedIn, currentUrl, acquisitionInfo, categoryIds, state, setState, settings, submitHandler, subcribeHealthStatus, showPNModal, setShowPNModal, setIsBack, } = useContext(SurveyOrPremiumBannerContext);
1506
+ const [pnSuggestCategory, setPnSuggestCategory] = useState([]);
1507
+ const [showModal, setShowModal] = useState(showPNModal);
1508
+ useEffect(() => {
1509
+ (() => __awaiter(void 0, void 0, void 0, function* () {
1510
+ var _a, _b;
1511
+ const pnRes = yield callApiWithAuth(getPremiumApiPath(PATHS$1.GET_NEWSLETTER_CATEGORIES, {
1512
+ _locale: locale,
1513
+ }), 'get');
1514
+ const interested = ((_a = pnRes === null || pnRes === void 0 ? void 0 : pnRes.data) === null || _a === void 0 ? void 0 : _a.interested) || [];
1515
+ const trending = ((_b = pnRes === null || pnRes === void 0 ? void 0 : pnRes.data) === null || _b === void 0 ? void 0 : _b.trending) || [];
1516
+ const allTopics = [...interested, ...trending];
1517
+ setPnSuggestCategory(allTopics.filter((i) => categoryIds.includes(Number(i.catId))));
1518
+ }))();
1519
+ }, []);
1520
+ const lastSubcribeHealthStatus = useRef([]);
1521
+ useEffect(() => {
1522
+ const selectedStep = (subcribeHealthStatus === null || subcribeHealthStatus === void 0 ? void 0 : subcribeHealthStatus.value) || '';
1523
+ const splitSelectedStep = selectedStep.split('|').filter(Boolean);
1524
+ let selectedStepVerify = selectedStep;
1525
+ lastSubcribeHealthStatus.current.push(subcribeHealthStatus);
1526
+ if (splitSelectedStep.length > 1) {
1527
+ if (lastSubcribeHealthStatus.current[0] !== null) {
1528
+ setIsBack(true);
1529
+ }
1530
+ Object.keys(submitHandler).map((submitKey) => {
1531
+ const submitKeyArr = submitKey.split('|');
1532
+ if (splitSelectedStep.length === submitKeyArr.length) {
1533
+ let countEqual = 0;
1534
+ splitSelectedStep.map((j) => {
1535
+ if (submitKeyArr.includes(String(j))) {
1536
+ countEqual += 1;
1537
+ }
1538
+ });
1539
+ if (countEqual === splitSelectedStep.length) {
1540
+ selectedStepVerify = submitKey;
1541
+ }
1542
+ }
1543
+ });
1544
+ }
1545
+ const stateProps = splitSelectedStep.length > 0
1546
+ ? submitHandler[selectedStepVerify]
1547
+ : settings;
1548
+ setState(stateProps);
1549
+ }, [subcribeHealthStatus]);
1550
+ useEffect(() => {
1551
+ setShowModal(showPNModal);
1552
+ }, [showPNModal]);
1553
+ return (state === null || state === void 0 ? void 0 : state.action) !== BannerAction.Hide ? (React__default.createElement(React__default.Fragment, null,
1554
+ React__default.createElement(HandlerBanner, Object.assign({}, settings.props)),
1555
+ React__default.createElement(PremiumNewsletterModal, { acquisitionInfo: acquisitionInfo, isMobile: isMobile, isLoggedIn: isLoggedIn, currentUrl: currentUrl, pnSuggestCategory: pnSuggestCategory, opened: showModal, close: () => {
1556
+ var _a;
1557
+ setShowModal(false);
1558
+ setShowPNModal(false);
1559
+ setTimeout(() => {
1560
+ var _a;
1561
+ if ((_a = state.actionParams) === null || _a === void 0 ? void 0 : _a.hideBannerWhenClose) {
1562
+ setState({
1563
+ action: BannerAction.Hide,
1564
+ });
1565
+ }
1566
+ }, 400);
1567
+ if ((_a = state.actionParams) === null || _a === void 0 ? void 0 : _a.hideBannerWhenClose) {
1568
+ setState({
1569
+ action: BannerAction.Hide,
1570
+ });
1571
+ }
1572
+ }, onRegisterSuccess: () => setShowModal(false) }))) : null;
1573
+ };
1574
+
1575
+ const SurveyOrPremiumBanner = ({ type, articleId = 0, categoryIds = [], isMarketing, isSurveyType, hasPremiumBanner, currentUrl, isMobile, subcribeHealthStatus, setShouldAcquisitionModalOpen, onValueChange, source = 'discover', Wrapper, }) => {
1576
+ const { t } = useTranslations();
1577
+ const { data: { userInfo }, } = useContext(TogetherComponentGlobalContext);
1578
+ const isLoggedIn = Boolean(userInfo === null || userInfo === void 0 ? void 0 : userInfo.id);
1579
+ const [acquisitionInfo, setAcquisitionInfo] = useState(null);
1580
+ const [state, setState] = useState();
1581
+ const [value, setValue] = useState('');
1582
+ const [showPNModal, setShowPNModal] = useState(false);
1583
+ const [isBack, setIsBack] = useState(false);
1584
+ const surveyType = useMemo(() => MAPPING_CATEGORY_PREMIUM_TYPE[type], []);
1585
+ const settings = FLOW(t, currentUrl)[surveyType];
1586
+ const submitHandler = settings === null || settings === void 0 ? void 0 : settings.submitHandler;
1587
+ const getMappingMultiValue = (value) => {
1588
+ let activeKeys = '';
1589
+ const valueArr = value.split('|');
1590
+ if (valueArr.length === 1)
1591
+ return value;
1592
+ Object.keys(submitHandler).map((submitKey) => {
1593
+ const submitKeyArr = submitKey.split('|');
1594
+ if (valueArr.length === submitKeyArr.length) {
1595
+ let countEqual = 0;
1596
+ valueArr.map((j) => {
1597
+ if (submitKeyArr.includes(String(j))) {
1598
+ countEqual += 1;
1599
+ }
1600
+ });
1601
+ if (countEqual === valueArr.length) {
1602
+ activeKeys = submitKey;
1603
+ }
1604
+ }
1605
+ });
1606
+ return activeKeys;
1607
+ };
1608
+ const handleClickOption = (value) => {
1609
+ const activeKeys = getMappingMultiValue(value);
1610
+ if (activeKeys) {
1611
+ const i = submitHandler[activeKeys];
1612
+ if (i.action === BannerAction.ShowPremiumModal) {
1613
+ if (hasPremiumBanner) {
1614
+ setShowPNModal(true);
1615
+ setState(Object.assign(Object.assign({}, state), { actionParams: {
1616
+ hideBannerWhenClose: i.action === BannerAction.ShowPremiumModal,
1617
+ } }));
1618
+ }
1619
+ else {
1620
+ setState({ action: BannerAction.Hide });
1621
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(value);
1622
+ }
1623
+ }
1624
+ else {
1625
+ setState(i);
1626
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(value);
1627
+ }
1628
+ }
1629
+ };
1630
+ const Outside = Wrapper || Box;
1631
+ const handleShowPNBannerFlowWhenLogin = () => hasPremiumBanner && (userInfo === null || userInfo === void 0 ? void 0 : userInfo.subscription) !== 1 ? React__default.createElement(PnBannerEle, null) : null;
1632
+ const handleShowSurveyBannerFlow = () => {
1633
+ const submitValue = submitHandler[(subcribeHealthStatus === null || subcribeHealthStatus === void 0 ? void 0 : subcribeHealthStatus.value) || ''];
1634
+ if ((submitValue === null || submitValue === void 0 ? void 0 : submitValue.action) === BannerAction.ShowPremiumModal) {
1635
+ return handleShowPNBannerFlowWhenLogin();
1636
+ }
1637
+ else {
1638
+ return React__default.createElement(SurveyBanner, null);
1639
+ }
1640
+ };
1641
+ useEffect(() => {
1642
+ if (isLoggedIn) {
1643
+ setAcquisitionInfo({
1644
+ userInfo,
1645
+ preferredTopics: PREFER_TOPICS,
1646
+ healthTopics: [],
1647
+ });
1648
+ }
1649
+ }, [isLoggedIn]);
1650
+ return (React__default.createElement(SurveyOrPremiumBannerContext.Provider, { value: {
1651
+ settings,
1652
+ submitHandler,
1653
+ type,
1654
+ surveyType,
1655
+ value,
1656
+ setValue,
1657
+ isMobile,
1658
+ isLoggedIn,
1659
+ isMarketing,
1660
+ hasPremiumBanner,
1661
+ currentUrl,
1662
+ acquisitionInfo,
1663
+ categoryIds,
1664
+ subcribeHealthStatus,
1665
+ articleId,
1666
+ onValueChange,
1667
+ state,
1668
+ setState,
1669
+ handleClickOption,
1670
+ showPNModal,
1671
+ setShowPNModal,
1672
+ source,
1673
+ Outside,
1674
+ isBack,
1675
+ setIsBack,
1676
+ minHeight: 180,
1677
+ setShouldAcquisitionModalOpen,
1678
+ } }, subcribeHealthStatus !== undefined ? (isLoggedIn ? (isSurveyType && settings ? (handleShowSurveyBannerFlow()) : (handleShowPNBannerFlowWhenLogin())) : hasPremiumBanner ? (React__default.createElement(PnBannerEle, null)) : null) : null));
1679
+ };
1680
+
1681
+ export { MAPPING_CATEGORY_PREMIUM_TYPE as M, SurveyOrPremiumBanner as S, MAPPING_CATEGORY_PREMIUM_API_TYPE as a, SideBannerModal as b };