@hhgtech/hhg-components 1.29.79 → 1.29.81

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