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