@hhgtech/hhg-components 1.29.88 → 1.29.89

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 (459) hide show
  1. package/build/{LastPeriod-235fc10e.js → LastPeriod-c8c46da3.js} +1 -1
  2. package/build/MobileBottomNavigationIcon-efacfc0c.js +193 -0
  3. package/build/{WhatsApp-e6406d8d.js → WhatsApp-8a1d6d0c.js} +1 -1
  4. package/build/adapters.js +18 -16
  5. package/build/atoms.js +47 -45
  6. package/build/babyGrowth.js +82 -80
  7. package/build/cache.js +2 -2
  8. package/build/care.js +28 -25
  9. package/build/careBookingSearchBar.js +1594 -0
  10. package/build/careBookingSearchBarV2.js +1665 -0
  11. package/build/components.js +125 -115
  12. package/build/{constants-2d046b25.js → constants-f5c5e2ae.js} +1 -1
  13. package/build/constants.js +3 -3
  14. package/build/constantsDomainLocales.js +1 -1
  15. package/build/constantsRiskScreener.js +2 -2
  16. package/build/constantsSite.js +2 -2
  17. package/build/{core-ab09e68b.js → core-58a245c5.js} +1 -1
  18. package/build/{dataTransform-945e5f4f.js → dataTransform-9ec385e3.js} +1 -1
  19. package/build/ecom.js +4 -4
  20. package/build/editor-40386fe7.js +986 -0
  21. package/build/embeddedHeathToolCards_babyGrowth.js +22 -20
  22. package/build/embeddedHeathToolCards_babyPoop.js +18 -16
  23. package/build/embeddedHeathToolCards_babyVaccine.js +21 -19
  24. package/build/embeddedHeathToolCards_bmi_bmi.js +25 -23
  25. package/build/embeddedHeathToolCards_bmrBmr.js +25 -23
  26. package/build/embeddedHeathToolCards_dueDate_dueDate.js +21 -19
  27. package/build/embeddedHeathToolCards_ovulation_ovulation.js +21 -19
  28. package/build/embeddedHeathToolCards_pwg_pwg.js +26 -24
  29. package/build/embeddedHeathToolCards_targetHeartRate.js +27 -25
  30. package/build/esm/{LastPeriod-fcd2b5ec.js → LastPeriod-46d6c03f.js} +1 -1
  31. package/build/esm/MobileBottomNavigationIcon-ae6490d7.js +185 -0
  32. package/build/esm/{WhatsApp-2f54ed26.js → WhatsApp-ed8ce0f2.js} +1 -1
  33. package/build/esm/adapters.js +18 -16
  34. package/build/esm/atoms.js +44 -42
  35. package/build/esm/babyGrowth.js +82 -80
  36. package/build/esm/cache.js +2 -2
  37. package/build/esm/care.js +26 -23
  38. package/build/esm/careBookingSearchBar.js +1582 -0
  39. package/build/esm/careBookingSearchBarV2.js +1655 -0
  40. package/build/esm/components.js +93 -83
  41. package/build/esm/{constants-b68073ea.js → constants-e9ebe043.js} +1 -1
  42. package/build/esm/constants.js +3 -3
  43. package/build/esm/constantsDomainLocales.js +1 -1
  44. package/build/esm/constantsRiskScreener.js +2 -2
  45. package/build/esm/constantsSite.js +2 -2
  46. package/build/esm/{core-bcdf3422.js → core-6d8629c2.js} +1 -1
  47. package/build/esm/{dataTransform-c3905a10.js → dataTransform-2023858d.js} +2 -2
  48. package/build/esm/ecom.js +4 -4
  49. package/build/esm/editor-82c3d476.js +959 -0
  50. package/build/esm/embeddedHeathToolCards_babyGrowth.js +22 -20
  51. package/build/esm/embeddedHeathToolCards_babyPoop.js +18 -16
  52. package/build/esm/embeddedHeathToolCards_babyVaccine.js +21 -19
  53. package/build/esm/embeddedHeathToolCards_bmi_bmi.js +25 -23
  54. package/build/esm/embeddedHeathToolCards_bmrBmr.js +25 -23
  55. package/build/esm/embeddedHeathToolCards_dueDate_dueDate.js +21 -19
  56. package/build/esm/embeddedHeathToolCards_ovulation_ovulation.js +21 -19
  57. package/build/esm/embeddedHeathToolCards_pwg_pwg.js +26 -24
  58. package/build/esm/embeddedHeathToolCards_targetHeartRate.js +27 -25
  59. package/build/esm/{fixedBottomAdBlock-bb1a3c50.js → fixedBottomAdBlock-2af1606f.js} +26 -662
  60. package/build/esm/footer.js +20 -18
  61. package/build/esm/gAssets.js +2 -2
  62. package/build/esm/healthToolsCardWrapper.js +17 -15
  63. package/build/esm/healthToolsForm.js +33 -31
  64. package/build/esm/hooks.js +15 -15
  65. package/build/esm/i18n.js +2 -2
  66. package/build/esm/i18nV2.js +2 -2
  67. package/build/esm/{index-04146795.js → index-04ba5caa.js} +1 -1
  68. package/build/esm/{index-69c631bf.js → index-082a24ae.js} +12 -11
  69. package/build/esm/{index-478546e8.js → index-1313a7ac.js} +12 -11
  70. package/build/esm/{index-155daac5.js → index-13783871.js} +2 -2
  71. package/build/esm/{index-48fdf51c.js → index-16a4f1c7.js} +16 -15
  72. package/build/esm/{index-877a46df.js → index-19f27bd3.js} +2 -2
  73. package/build/esm/{index-8570e132.js → index-1a2bc551.js} +2 -2
  74. package/build/esm/{index-fcf9a2ce.js → index-275c8526.js} +14 -13
  75. package/build/esm/{index-0cf91429.js → index-277566f7.js} +1 -1
  76. package/build/esm/{index-67603e6c.js → index-2ac50d8f.js} +15 -14
  77. package/build/esm/{index-19a9a60d.js → index-2c4a2d31.js} +1 -1
  78. package/build/esm/{index-ef2b1e44.js → index-32a968a1.js} +6 -6
  79. package/build/esm/{index-cde1edae.js → index-346fd194.js} +21 -19
  80. package/build/esm/{index-b927d85a.js → index-38b87b21.js} +12 -11
  81. package/build/esm/{index-a7bfcfbd.js → index-46c22744.js} +6 -6
  82. package/build/esm/index-4cf37916.js +22 -0
  83. package/build/esm/{index-a715b700.js → index-4d27d02e.js} +15 -14
  84. package/build/esm/{index-9a0b3bcd.js → index-52d04cc5.js} +7 -7
  85. package/build/esm/index-538ca8aa.js +860 -0
  86. package/build/esm/{index-a2704991.js → index-57da0f13.js} +16 -88
  87. package/build/esm/{index-b4cab951.js → index-5e17f985.js} +16 -15
  88. package/build/esm/{index-83ab0594.js → index-605eed95.js} +35 -800
  89. package/build/esm/{index-5303fcd9.js → index-628c5e84.js} +2 -2
  90. package/build/esm/{index-321f0612.js → index-64b1cd5c.js} +1 -1
  91. package/build/esm/index-673fd5bd.js +1264 -0
  92. package/build/esm/{index-140ea208.js → index-70883b48.js} +17 -16
  93. package/build/esm/{index-e84f16f3.js → index-71c8b83f.js} +3 -142
  94. package/build/esm/{index-e5797070.js → index-72c269cf.js} +3 -3
  95. package/build/esm/index-7ad9db02.js +1030 -0
  96. package/build/esm/{index-17115a3b.js → index-7ca4ec53.js} +15 -14
  97. package/build/esm/{index-5a81cbdd.js → index-7decdf27.js} +1 -1
  98. package/build/esm/index-7e95ba03.js +144 -0
  99. package/build/esm/{index-11bc6557.js → index-84b3ef3d.js} +3 -3
  100. package/build/esm/{index-4e92aaf2.js → index-8b9c7b45.js} +3 -3
  101. package/build/esm/{index-63d30402.js → index-930b0a77.js} +16 -15
  102. package/build/esm/{index-2292c1f3.js → index-93c8863d.js} +2 -2
  103. package/build/esm/{index-29676661.js → index-949f771c.js} +6 -6
  104. package/build/esm/{index-7d97103f.js → index-99551970.js} +2 -2
  105. package/build/esm/{index-d3c3615e.js → index-9c268a93.js} +2 -2
  106. package/build/esm/{index-d10d5d1f.js → index-9d7d3a53.js} +4 -4
  107. package/build/esm/{index-69ca7b6a.js → index-9e220aaa.js} +2 -2
  108. package/build/esm/{index-58982ea1.js → index-a424a33d.js} +3 -3
  109. package/build/esm/{index-b23b0c82.js → index-a54b6536.js} +14 -13
  110. package/build/esm/{index-05075062.js → index-b09ced58.js} +1 -1
  111. package/build/esm/{index-1f944c2d.js → index-b5ed732f.js} +5 -5
  112. package/build/esm/{index-0e0f3ac6.js → index-b867d267.js} +1 -1
  113. package/build/esm/{index-2f06b1d8.js → index-c4b04b5f.js} +1 -1
  114. package/build/esm/{index-efdc151c.js → index-c5286b89.js} +12 -11
  115. package/build/esm/{index-2b20b8ce.js → index-cbb45a5d.js} +2 -2
  116. package/build/esm/{index-f42f0c66.js → index-d4dcfb68.js} +2 -2
  117. package/build/esm/{index-c0790cdc.js → index-dec46974.js} +20 -17
  118. package/build/esm/index-e19da15e.js +468 -0
  119. package/build/esm/{index-fbe76c43.js → index-e1d35fec.js} +7 -6
  120. package/build/esm/{index-58ed669e.js → index-e477c2a3.js} +23 -19
  121. package/build/esm/{index-7ab1ac4c.js → index-ed292946.js} +2 -2
  122. package/build/esm/index-f3f06437.js +281 -0
  123. package/build/esm/index.js +118 -98
  124. package/build/esm/index.styles-25454e9c.js +62 -0
  125. package/build/esm/interfaces/types/Subot.d.ts +3 -3
  126. package/build/esm/{labelSorting-db27bdad.js → labelSorting-27ecf45e.js} +4 -4
  127. package/build/esm/lead.js +22 -20
  128. package/build/esm/{logoIcon-6ed45e55.js → logoIcon-ef6d9e4c.js} +2 -2
  129. package/build/esm/mantine.js +24 -22
  130. package/build/esm/misc.js +18 -18
  131. package/build/esm/miscGetDynamicHealthTool.js +7 -7
  132. package/build/esm/miscGetSocialList.js +8 -8
  133. package/build/esm/miscScreenSizeContext.js +1 -1
  134. package/build/esm/mobileBottomNavigation.js +19 -0
  135. package/build/esm/mobileBottomNavigationIcon.js +10 -0
  136. package/build/esm/molecules.js +71 -64
  137. package/build/esm/moleculesArticleCard.js +85 -0
  138. package/build/esm/moleculesArticleCardV2.js +171 -0
  139. package/build/esm/navigation.js +40 -35
  140. package/build/esm/navigationLogoutPopup.js +116 -0
  141. package/build/esm/navigationProfileButton.js +43 -0
  142. package/build/esm/{normalizeLink-fcd22117.js → normalizeLink-d756e5e6.js} +1 -1
  143. package/build/esm/onboardingV2.js +27 -25
  144. package/build/esm/organisms.js +46 -41
  145. package/build/esm/post-86117110.js +267 -0
  146. package/build/esm/profileNavigation.js +441 -0
  147. package/build/esm/progressBar.js +250 -0
  148. package/build/esm/pwg.js +21 -19
  149. package/build/esm/{routing-ed745cc6.js → routing-b81b8f17.js} +1 -1
  150. package/build/esm/subot.js +29 -27
  151. package/build/esm/surveyOrPremiumBanner.js +30 -28
  152. package/build/esm/surveyQuestionCard.js +10 -10
  153. package/build/esm/{surveyThankyouCard-6fc9a327.js → surveyThankyouCard-1b30aa0b.js} +5 -5
  154. package/build/esm/together.js +53 -44
  155. package/build/esm/togetherApiUtils.js +4 -4
  156. package/build/esm/togetherAtoms.js +29 -26
  157. package/build/esm/togetherComponentGlobalContext.js +4 -4
  158. package/build/esm/togetherMolecules.js +56 -47
  159. package/build/esm/togetherMoleculesCardAuthor.js +41 -0
  160. package/build/esm/togetherMoleculesPostImagePreview.js +21 -0
  161. package/build/esm/togetherMoleculesProfileDetail.js +53 -0
  162. package/build/esm/togetherOrganisms.js +53 -44
  163. package/build/esm/togetherRichTextEditor.js +27 -0
  164. package/build/esm/togetherShareBox.js +305 -0
  165. package/build/esm/{treePopoverMenu-937ef815.js → treePopoverMenu-04ded0ef.js} +18 -17
  166. package/build/esm/types-3eb97d85.js +44 -0
  167. package/build/esm/types.js +2 -2
  168. package/build/esm/{useCategory-d239339f.js → useCategory-391ffab0.js} +5 -5
  169. package/build/esm/{useHealthToolCache-e6e0e96c.js → useHealthToolCache-931ab3ca.js} +1 -1
  170. package/build/esm/{useMantineLocale-2ece6eac.js → useMantineLocale-b29ca68b.js} +5 -5
  171. package/build/esm/{usePlacesAutocomplete-ecf31643.js → usePlacesAutocomplete-91226a4d.js} +1 -1
  172. package/build/esm/useTogetherAuthRequiredAction.js +4 -4
  173. package/build/esm/{useTranslations-160e66cc.js → useTranslations-b66d9f2b.js} +1 -1
  174. package/build/esm/utils-92e2bc22.js +206 -0
  175. package/build/esm/{utils-d78e02e6.js → utils-f4b925d7.js} +2 -2
  176. package/build/esm/{utils-3d9043fb.js → utils-f873578b.js} +4 -4
  177. package/build/esm/vaccination.js +20 -18
  178. package/build/{fixedBottomAdBlock-87988744.js → fixedBottomAdBlock-605a8692.js} +49 -691
  179. package/build/footer.js +20 -18
  180. package/build/gAssets.js +2 -2
  181. package/build/healthToolsCardWrapper.js +17 -15
  182. package/build/healthToolsForm.js +33 -31
  183. package/build/hooks.js +15 -15
  184. package/build/i18n.js +1 -1
  185. package/build/i18nV2.js +1 -1
  186. package/build/{index-6ce119f5.js → index-0afde39e.js} +2 -2
  187. package/build/{index-bac0bd08.js → index-0cb2de9d.js} +3 -3
  188. package/build/{index-84e8b355.js → index-188e2316.js} +15 -14
  189. package/build/index-1b06e81f.js +151 -0
  190. package/build/{index-fcf16e35.js → index-1cdccd4e.js} +2 -2
  191. package/build/index-27e50de1.js +478 -0
  192. package/build/{index-a688f865.js → index-32abfb15.js} +12 -11
  193. package/build/{index-a136cba7.js → index-36723718.js} +6 -6
  194. package/build/{index-9e92431c.js → index-36ba9947.js} +2 -2
  195. package/build/{index-5006f129.js → index-3c593ede.js} +6 -6
  196. package/build/{index-6c2d2f25.js → index-4bf6b5da.js} +24 -99
  197. package/build/{index-5ddda8f4.js → index-4fd69136.js} +16 -15
  198. package/build/{index-6313ec6f.js → index-526cee72.js} +6 -6
  199. package/build/{index-92e82d0d.js → index-549b9e8c.js} +1 -1
  200. package/build/{index-a6acde43.js → index-5b52b076.js} +38 -34
  201. package/build/{index-8b8263ed.js → index-5dbd317c.js} +34 -33
  202. package/build/index-5dcd87b7.js +289 -0
  203. package/build/{index-e4004288.js → index-648aac83.js} +2 -2
  204. package/build/{index-c294ccc2.js → index-6b7b4292.js} +3 -3
  205. package/build/{index-2de1a14d.js → index-6b95442c.js} +2 -2
  206. package/build/{index-9add51eb.js → index-6b9e8dda.js} +3 -3
  207. package/build/{index-b040447b.js → index-767f9ac6.js} +2 -2
  208. package/build/{index-1ebaa446.js → index-7ce45455.js} +16 -15
  209. package/build/{index-f05721a0.js → index-81ff6094.js} +7 -7
  210. package/build/{index-03834ac7.js → index-86ecfc48.js} +3 -3
  211. package/build/{index-66b34bd9.js → index-8a19ce1b.js} +96 -864
  212. package/build/{index-f3553904.js → index-8d9663db.js} +9 -8
  213. package/build/{index-227e17fd.js → index-9151d357.js} +2 -2
  214. package/build/index-922020ed.js +1045 -0
  215. package/build/{index-347a91f6.js → index-a76596ef.js} +1 -1
  216. package/build/{index-1489f027.js → index-a839c6ca.js} +3 -3
  217. package/build/{index-4dc41ef1.js → index-a8705384.js} +1 -1
  218. package/build/{index-b8620e16.js → index-aad249ab.js} +2 -2
  219. package/build/{index-92815934.js → index-af48fea3.js} +5 -5
  220. package/build/{index-ae03f378.js → index-b04c5212.js} +16 -15
  221. package/build/{index-7e8732ae.js → index-b4fd3100.js} +1 -1
  222. package/build/{index-f3f648e1.js → index-be0a9d63.js} +17 -16
  223. package/build/{index-d9559ac1.js → index-be262a50.js} +2 -2
  224. package/build/index-becfec7a.js +1307 -0
  225. package/build/index-bf3796aa.js +870 -0
  226. package/build/{index-196d4981.js → index-cc4ce0c4.js} +1 -1
  227. package/build/{index-9f995309.js → index-cd0db938.js} +34 -31
  228. package/build/{index-c016b1bb.js → index-d0610b0f.js} +14 -13
  229. package/build/{index-554ad68c.js → index-d393d57e.js} +1 -1
  230. package/build/{index-0772398f.js → index-d471ff2d.js} +1 -1
  231. package/build/{index-7024d536.js → index-d5d9ceb9.js} +15 -14
  232. package/build/{index-1245ea43.js → index-de26b5d1.js} +12 -11
  233. package/build/{index-7ca746d3.js → index-dec3abcf.js} +15 -14
  234. package/build/{index-a97a7a53.js → index-e018af91.js} +31 -29
  235. package/build/index-e8dc7fdb.js +29 -0
  236. package/build/{index-4a6c95fe.js → index-f30e56f1.js} +12 -11
  237. package/build/{index-519a6287.js → index-f6b32484.js} +12 -11
  238. package/build/{index-d39f2445.js → index-f91ed3be.js} +4 -4
  239. package/build/{index-e7b871b4.js → index-faa2908c.js} +3 -143
  240. package/build/{index-9cc21262.js → index-fbb369ff.js} +1 -1
  241. package/build/{index-f8a51099.js → index-fde11604.js} +2 -2
  242. package/build/index.js +182 -162
  243. package/build/index.styles-9031f6d6.js +65 -0
  244. package/build/interfaces/types/Subot.d.ts +3 -3
  245. package/build/{labelSorting-60b0f16a.js → labelSorting-11165c8e.js} +4 -4
  246. package/build/lead.js +22 -20
  247. package/build/{logoIcon-8e1ff0aa.js → logoIcon-f3283bfd.js} +2 -2
  248. package/build/mantine.js +20 -18
  249. package/build/misc.js +18 -18
  250. package/build/miscGetDynamicHealthTool.js +7 -7
  251. package/build/miscGetSocialList.js +8 -8
  252. package/build/miscScreenSizeContext.js +1 -1
  253. package/build/mobileBottomNavigation.js +27 -0
  254. package/build/mobileBottomNavigationIcon.js +18 -0
  255. package/build/molecules.js +76 -69
  256. package/build/moleculesArticleCard.js +93 -0
  257. package/build/moleculesArticleCardV2.js +180 -0
  258. package/build/navigation.js +40 -35
  259. package/build/navigationLogoutPopup.js +125 -0
  260. package/build/navigationProfileButton.js +51 -0
  261. package/build/onboardingV2.js +29 -27
  262. package/build/organisms.js +49 -44
  263. package/build/post-0fec66f4.js +303 -0
  264. package/build/profileNavigation.js +450 -0
  265. package/build/progressBar.js +260 -0
  266. package/build/pwg.js +21 -19
  267. package/build/{routing-d764168d.js → routing-7a9c8608.js} +1 -1
  268. package/build/subot.js +28 -26
  269. package/build/surveyOrPremiumBanner.js +30 -28
  270. package/build/surveyQuestionCard.js +10 -10
  271. package/build/{surveyThankyouCard-944ab001.js → surveyThankyouCard-db73c893.js} +5 -5
  272. package/build/together.js +77 -68
  273. package/build/togetherApiUtils.js +4 -4
  274. package/build/togetherAtoms.js +29 -26
  275. package/build/togetherComponentGlobalContext.js +4 -4
  276. package/build/togetherMolecules.js +79 -70
  277. package/build/togetherMoleculesCardAuthor.js +49 -0
  278. package/build/togetherMoleculesPostImagePreview.js +29 -0
  279. package/build/togetherMoleculesProfileDetail.js +70 -0
  280. package/build/togetherOrganisms.js +53 -44
  281. package/build/togetherRichTextEditor.js +36 -0
  282. package/build/togetherShareBox.js +314 -0
  283. package/build/{treePopoverMenu-0cbe3fd0.js → treePopoverMenu-61ebd05c.js} +18 -17
  284. package/build/types-57052089.js +52 -0
  285. package/build/types.js +2 -2
  286. package/build/{useCategory-32558796.js → useCategory-d9f73b82.js} +5 -5
  287. package/build/{useHealthToolCache-cbe4b1b4.js → useHealthToolCache-4b5bfb11.js} +1 -1
  288. package/build/{useMantineLocale-992ae094.js → useMantineLocale-cc272195.js} +5 -5
  289. package/build/{usePlacesAutocomplete-c19d396b.js → usePlacesAutocomplete-a0156f14.js} +1 -1
  290. package/build/useTogetherAuthRequiredAction.js +4 -4
  291. package/build/{useTranslations-5d28e8df.js → useTranslations-8a9fa84d.js} +1 -1
  292. package/build/{utils-1a876a51.js → utils-251b2841.js} +3 -3
  293. package/build/{utils-d3353e9c.js → utils-c29214c6.js} +2 -2
  294. package/build/utils-f47b2d2d.js +229 -0
  295. package/build/vaccination.js +24 -22
  296. package/package.json +1 -1
  297. package/build/esm/index-c7b92115.js +0 -5060
  298. package/build/esm/types-f387cdcf.js +0 -3433
  299. package/build/index-2ce324cf.js +0 -5123
  300. package/build/types-d798cef3.js +0 -3447
  301. /package/build/{BMI_BOYS.percentile.monthly-2fdec618.js → BMI_BOYS.percentile.monthly-5f29289b.js} +0 -0
  302. /package/build/{BMI_BOYS.percentile.weekly-4b1616c4.js → BMI_BOYS.percentile.weekly-53584232.js} +0 -0
  303. /package/build/{BMI_BOYS.percentile.yearly-f7761749.js → BMI_BOYS.percentile.yearly-84aaf8fb.js} +0 -0
  304. /package/build/{BMI_BOYS.zscore.monthly-6767b0d4.js → BMI_BOYS.zscore.monthly-76d7fd0e.js} +0 -0
  305. /package/build/{BMI_BOYS.zscore.weekly-5c57342b.js → BMI_BOYS.zscore.weekly-ed3d66f2.js} +0 -0
  306. /package/build/{BMI_BOYS.zscore.yearly-d970734e.js → BMI_BOYS.zscore.yearly-7e74f0e8.js} +0 -0
  307. /package/build/{BMI_GIRLS.percentile.monthly-ba4d972d.js → BMI_GIRLS.percentile.monthly-6973d8b0.js} +0 -0
  308. /package/build/{BMI_GIRLS.percentile.weekly-f73dacf3.js → BMI_GIRLS.percentile.weekly-a873a4e6.js} +0 -0
  309. /package/build/{BMI_GIRLS.percentile.yearly-a5b59a8c.js → BMI_GIRLS.percentile.yearly-e86761bb.js} +0 -0
  310. /package/build/{BMI_GIRLS.zscore.monthly-110d6823.js → BMI_GIRLS.zscore.monthly-9a12fa84.js} +0 -0
  311. /package/build/{BMI_GIRLS.zscore.weekly-cfe97ba9.js → BMI_GIRLS.zscore.weekly-5936ed5b.js} +0 -0
  312. /package/build/{BMI_GIRLS.zscore.yearly-ab4ae640.js → BMI_GIRLS.zscore.yearly-d40d8356.js} +0 -0
  313. /package/build/{ChevronDown-d37704eb.js → ChevronDown-a6775d48.js} +0 -0
  314. /package/build/{Close-1514c815.js → Close-9fa735bc.js} +0 -0
  315. /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-6c797045.js → HEAD CIRCUM_BOYS.percentile.monthly-873a839f.js} +0 -0
  316. /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-7ac501c0.js → HEAD CIRCUM_BOYS.percentile.weekly-bbe3965d.js} +0 -0
  317. /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-2999cdb8.js → HEAD CIRCUM_BOYS.percentile.yearly-645dfc78.js} +0 -0
  318. /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-7e3a78aa.js → HEAD CIRCUM_BOYS.zscore.monthly-9fe137bf.js} +0 -0
  319. /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-2ea72789.js → HEAD CIRCUM_BOYS.zscore.weekly-2ccb15fb.js} +0 -0
  320. /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-826ab425.js → HEAD CIRCUM_BOYS.zscore.yearly-48aed724.js} +0 -0
  321. /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-0f1636c1.js → HEAD CIRCUM_GIRLS.percentile.monthly-d99d6d30.js} +0 -0
  322. /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-b32da590.js → HEAD CIRCUM_GIRLS.percentile.weekly-8a49b504.js} +0 -0
  323. /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-850c4e29.js → HEAD CIRCUM_GIRLS.percentile.yearly-d747b0cd.js} +0 -0
  324. /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-f942b53a.js → HEAD CIRCUM_GIRLS.zscore.monthly-8ef18721.js} +0 -0
  325. /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-26daad32.js → HEAD CIRCUM_GIRLS.zscore.weekly-853cca20.js} +0 -0
  326. /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-0f331108.js → HEAD CIRCUM_GIRLS.zscore.yearly-4d5b2175.js} +0 -0
  327. /package/build/{HEIGHT_BOYS.percentile.monthly-6bfc3799.js → HEIGHT_BOYS.percentile.monthly-070590b8.js} +0 -0
  328. /package/build/{HEIGHT_BOYS.percentile.weekly-0ed4b053.js → HEIGHT_BOYS.percentile.weekly-56741428.js} +0 -0
  329. /package/build/{HEIGHT_BOYS.percentile.yearly-cc4c343d.js → HEIGHT_BOYS.percentile.yearly-9c81f767.js} +0 -0
  330. /package/build/{HEIGHT_BOYS.zscore.monthly-b2d384dc.js → HEIGHT_BOYS.zscore.monthly-729982c3.js} +0 -0
  331. /package/build/{HEIGHT_BOYS.zscore.weekly-b65aa792.js → HEIGHT_BOYS.zscore.weekly-ddb206fb.js} +0 -0
  332. /package/build/{HEIGHT_BOYS.zscore.yearly-0bae3840.js → HEIGHT_BOYS.zscore.yearly-5fc7ea6a.js} +0 -0
  333. /package/build/{HEIGHT_GIRLS.percentile.monthly-34960fd2.js → HEIGHT_GIRLS.percentile.monthly-8cbc8d18.js} +0 -0
  334. /package/build/{HEIGHT_GIRLS.percentile.weekly-949ca5b1.js → HEIGHT_GIRLS.percentile.weekly-7145e94f.js} +0 -0
  335. /package/build/{HEIGHT_GIRLS.percentile.yearly-4c40b714.js → HEIGHT_GIRLS.percentile.yearly-ab0e4f4e.js} +0 -0
  336. /package/build/{HEIGHT_GIRLS.zscore.monthly-a3856728.js → HEIGHT_GIRLS.zscore.monthly-b851b1d7.js} +0 -0
  337. /package/build/{HEIGHT_GIRLS.zscore.weekly-b39f321f.js → HEIGHT_GIRLS.zscore.weekly-98aef3cf.js} +0 -0
  338. /package/build/{HEIGHT_GIRLS.zscore.yearly-f50c6d58.js → HEIGHT_GIRLS.zscore.yearly-65d990f7.js} +0 -0
  339. /package/build/{Locale-e3b7ae56.js → Locale-07aceee9.js} +0 -0
  340. /package/build/{Visible-c6736a66.js → Visible-ddeaf4cc.js} +0 -0
  341. /package/build/{WEIGHT_BOYS.percentile.monthly-685aabfc.js → WEIGHT_BOYS.percentile.monthly-0ce96694.js} +0 -0
  342. /package/build/{WEIGHT_BOYS.percentile.weekly-3c1a6d2f.js → WEIGHT_BOYS.percentile.weekly-b5397f20.js} +0 -0
  343. /package/build/{WEIGHT_BOYS.percentile.yearly-2bd65c8f.js → WEIGHT_BOYS.percentile.yearly-80cccd42.js} +0 -0
  344. /package/build/{WEIGHT_BOYS.zscore.monthly-bba8cd92.js → WEIGHT_BOYS.zscore.monthly-12907f1f.js} +0 -0
  345. /package/build/{WEIGHT_BOYS.zscore.weekly-7bdc0673.js → WEIGHT_BOYS.zscore.weekly-a1af17eb.js} +0 -0
  346. /package/build/{WEIGHT_BOYS.zscore.yearly-32f635e0.js → WEIGHT_BOYS.zscore.yearly-2649ff58.js} +0 -0
  347. /package/build/{WEIGHT_GIRLS.percentile.monthly-ad305e84.js → WEIGHT_GIRLS.percentile.monthly-222d7201.js} +0 -0
  348. /package/build/{WEIGHT_GIRLS.percentile.weekly-92e552b6.js → WEIGHT_GIRLS.percentile.weekly-2997b740.js} +0 -0
  349. /package/build/{WEIGHT_GIRLS.percentile.yearly-df0dd71c.js → WEIGHT_GIRLS.percentile.yearly-3dc5928a.js} +0 -0
  350. /package/build/{WEIGHT_GIRLS.zscore.monthly-8820671b.js → WEIGHT_GIRLS.zscore.monthly-742b7617.js} +0 -0
  351. /package/build/{WEIGHT_GIRLS.zscore.weekly-31d29b05.js → WEIGHT_GIRLS.zscore.weekly-5ee1ca40.js} +0 -0
  352. /package/build/{WEIGHT_GIRLS.zscore.yearly-f731d1e2.js → WEIGHT_GIRLS.zscore.yearly-d6ca7d60.js} +0 -0
  353. /package/build/{animation-b224626d.js → animation-a1ed71d8.js} +0 -0
  354. /package/build/{cart-149e990d.js → cart-7bc1b943.js} +0 -0
  355. /package/build/{constants-f9eca9ad.js → constants-4cad9f4d.js} +0 -0
  356. /package/build/{constants-9c314450.js → constants-81b95117.js} +0 -0
  357. /package/build/{constants-42eed92d.js → constants-c3b9c9a9.js} +0 -0
  358. /package/build/{dataTransform-104761fc.js → dataTransform-867c472c.js} +0 -0
  359. /package/build/{doctor-d8f36158.js → doctor-dca6d1b2.js} +0 -0
  360. /package/build/esm/{BMI_BOYS.percentile.monthly-df1b3770.js → BMI_BOYS.percentile.monthly-2388d98f.js} +0 -0
  361. /package/build/esm/{BMI_BOYS.percentile.weekly-1d9595b1.js → BMI_BOYS.percentile.weekly-8ebe6955.js} +0 -0
  362. /package/build/esm/{BMI_BOYS.percentile.yearly-6bd2bb46.js → BMI_BOYS.percentile.yearly-3a97e95b.js} +0 -0
  363. /package/build/esm/{BMI_BOYS.zscore.monthly-658792d1.js → BMI_BOYS.zscore.monthly-f7572dcd.js} +0 -0
  364. /package/build/esm/{BMI_BOYS.zscore.weekly-d3c4d378.js → BMI_BOYS.zscore.weekly-d6281906.js} +0 -0
  365. /package/build/esm/{BMI_BOYS.zscore.yearly-8ad375e2.js → BMI_BOYS.zscore.yearly-fbebaaca.js} +0 -0
  366. /package/build/esm/{BMI_GIRLS.percentile.monthly-25f98c64.js → BMI_GIRLS.percentile.monthly-a75c8880.js} +0 -0
  367. /package/build/esm/{BMI_GIRLS.percentile.weekly-d60b034d.js → BMI_GIRLS.percentile.weekly-652bc9af.js} +0 -0
  368. /package/build/esm/{BMI_GIRLS.percentile.yearly-0560df43.js → BMI_GIRLS.percentile.yearly-8bcb5a6e.js} +0 -0
  369. /package/build/esm/{BMI_GIRLS.zscore.monthly-2104651f.js → BMI_GIRLS.zscore.monthly-ecbe2982.js} +0 -0
  370. /package/build/esm/{BMI_GIRLS.zscore.weekly-37757497.js → BMI_GIRLS.zscore.weekly-3abed735.js} +0 -0
  371. /package/build/esm/{BMI_GIRLS.zscore.yearly-56872c59.js → BMI_GIRLS.zscore.yearly-d88a34a0.js} +0 -0
  372. /package/build/esm/{ChevronDown-5633c5e8.js → ChevronDown-dfd91883.js} +0 -0
  373. /package/build/esm/{Close-f541a904.js → Close-b8fc27b1.js} +0 -0
  374. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-47e6539d.js → HEAD CIRCUM_BOYS.percentile.monthly-ff980a90.js} +0 -0
  375. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-594e065d.js → HEAD CIRCUM_BOYS.percentile.weekly-eb86eac9.js} +0 -0
  376. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-d24f1cc6.js → HEAD CIRCUM_BOYS.percentile.yearly-27ed6504.js} +0 -0
  377. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-94d82cb5.js → HEAD CIRCUM_BOYS.zscore.monthly-0d345597.js} +0 -0
  378. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-cb0109d0.js → HEAD CIRCUM_BOYS.zscore.weekly-c182ab46.js} +0 -0
  379. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-79a794c9.js → HEAD CIRCUM_BOYS.zscore.yearly-d45dbce1.js} +0 -0
  380. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-89615b43.js → HEAD CIRCUM_GIRLS.percentile.monthly-61919e45.js} +0 -0
  381. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-29d9184f.js → HEAD CIRCUM_GIRLS.percentile.weekly-51fa8f98.js} +0 -0
  382. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-140da49d.js → HEAD CIRCUM_GIRLS.percentile.yearly-c1fa6006.js} +0 -0
  383. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-fe41d0e8.js → HEAD CIRCUM_GIRLS.zscore.monthly-4dfc55d8.js} +0 -0
  384. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-c6193e75.js → HEAD CIRCUM_GIRLS.zscore.weekly-b21b5bf1.js} +0 -0
  385. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-7018fed4.js → HEAD CIRCUM_GIRLS.zscore.yearly-c42836fa.js} +0 -0
  386. /package/build/esm/{HEIGHT_BOYS.percentile.monthly-fae5e6a0.js → HEIGHT_BOYS.percentile.monthly-24ff8afa.js} +0 -0
  387. /package/build/esm/{HEIGHT_BOYS.percentile.weekly-ddc33aee.js → HEIGHT_BOYS.percentile.weekly-2be7b66e.js} +0 -0
  388. /package/build/esm/{HEIGHT_BOYS.percentile.yearly-9e3064f0.js → HEIGHT_BOYS.percentile.yearly-ac02aa2d.js} +0 -0
  389. /package/build/esm/{HEIGHT_BOYS.zscore.monthly-7c9e0bb8.js → HEIGHT_BOYS.zscore.monthly-b43667dc.js} +0 -0
  390. /package/build/esm/{HEIGHT_BOYS.zscore.weekly-50b0a6a0.js → HEIGHT_BOYS.zscore.weekly-abcfcf3a.js} +0 -0
  391. /package/build/esm/{HEIGHT_BOYS.zscore.yearly-afb6c4a2.js → HEIGHT_BOYS.zscore.yearly-71598c16.js} +0 -0
  392. /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-5c7487f0.js → HEIGHT_GIRLS.percentile.monthly-7f9d679c.js} +0 -0
  393. /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-33465e14.js → HEIGHT_GIRLS.percentile.weekly-6ce1d4e7.js} +0 -0
  394. /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-ae62b279.js → HEIGHT_GIRLS.percentile.yearly-c398fd6b.js} +0 -0
  395. /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-fd13c492.js → HEIGHT_GIRLS.zscore.monthly-8d33bc28.js} +0 -0
  396. /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-f509ffbe.js → HEIGHT_GIRLS.zscore.weekly-eb44c302.js} +0 -0
  397. /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-bf3a867b.js → HEIGHT_GIRLS.zscore.yearly-10b4d1fe.js} +0 -0
  398. /package/build/esm/{Locale-81beb37e.js → Locale-b86a7a92.js} +0 -0
  399. /package/build/esm/{Visible-3d8c22f1.js → Visible-69da852f.js} +0 -0
  400. /package/build/esm/{WEIGHT_BOYS.percentile.monthly-4db4c32c.js → WEIGHT_BOYS.percentile.monthly-fd349fe7.js} +0 -0
  401. /package/build/esm/{WEIGHT_BOYS.percentile.weekly-5321689a.js → WEIGHT_BOYS.percentile.weekly-d5e52d60.js} +0 -0
  402. /package/build/esm/{WEIGHT_BOYS.percentile.yearly-0c2aee80.js → WEIGHT_BOYS.percentile.yearly-929119b3.js} +0 -0
  403. /package/build/esm/{WEIGHT_BOYS.zscore.monthly-ddf307e5.js → WEIGHT_BOYS.zscore.monthly-3f0f08cd.js} +0 -0
  404. /package/build/esm/{WEIGHT_BOYS.zscore.weekly-be1d57ac.js → WEIGHT_BOYS.zscore.weekly-b9fd3298.js} +0 -0
  405. /package/build/esm/{WEIGHT_BOYS.zscore.yearly-6dab88ff.js → WEIGHT_BOYS.zscore.yearly-9945948d.js} +0 -0
  406. /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-a666fe8a.js → WEIGHT_GIRLS.percentile.monthly-1e83ae51.js} +0 -0
  407. /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-cd85042c.js → WEIGHT_GIRLS.percentile.weekly-c3531852.js} +0 -0
  408. /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-f22705ec.js → WEIGHT_GIRLS.percentile.yearly-3c0040b0.js} +0 -0
  409. /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-9f3f1083.js → WEIGHT_GIRLS.zscore.monthly-3baeda15.js} +0 -0
  410. /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-7dcf0ba5.js → WEIGHT_GIRLS.zscore.weekly-2d8e6618.js} +0 -0
  411. /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-c658040c.js → WEIGHT_GIRLS.zscore.yearly-826f5bdd.js} +0 -0
  412. /package/build/esm/{animation-db89f033.js → animation-7207941a.js} +0 -0
  413. /package/build/esm/{cart-47013af9.js → cart-4f482601.js} +0 -0
  414. /package/build/esm/{constants-f9614464.js → constants-0497b893.js} +0 -0
  415. /package/build/esm/{constants-247d5eb0.js → constants-af02be2a.js} +0 -0
  416. /package/build/esm/{constants-410be40f.js → constants-f7943ab2.js} +0 -0
  417. /package/build/esm/{dataTransform-f9e5b4ec.js → dataTransform-610e61bf.js} +0 -0
  418. /package/build/esm/{doctor-88e78d2c.js → doctor-63e09ada.js} +0 -0
  419. /package/build/esm/{index-907fffe6.js → index-20192854.js} +0 -0
  420. /package/build/esm/{index-c3d6b2ed.js → index-20199246.js} +0 -0
  421. /package/build/esm/{index-6dd5a329.js → index-5364f2db.js} +0 -0
  422. /package/build/esm/{index-0ca51fbb.js → index-56d0ac47.js} +0 -0
  423. /package/build/esm/{index-24f2f569.js → index-9f076f64.js} +0 -0
  424. /package/build/esm/{index-6f44d928.js → index-a2506e52.js} +0 -0
  425. /package/build/esm/{index-5f214b71.js → index-c130afdc.js} +0 -0
  426. /package/build/esm/{index-fcd9b927.js → index-c9467e39.js} +0 -0
  427. /package/build/esm/{localizeNumberFormat-be70a31e.js → localizeNumberFormat-3bf28240.js} +0 -0
  428. /package/build/esm/{number-7e3f376a.js → number-d26abebe.js} +0 -0
  429. /package/build/esm/{other-811b7d93.js → other-08d0b30e.js} +0 -0
  430. /package/build/esm/{paths-650d5eee.js → paths-ce59b252.js} +0 -0
  431. /package/build/esm/{translationsContext-0cbb21e6.js → translationsContext-8afb0ce3.js} +0 -0
  432. /package/build/esm/{tslib.es6-3970c414.js → tslib.es6-e0840efa.js} +0 -0
  433. /package/build/esm/{types-78bfaf40.js → types-41242882.js} +0 -0
  434. /package/build/esm/{useIsInit-3f7af1fd.js → useIsInit-f59c6bd2.js} +0 -0
  435. /package/build/esm/{useOutsideClick-2fae5fb5.js → useOutsideClick-12815e56.js} +0 -0
  436. /package/build/esm/{useScrollbarSize-2a7e6dd2.js → useScrollbarSize-431cf33c.js} +0 -0
  437. /package/build/esm/{useUniqueId-d714426d.js → useUniqueId-8f710187.js} +0 -0
  438. /package/build/esm/{utils-cee25689.js → utils-8a1f05c9.js} +0 -0
  439. /package/build/{index-27f25094.js → index-017f99b2.js} +0 -0
  440. /package/build/{index-1d528960.js → index-1a6a94cd.js} +0 -0
  441. /package/build/{index-41a348a2.js → index-668f591b.js} +0 -0
  442. /package/build/{index-32917720.js → index-70abc2ac.js} +0 -0
  443. /package/build/{index-20a5cee0.js → index-c6b0831a.js} +0 -0
  444. /package/build/{index-9f501aac.js → index-ce2d2850.js} +0 -0
  445. /package/build/{index-186f9324.js → index-e3e72aed.js} +0 -0
  446. /package/build/{index-e327613c.js → index-f70c0edf.js} +0 -0
  447. /package/build/{localizeNumberFormat-a5804ea2.js → localizeNumberFormat-30e7f015.js} +0 -0
  448. /package/build/{normalizeLink-2878a2ce.js → normalizeLink-c1b2b407.js} +0 -0
  449. /package/build/{number-35662113.js → number-20d56f69.js} +0 -0
  450. /package/build/{other-a7f01b3d.js → other-eedaf6ca.js} +0 -0
  451. /package/build/{paths-488dafd4.js → paths-4c182009.js} +0 -0
  452. /package/build/{translationsContext-951038ad.js → translationsContext-cd046df4.js} +0 -0
  453. /package/build/{tslib.es6-145af9ce.js → tslib.es6-f3c387c0.js} +0 -0
  454. /package/build/{types-aeea2cc2.js → types-2614ec58.js} +0 -0
  455. /package/build/{useIsInit-0c37752a.js → useIsInit-e56642e4.js} +0 -0
  456. /package/build/{useOutsideClick-aa477d22.js → useOutsideClick-f18dfe3f.js} +0 -0
  457. /package/build/{useScrollbarSize-01b12b72.js → useScrollbarSize-4aaa4dd1.js} +0 -0
  458. /package/build/{useUniqueId-17c2097b.js → useUniqueId-621ec272.js} +0 -0
  459. /package/build/{utils-a1cfbdac.js → utils-ae9740c0.js} +0 -0
@@ -0,0 +1,1594 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib_es6 = require('./tslib.es6-f3c387c0.js');
6
+ var React = require('react');
7
+ var react = require('@emotion/react');
8
+ var utils = require('./utils-f47b2d2d.js');
9
+ var useTranslations = require('./useTranslations-8a9fa84d.js');
10
+ var debounce = require('lodash/debounce');
11
+ var constants = require('./constants-c3b9c9a9.js');
12
+ var styled = require('@emotion/styled');
13
+ var index = require('./index-0afde39e.js');
14
+ var index$1 = require('./index-6b95442c.js');
15
+ var miscTheme = require('./miscTheme.js');
16
+ var shuffle = require('lodash/shuffle');
17
+ var useOutsideClick = require('./useOutsideClick-f18dfe3f.js');
18
+ var utils$1 = require('./utils-ae9740c0.js');
19
+ var Skeleton = require('react-loading-skeleton');
20
+ var paths = require('./paths-4c182009.js');
21
+ require('./index-648aac83.js');
22
+ require('date-fns/locale');
23
+ require('./index-d471ff2d.js');
24
+ require('./Locale-07aceee9.js');
25
+ require('./constantsIsProduction.js');
26
+ require('./constantsSite.js');
27
+ require('./constantsDomainLocales.js');
28
+ require('./constantsRiskScreener.js');
29
+ require('./miscCookieHelper.js');
30
+ require('string-format');
31
+ require('./translationsContext-cd046df4.js');
32
+ require('@mantine/core');
33
+ require('./other-eedaf6ca.js');
34
+
35
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
36
+
37
+ var React__default = /*#__PURE__*/_interopDefault(React);
38
+ var debounce__default = /*#__PURE__*/_interopDefault(debounce);
39
+ var styled__default = /*#__PURE__*/_interopDefault(styled);
40
+ var shuffle__default = /*#__PURE__*/_interopDefault(shuffle);
41
+ var Skeleton__default = /*#__PURE__*/_interopDefault(Skeleton);
42
+
43
+ const StyledSearchBarWrapper = styled__default["default"].div ``;
44
+ const StyledSearchBarMobileWrapper = styled__default["default"].div `
45
+ --searchbar-z-index: 305;
46
+ &[data-is-modal='true'] {
47
+ position: fixed;
48
+ left: 0;
49
+ right: 0;
50
+ top: 0;
51
+ height: var(--mobile-care-searchbar-height, 100%);
52
+ overflow-y: auto;
53
+ -webkit-overflow-scrolling: touch;
54
+ background-color: white;
55
+ z-index: var(--searchbar-z-index);
56
+ }
57
+ `;
58
+ const StyledSearchBarMobileModalHeader = styled__default["default"].section ``;
59
+ const StyledHiddenInputMobile = styled__default["default"].input `
60
+ position: fixed;
61
+ left: -100%;
62
+ top: -100%;
63
+ `;
64
+ const StyledInput = styled__default["default"](index.Input) `
65
+ #booking-search-bar & {
66
+ input {
67
+ font-size: 16px;
68
+ }
69
+ }
70
+ `;
71
+
72
+ const LocationResults = ({ cities, isLoading, onLocationClick, selectedLocation, }) => {
73
+ const { t, locale } = useTranslations.useTranslations();
74
+ const renderContent = () => {
75
+ if (isLoading) {
76
+ return React__default["default"].createElement(utils.StyledLiSkeleton, { count: 5 });
77
+ }
78
+ if (!cities || cities.length < 1) {
79
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
80
+ React__default["default"].createElement(utils.StyledLocationItem, { "data-is-denied": "true" },
81
+ React__default["default"].createElement(index$1.Text, { size: "sm", color: "#ccc" }, t('booking.searchBar.noResults')))));
82
+ }
83
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
84
+ React__default["default"].createElement(utils.StyledLocationItem, { key: "all-location", role: "button", tabIndex: 0, onClick: () => {
85
+ var _a;
86
+ if (onLocationClick) {
87
+ onLocationClick({
88
+ name: t('booking.searchBar.allLocations'),
89
+ id: constants.ID_OPTION_ALL_LOCATION,
90
+ slug: (_a = constants.LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.ALL,
91
+ });
92
+ }
93
+ } },
94
+ React__default["default"].createElement(utils.StyledPinIcon, { color: miscTheme.theme.colors.neutral400 }),
95
+ React__default["default"].createElement(index$1.Text, { size: "md" }, t('booking.searchBar.allLocations'))),
96
+ cities.map((city) => (React__default["default"].createElement(utils.StyledLocationItem, { key: city.id, onClick: (evt) => {
97
+ evt.nativeEvent.stopImmediatePropagation();
98
+ if (onLocationClick) {
99
+ onLocationClick(city);
100
+ }
101
+ }, role: "button", tabIndex: 0, "aria-label": `Select ${city.name} as location`, isSelected: (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === city.id },
102
+ React__default["default"].createElement(utils.StyledPinIcon, { color: miscTheme.theme.colors.neutral400 }),
103
+ React__default["default"].createElement(index$1.Text, { size: "md" }, city.name))))));
104
+ };
105
+ return (React__default["default"].createElement(utils.StyledLocationResultsWrapper, { "data-testid": "location-search-results" },
106
+ React__default["default"].createElement(utils.StyledLocationResultsList, null, renderContent())));
107
+ };
108
+
109
+ const EVENT_NAMES = {
110
+ TYPE_CHARACTER: 'TYPE_CHARACTER',
111
+ REMOVE_CHARACTER: 'REMOVE_CHARACTER',
112
+ REMOVE_ALL: 'REMOVE_ALL',
113
+ REMOVE_LAST_VISIBLE_NODE: 'REMOVE_LAST_VISIBLE_NODE',
114
+ PAUSE_FOR: 'PAUSE_FOR',
115
+ CHANGE_DELETE_SPEED: 'CHANGE_DELETE_SPEED',
116
+ CHANGE_DELAY: 'CHANGE_DELAY',
117
+ PASTE_STRING: 'PASTE_STRING',
118
+ };
119
+ const getRandomInteger = (min, max) => {
120
+ return Math.floor(Math.random() * (max - min + 1)) + min;
121
+ };
122
+ const VISIBLE_NODE_TYPES = {
123
+ TEXT_NODE: 'TEXT_NODE',
124
+ };
125
+ class Typewriter {
126
+ constructor(options) {
127
+ this.state = {
128
+ lastFrameTime: null,
129
+ pauseUntil: null,
130
+ eventQueue: [],
131
+ eventLoop: null,
132
+ eventLoopPaused: false,
133
+ reverseCalledEvents: [],
134
+ calledEvents: [],
135
+ visibleNodes: [],
136
+ initialOptions: null,
137
+ };
138
+ this.options = {
139
+ strings: null,
140
+ delay: 'natural',
141
+ pauseFor: 1500,
142
+ deleteSpeed: 'natural',
143
+ loop: false,
144
+ autoStart: false,
145
+ stringSplitter: null,
146
+ onCreateTextNode: null,
147
+ onRemoveNode: null,
148
+ };
149
+ this.start = () => {
150
+ this.state.eventLoopPaused = false;
151
+ this.runEventLoop();
152
+ return this;
153
+ };
154
+ this.pause = () => {
155
+ this.state.eventLoopPaused = true;
156
+ return this;
157
+ };
158
+ this.stop = () => {
159
+ if (this.state.eventLoop) {
160
+ window.cancelAnimationFrame(this.state.eventLoop);
161
+ this.state.eventLoop = null;
162
+ }
163
+ return this;
164
+ };
165
+ this.pauseFor = (ms) => {
166
+ this.addEventToQueue(EVENT_NAMES.PAUSE_FOR, { ms });
167
+ return this;
168
+ };
169
+ this.typeOutAllStrings = () => {
170
+ if (typeof this.options.strings === 'string') {
171
+ this.typeString(this.options.strings).pauseFor(this.options.pauseFor);
172
+ return this;
173
+ }
174
+ this.options.strings.forEach((string) => {
175
+ this.typeString(string)
176
+ .pauseFor(this.options.pauseFor)
177
+ .deleteAll(this.options.deleteSpeed);
178
+ });
179
+ return this;
180
+ };
181
+ this.typeString = (string, node = null) => {
182
+ if (string) {
183
+ const { stringSplitter } = this.options || {};
184
+ const characters = typeof stringSplitter === 'function'
185
+ ? stringSplitter(string)
186
+ : string.split('');
187
+ this.typeCharacters(characters, node);
188
+ }
189
+ return this;
190
+ };
191
+ this.pasteString = (string, node = null) => {
192
+ if (string) {
193
+ this.addEventToQueue(EVENT_NAMES.PASTE_STRING, {
194
+ character: string,
195
+ node,
196
+ });
197
+ }
198
+ return this;
199
+ };
200
+ this.deleteAll = (speed = 'natural') => {
201
+ this.addEventToQueue(EVENT_NAMES.REMOVE_ALL, { speed });
202
+ return this;
203
+ };
204
+ this.changeDeleteSpeed = (speed) => {
205
+ if (!speed) {
206
+ throw new Error('Must provide new delete speed');
207
+ }
208
+ this.addEventToQueue(EVENT_NAMES.CHANGE_DELETE_SPEED, { speed });
209
+ return this;
210
+ };
211
+ this.changeDelay = (delay) => {
212
+ if (!delay) {
213
+ throw new Error('Must provide new delay');
214
+ }
215
+ this.addEventToQueue(EVENT_NAMES.CHANGE_DELAY, { delay });
216
+ return this;
217
+ };
218
+ this.deleteChars = (amount) => {
219
+ if (!amount) {
220
+ throw new Error('Must provide amount of characters to delete');
221
+ }
222
+ for (let i = 0; i < amount; i++) {
223
+ this.addEventToQueue(EVENT_NAMES.REMOVE_CHARACTER);
224
+ }
225
+ return this;
226
+ };
227
+ this.typeCharacters = (characters, node = null) => {
228
+ if (!characters || !Array.isArray(characters)) {
229
+ throw new Error('Characters must be an array');
230
+ }
231
+ characters.forEach((character) => {
232
+ this.addEventToQueue(EVENT_NAMES.TYPE_CHARACTER, { character, node });
233
+ });
234
+ return this;
235
+ };
236
+ this.removeCharacters = (characters) => {
237
+ if (!characters || !Array.isArray(characters)) {
238
+ throw new Error('Characters must be an array');
239
+ }
240
+ characters.forEach(() => {
241
+ this.addEventToQueue(EVENT_NAMES.REMOVE_CHARACTER);
242
+ });
243
+ return this;
244
+ };
245
+ this.addEventToQueue = (eventName, eventArgs, prepend = false) => {
246
+ return this.addEventToStateProperty(eventName, eventArgs, prepend, 'eventQueue');
247
+ };
248
+ this.addReverseCalledEvent = (eventName, eventArgs, prepend = false) => {
249
+ const { loop } = this.options;
250
+ if (!loop) {
251
+ return this;
252
+ }
253
+ return this.addEventToStateProperty(eventName, eventArgs, prepend, 'reverseCalledEvents');
254
+ };
255
+ this.addEventToStateProperty = (eventName, eventArgs, prepend = false, property) => {
256
+ const eventItem = {
257
+ eventName,
258
+ eventArgs: eventArgs || {},
259
+ };
260
+ if (prepend) {
261
+ this.state[property] = [eventItem, ...this.state[property]];
262
+ }
263
+ else {
264
+ this.state[property] = [...this.state[property], eventItem];
265
+ }
266
+ return this;
267
+ };
268
+ this.runEventLoop = () => {
269
+ if (!this.state.lastFrameTime) {
270
+ this.state.lastFrameTime = Date.now();
271
+ }
272
+ // Setup variables to calculate if this frame should run
273
+ const nowTime = Date.now();
274
+ const delta = nowTime - this.state.lastFrameTime;
275
+ if (!this.state.eventQueue.length) {
276
+ if (!this.options.loop) {
277
+ return;
278
+ }
279
+ // Reset event queue if we are looping
280
+ this.state.eventQueue = [...this.state.calledEvents];
281
+ this.state.calledEvents = [];
282
+ this.options = Object.assign({}, this.state.initialOptions);
283
+ }
284
+ // Request next frame
285
+ this.state.eventLoop = window.requestAnimationFrame(this.runEventLoop);
286
+ // Check if event loop is paused
287
+ if (this.state.eventLoopPaused) {
288
+ return;
289
+ }
290
+ // Check if state has pause until time
291
+ if (this.state.pauseUntil) {
292
+ // Check if event loop should be paused
293
+ if (nowTime < this.state.pauseUntil) {
294
+ return;
295
+ }
296
+ // Reset pause time
297
+ this.state.pauseUntil = null;
298
+ }
299
+ // Make a clone of event queue
300
+ const eventQueue = [...this.state.eventQueue];
301
+ // Get first event from queue
302
+ const currentEvent = eventQueue.shift();
303
+ // Setup delay variable
304
+ let delay = 0;
305
+ // Check if frame should run or be
306
+ // skipped based on fps interval
307
+ if (currentEvent.eventName === EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE ||
308
+ currentEvent.eventName === EVENT_NAMES.REMOVE_CHARACTER) {
309
+ delay =
310
+ this.options.deleteSpeed === 'natural'
311
+ ? getRandomInteger(40, 80)
312
+ : this.options.deleteSpeed;
313
+ }
314
+ else {
315
+ delay =
316
+ this.options.delay === 'natural'
317
+ ? getRandomInteger(120, 160)
318
+ : this.options.delay;
319
+ }
320
+ if (delta <= delay) {
321
+ return;
322
+ }
323
+ // Get current event args
324
+ const { eventName, eventArgs } = currentEvent;
325
+ // Run item from event loop
326
+ switch (eventName) {
327
+ case EVENT_NAMES.PASTE_STRING:
328
+ case EVENT_NAMES.TYPE_CHARACTER: {
329
+ const { character } = eventArgs;
330
+ const textNode = document.createTextNode(character);
331
+ let textNodeToUse = textNode;
332
+ if (this.options.onCreateTextNode &&
333
+ typeof this.options.onCreateTextNode === 'function') {
334
+ textNodeToUse = this.options.onCreateTextNode(character, textNode);
335
+ }
336
+ this.state.visibleNodes = [
337
+ ...this.state.visibleNodes,
338
+ {
339
+ type: VISIBLE_NODE_TYPES.TEXT_NODE,
340
+ character,
341
+ node: textNodeToUse,
342
+ },
343
+ ];
344
+ break;
345
+ }
346
+ case EVENT_NAMES.REMOVE_CHARACTER: {
347
+ eventQueue.unshift({
348
+ eventName: EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE,
349
+ eventArgs: { removingCharacterNode: true },
350
+ });
351
+ break;
352
+ }
353
+ case EVENT_NAMES.PAUSE_FOR: {
354
+ const { ms } = currentEvent.eventArgs;
355
+ this.state.pauseUntil = Date.now() + parseInt(ms);
356
+ break;
357
+ }
358
+ case EVENT_NAMES.REMOVE_ALL: {
359
+ const { visibleNodes } = this.state;
360
+ const { speed } = eventArgs;
361
+ const removeAllEventItems = [];
362
+ if (speed) {
363
+ removeAllEventItems.push({
364
+ eventName: EVENT_NAMES.CHANGE_DELETE_SPEED,
365
+ eventArgs: { speed, temp: true },
366
+ });
367
+ }
368
+ for (let i = 0, length = visibleNodes.length; i < length; i++) {
369
+ removeAllEventItems.push({
370
+ eventName: EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE,
371
+ eventArgs: { removingCharacterNode: false },
372
+ });
373
+ }
374
+ if (speed) {
375
+ removeAllEventItems.push({
376
+ eventName: EVENT_NAMES.CHANGE_DELETE_SPEED,
377
+ eventArgs: { speed: this.options.deleteSpeed, temp: true },
378
+ });
379
+ }
380
+ eventQueue.unshift(...removeAllEventItems);
381
+ break;
382
+ }
383
+ case EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE: {
384
+ if (this.state.visibleNodes.length) {
385
+ const { node, character } = this.state.visibleNodes.pop();
386
+ if (this.options.onRemoveNode &&
387
+ typeof this.options.onRemoveNode === 'function') {
388
+ this.options.onRemoveNode({
389
+ node,
390
+ character,
391
+ });
392
+ }
393
+ if (node) {
394
+ node.parentNode.removeChild(node);
395
+ }
396
+ }
397
+ break;
398
+ }
399
+ case EVENT_NAMES.CHANGE_DELETE_SPEED: {
400
+ this.options.deleteSpeed = currentEvent.eventArgs.speed;
401
+ break;
402
+ }
403
+ case EVENT_NAMES.CHANGE_DELAY: {
404
+ this.options.delay = currentEvent.eventArgs.delay;
405
+ break;
406
+ }
407
+ }
408
+ // Add que item to called queue if we are looping
409
+ if (this.options.loop) {
410
+ if (currentEvent.eventName !== EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE &&
411
+ !(currentEvent.eventArgs && currentEvent.eventArgs.temp)) {
412
+ this.state.calledEvents = [...this.state.calledEvents, currentEvent];
413
+ }
414
+ }
415
+ // Replace state event queue with cloned queue
416
+ this.state.eventQueue = eventQueue;
417
+ // Set last frame time so it can be used to calculate next frame
418
+ this.state.lastFrameTime = nowTime;
419
+ };
420
+ if (options) {
421
+ this.options = Object.assign(Object.assign({}, this.options), options);
422
+ }
423
+ this.state.initialOptions = Object.assign({}, this.options);
424
+ this.init();
425
+ }
426
+ init() {
427
+ this.addEventToQueue(EVENT_NAMES.REMOVE_ALL, null, true);
428
+ if (this.options.autoStart === true && this.options.strings) {
429
+ this.typeOutAllStrings().start();
430
+ }
431
+ }
432
+ }
433
+
434
+ function useAnimatedPlaceholder({ inputRef, wrapperRef, disabled, }) {
435
+ const { t, locale } = useTranslations.useTranslations();
436
+ const values = React.useMemo(() => {
437
+ if (disabled) {
438
+ return [];
439
+ }
440
+ const shuffleKeys = [
441
+ 'booking.searchBar.placeholder.hospital',
442
+ 'booking.searchBar.placeholder.doctor',
443
+ ];
444
+ if (locale !== 'zh-TW') {
445
+ shuffleKeys.push('booking.searchBar.placeholder.specialty', 'booking.searchBar.placeholder.service');
446
+ }
447
+ return shuffle__default["default"](shuffleKeys).map((s) => t(s));
448
+ }, [t, locale]);
449
+ React.useEffect(() => {
450
+ if (disabled) {
451
+ return;
452
+ }
453
+ const input = getInput();
454
+ if (input) {
455
+ input.placeholder = '';
456
+ new Typewriter({
457
+ strings: values,
458
+ autoStart: true,
459
+ loop: true,
460
+ delay: 32,
461
+ deleteSpeed: 32,
462
+ pauseFor: 1500,
463
+ onCreateTextNode: customNodeCreator,
464
+ onRemoveNode: onRemoveNode,
465
+ });
466
+ }
467
+ }, [inputRef, wrapperRef]);
468
+ function customNodeCreator(character) {
469
+ const input = getInput();
470
+ if (input) {
471
+ input.placeholder = input.placeholder + character;
472
+ }
473
+ return null;
474
+ }
475
+ function onRemoveNode() {
476
+ const input = getInput();
477
+ if (input) {
478
+ input.placeholder = input.placeholder.slice(0, -1);
479
+ }
480
+ }
481
+ function getInput() {
482
+ if (inputRef && inputRef.current) {
483
+ return inputRef.current;
484
+ }
485
+ else if (wrapperRef && wrapperRef.current) {
486
+ return wrapperRef.current.querySelector('input') || null;
487
+ }
488
+ return null;
489
+ }
490
+ return;
491
+ }
492
+
493
+ const StyledFakeInputSearchMobile = styled__default["default"].div `
494
+ user-select: none;
495
+ input {
496
+ pointer-events: none;
497
+ background-color: white;
498
+ }
499
+ `;
500
+ function MobileFakeInput({ focused, value = '', onClick, trackingAttributes, inputSearchPlaceholder, }) {
501
+ const { t } = useTranslations.useTranslations();
502
+ const wrapperRef = React.useRef(null);
503
+ useAnimatedPlaceholder({ wrapperRef, disabled: !!inputSearchPlaceholder });
504
+ const gaAttributes = React.useMemo(() => {
505
+ if (trackingAttributes) {
506
+ return {
507
+ 'data-event-category': trackingAttributes.dataEventCategory,
508
+ 'data-event-action': trackingAttributes.dataEventAction,
509
+ 'data-event-label': trackingAttributes.dataEventLabel,
510
+ };
511
+ }
512
+ else {
513
+ return {};
514
+ }
515
+ }, [trackingAttributes]);
516
+ return (React__default["default"].createElement(StyledFakeInputSearchMobile, Object.assign({ onClick: () => onClick && onClick(), ref: wrapperRef }, gaAttributes),
517
+ React__default["default"].createElement(StyledInput, { inputClassName: focused === 'location' ? 'focused' : undefined, name: "booking-search-placeholder", displayIcon: React__default["default"].createElement(utils.MagnifierIcon, { color: miscTheme.theme.colors.gray400 }), placeholder: t('booking.searchBar.searchInput.placeholder'), value: value, size: "md" })));
518
+ }
519
+
520
+ const StyledTopBar = styled__default["default"].header `
521
+ display: flex;
522
+ height: 64px;
523
+ align-items: center;
524
+ justify-content: space-between;
525
+ margin: 0 auto;
526
+ position: sticky;
527
+ z-index: 99;
528
+ background-color: white;
529
+ top: 0;
530
+ left: 0;
531
+ `;
532
+ const StyledTopBarHeaderRight = styled__default["default"].div `
533
+ display: inline-flex;
534
+ flex: 1;
535
+ justify-content: flex-end;
536
+ cursor: pointer;
537
+ text-decoration: underline;
538
+ `;
539
+ const StyledTopBarIcon = styled__default["default"].div `
540
+ display: flex;
541
+ align-items: center;
542
+ margin-left: 16px;
543
+ cursor: pointer;
544
+ `;
545
+ const StyledTopbarHeading = styled__default["default"].div `
546
+ width: 100%;
547
+ margin-left: 24px;
548
+ `;
549
+ const StyledTopbarHeadingText = styled__default["default"](index$1.Text) `
550
+ color: ${miscTheme.theme.colors.secondaryDark};
551
+ text-align: start;
552
+ `;
553
+
554
+ const MobileTopBar = ({ className, onLeftClick, headingText, onRightClick, iconLeft, textRight, }) => {
555
+ return (React__default["default"].createElement(StyledTopBar, { className: className },
556
+ React__default["default"].createElement(StyledTopBarIcon, { onClick: onLeftClick }, iconLeft || React__default["default"].createElement(utils.CloseIcon, { color: miscTheme.theme.colors.gray800 })),
557
+ React__default["default"].createElement(StyledTopbarHeading, null,
558
+ React__default["default"].createElement(StyledTopbarHeadingText, { size: "md", weight: "bold" }, headingText)),
559
+ React__default["default"].createElement(StyledTopBarHeaderRight, { onClick: onRightClick }, textRight && React__default["default"].createElement("p", null, textRight))));
560
+ };
561
+
562
+ const SEARCH_KEYWORD_MIN_LENGTH = {
563
+ 'en-PH': 3,
564
+ 'tl-PH': 2,
565
+ 'id-ID': 3,
566
+ 'vi-VN': 2,
567
+ 'zh-TW': 0,
568
+ 'ms-MY': 2,
569
+ };
570
+
571
+ const initialState = {
572
+ isMobile: false,
573
+ isDebug: false,
574
+ navigateTo: null,
575
+ geoLocationPermission: 'unset',
576
+ geoLocationCoordinates: null,
577
+ focused: 'none',
578
+ searchLocationKeywords: '',
579
+ searchKeywords: '',
580
+ selectedLocation: null,
581
+ defaultCity: null,
582
+ initialCities: [],
583
+ cities: [],
584
+ searchResults: [],
585
+ initialSearchResults: [],
586
+ isLoadingCities: false,
587
+ isLoadingSearchResults: false,
588
+ isMobileModalOpened: false,
589
+ initialSelectedCity: null,
590
+ autoCompleteDisabled: false,
591
+ inputSearchPlaceholder: '',
592
+ locale: 'vi-VN',
593
+ };
594
+ var ActionTypes;
595
+ (function (ActionTypes) {
596
+ ActionTypes["NavigateTo"] = "navigate to url";
597
+ ActionTypes["ClickOutsideInputLocation"] = "click outside input location";
598
+ ActionTypes["ClickOutsideInputSearch"] = "click outside input search";
599
+ ActionTypes["SelectCurrentLocation"] = "select current location";
600
+ ActionTypes["FocusInputLocation"] = "focus input location";
601
+ ActionTypes["FocusInputSearch"] = "focus input search";
602
+ ActionTypes["ChangeInputLocation"] = "change input location";
603
+ ActionTypes["ChangeInputSearch"] = "change input search";
604
+ ActionTypes["ClearInputLocation"] = "clear input location";
605
+ ActionTypes["ClearInputSearch"] = "clear input search";
606
+ ActionTypes["SelectLocation"] = "select location";
607
+ ActionTypes["FetchCitiesStart"] = "fetch cities start";
608
+ ActionTypes["FetchCitiesFinish"] = "fetch cities finish";
609
+ ActionTypes["FetchSearchResultsStart"] = "fetch search results start";
610
+ ActionTypes["FetchSearchResultsComplete"] = "fetch search results complete";
611
+ ActionTypes["FetchSearchResultsFinish"] = "fetch search results finish";
612
+ ActionTypes["FetchCitiesByGeoIpComplete"] = "fetch cities by geo IP finish";
613
+ ActionTypes["FetchCitiesByKeywordComplete"] = "fetch cities by keyword finish";
614
+ ActionTypes["DisplayInitialCities"] = "display initial cities";
615
+ ActionTypes["DisplayInitialSearchResults"] = "display initial search results";
616
+ ActionTypes["GrantGeoLocationPermission"] = "grant geolocation permission";
617
+ ActionTypes["DenyGeoLocationPermission"] = "deny geolocation permission";
618
+ ActionTypes["OpenMobileModal"] = "open mobile modal";
619
+ ActionTypes["CloseMobileModal"] = "close mobile modal";
620
+ ActionTypes["UpdateInitialSearchValue"] = "update initial search value";
621
+ ActionTypes["SelectSearchResult"] = "select search result";
622
+ ActionTypes["SetInputSearchPlaceholder"] = "set input search placeholder";
623
+ })(ActionTypes || (ActionTypes = {}));
624
+ function resetSearchLocationKeywords(state) {
625
+ const { selectedLocation, searchLocationKeywords } = state;
626
+ if (selectedLocation && searchLocationKeywords !== selectedLocation.name) {
627
+ return Object.assign(Object.assign({}, state), { searchLocationKeywords: selectedLocation.name });
628
+ }
629
+ return state;
630
+ }
631
+ function reducer(state, action) {
632
+ var _a;
633
+ if (state.isDebug) {
634
+ console.log('bookingSearchBar', { action, state });
635
+ }
636
+ switch (action.type) {
637
+ case ActionTypes.NavigateTo:
638
+ return Object.assign(Object.assign({}, state), { navigateTo: action.payload, focused: 'none', isMobileModalOpened: false });
639
+ case ActionTypes.ClickOutsideInputLocation: {
640
+ if (state.isMobile || state.focused !== 'location') {
641
+ return state;
642
+ }
643
+ return resetSearchLocationKeywords(Object.assign(Object.assign({}, state), { focused: 'none' }));
644
+ }
645
+ case ActionTypes.ClickOutsideInputSearch: {
646
+ if (state.isMobile || state.focused !== 'search') {
647
+ return state;
648
+ }
649
+ return Object.assign(Object.assign({}, state), { focused: 'none' });
650
+ }
651
+ case ActionTypes.FocusInputLocation: {
652
+ const nextState = Object.assign(Object.assign({}, state), { focused: 'location' });
653
+ if (((_a = state.selectedLocation) === null || _a === void 0 ? void 0 : _a.id) === constants.ID_OPTION_CURRENT_LOCATION) {
654
+ nextState.searchLocationKeywords = '';
655
+ }
656
+ return nextState;
657
+ }
658
+ case ActionTypes.FocusInputSearch:
659
+ const nextState = Object.assign(Object.assign({}, state), { focused: 'search' });
660
+ if (state.isMobile) {
661
+ return resetSearchLocationKeywords(nextState);
662
+ }
663
+ return nextState;
664
+ case ActionTypes.ChangeInputLocation:
665
+ return Object.assign(Object.assign({}, state), { searchLocationKeywords: action.payload });
666
+ case ActionTypes.ChangeInputSearch: {
667
+ const keyword = action.payload;
668
+ return Object.assign(Object.assign({}, state), { searchKeywords: keyword, isLoadingSearchResults: keyword.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale] });
669
+ }
670
+ case ActionTypes.SelectCurrentLocation:
671
+ return Object.assign(Object.assign({}, state), { focused: 'none', selectedLocation: action.payload, searchLocationKeywords: action.payload.name });
672
+ case ActionTypes.ClearInputLocation:
673
+ return Object.assign(Object.assign({}, state), { focused: 'location', cities: state.initialCities, searchLocationKeywords: '' });
674
+ case ActionTypes.ClearInputSearch:
675
+ return Object.assign(Object.assign({}, state), { focused: 'search', searchKeywords: '' });
676
+ case ActionTypes.SelectLocation:
677
+ return Object.assign(Object.assign({}, state), { focused: 'none', selectedLocation: action.payload, searchLocationKeywords: action.payload.name });
678
+ case ActionTypes.SelectSearchResult:
679
+ return Object.assign(Object.assign({}, state), { searchKeywords: action.payload.name, isMobileModalOpened: false, focused: 'none', navigateTo: action.payload.url });
680
+ case ActionTypes.FetchCitiesStart:
681
+ return Object.assign(Object.assign({}, state), { isLoadingCities: true });
682
+ case ActionTypes.FetchCitiesFinish:
683
+ return Object.assign(Object.assign({}, state), { isLoadingCities: false });
684
+ case ActionTypes.FetchSearchResultsStart:
685
+ return Object.assign(Object.assign({}, state), { isLoadingSearchResults: true });
686
+ case ActionTypes.FetchSearchResultsFinish:
687
+ return Object.assign(Object.assign({}, state), { isLoadingSearchResults: false });
688
+ case ActionTypes.FetchSearchResultsComplete: {
689
+ const nextState = Object.assign(Object.assign({}, state), { searchResults: action.payload });
690
+ if (state.initialSearchResults.length === 0) {
691
+ nextState.initialSearchResults = action.payload;
692
+ }
693
+ return nextState;
694
+ }
695
+ case ActionTypes.FetchCitiesByGeoIpComplete: {
696
+ let { cities } = action.payload;
697
+ const { default: defaultCity } = action.payload;
698
+ cities = cities.filter((c) => c.id !== defaultCity.id);
699
+ cities.unshift(defaultCity);
700
+ if (state.initialSelectedCity &&
701
+ !cities.find((c) => c.id === state.initialSelectedCity.id)) {
702
+ cities.unshift(state.initialSelectedCity);
703
+ }
704
+ const nextState = Object.assign(Object.assign({}, state), { defaultCity, initialCities: cities, cities });
705
+ if (state.geoLocationPermission === 'denied' &&
706
+ !state.initialSelectedCity) {
707
+ nextState.selectedLocation = defaultCity;
708
+ nextState.searchLocationKeywords = defaultCity.name;
709
+ }
710
+ return nextState;
711
+ }
712
+ case ActionTypes.FetchCitiesByKeywordComplete:
713
+ return Object.assign(Object.assign({}, state), { cities: action.payload });
714
+ case ActionTypes.DisplayInitialCities:
715
+ return Object.assign(Object.assign({}, state), { cities: state.initialCities });
716
+ case ActionTypes.DisplayInitialSearchResults:
717
+ return Object.assign(Object.assign({}, state), { searchResults: state.initialSearchResults, isLoadingSearchResults: false });
718
+ case ActionTypes.GrantGeoLocationPermission:
719
+ return Object.assign(Object.assign({}, state), { geoLocationPermission: 'granted', geoLocationCoordinates: action.payload });
720
+ case ActionTypes.DenyGeoLocationPermission:
721
+ return Object.assign(Object.assign({}, state), { geoLocationPermission: 'denied', geoLocationCoordinates: null });
722
+ case ActionTypes.OpenMobileModal:
723
+ return Object.assign(Object.assign({}, state), { isMobileModalOpened: true });
724
+ case ActionTypes.CloseMobileModal:
725
+ return Object.assign(Object.assign({}, state), { isMobileModalOpened: false });
726
+ case ActionTypes.UpdateInitialSearchValue:
727
+ return Object.assign(Object.assign({}, state), { searchKeywords: action.payload });
728
+ case ActionTypes.SetInputSearchPlaceholder:
729
+ return Object.assign(Object.assign({}, state), { inputSearchPlaceholder: action.payload });
730
+ default:
731
+ return state;
732
+ }
733
+ }
734
+
735
+ const StyledSearchBarInputsWrapper = styled__default["default"].div `
736
+ display: flex;
737
+ gap: 16px;
738
+ ${utils$1.MediaQueries.mbDown} {
739
+ flex-direction: column;
740
+ padding: 14px;
741
+ background-color: ${miscTheme.theme.colors.primary50};
742
+
743
+ input {
744
+ filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.04))
745
+ drop-shadow(0px 0px 2px rgba(0, 0, 0, 0.06))
746
+ drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.04));
747
+ }
748
+ }
749
+
750
+ input {
751
+ background-color: white;
752
+ }
753
+ `;
754
+ const StyledInputWrapper = styled__default["default"].div `
755
+ position: relative;
756
+ `;
757
+ const StyledInputLocationWrapper = styled__default["default"](StyledInputWrapper) `
758
+ flex: 1;
759
+ `;
760
+ const StyledInputSearchWrapper = styled__default["default"](StyledInputWrapper) `
761
+ flex: 2;
762
+ `;
763
+ const StyledClearIcon = styled__default["default"](utils.ClearIcon) `
764
+ display: none;
765
+ &.shown {
766
+ display: block;
767
+ }
768
+ `;
769
+
770
+ const SearchIcon = () => (React__default["default"].createElement("svg", { width: "18", height: "18", viewBox: "0 0 18 18" },
771
+ React__default["default"].createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.97887 8.15493C2.97887 5.29627 5.29627 2.97887 8.15493 2.97887C11.0136 2.97887 13.331 5.29627 13.331 8.15493C13.331 11.0136 11.0136 13.331 8.15493 13.331C5.29627 13.331 2.97887 11.0136 2.97887 8.15493ZM8.15493 1.5C4.47951 1.5 1.5 4.47951 1.5 8.15493C1.5 11.8303 4.47951 14.8099 8.15493 14.8099C9.72624 14.8099 11.1704 14.2653 12.3089 13.3546L15.2377 16.2834C15.5265 16.5722 15.9947 16.5722 16.2834 16.2834C16.5722 15.9947 16.5722 15.5265 16.2834 15.2377L13.3546 12.3089C14.2653 11.1704 14.8099 9.72624 14.8099 8.15493C14.8099 4.47951 11.8303 1.5 8.15493 1.5Z", fill: "white" })));
772
+ const StyledSearchIcon = styled__default["default"].button `
773
+ min-height: 100%;
774
+ border-radius: 6px;
775
+ background-color: ${miscTheme.theme.colors.primaryBase};
776
+ display: flex;
777
+ justify-content: center;
778
+ align-items: center;
779
+ gap: 11px;
780
+ cursor: pointer;
781
+ flex: 0.3;
782
+
783
+ ${utils$1.MediaQueries.mbDown} {
784
+ --margin: 16px;
785
+ min-height: 44px;
786
+ margin: var(--margin);
787
+ width: calc(100% - var(--margin) * 2);
788
+ position: absolute;
789
+ bottom: 0;
790
+ }
791
+
792
+ &:hover {
793
+ background-color: ${miscTheme.theme.colors.primaryHover};
794
+ }
795
+
796
+ &:active {
797
+ background-color: ${miscTheme.theme.colors.primaryActive};
798
+ }
799
+
800
+ &:focus-visible {
801
+ outline: 1px solid black;
802
+ }
803
+ `;
804
+ const StyledText$1 = styled__default["default"](index$1.Text) `
805
+ font-weight: ${miscTheme.theme.sizes.fwSemiBold};
806
+ `;
807
+ const SearchButton = ({ onClick }) => {
808
+ const { t } = useTranslations.useTranslations();
809
+ const title = t('booking.searchBar.searchButton');
810
+ return (React__default["default"].createElement(StyledSearchIcon, { onClick: onClick, title: title },
811
+ React__default["default"].createElement(SearchIcon, null),
812
+ React__default["default"].createElement(StyledText$1, { size: "s3", color: "white" }, title)));
813
+ };
814
+
815
+ function SearchInputs({ isMobile, state, dispatch, debouncedFetchCitiesByKeyword, debouncedFetchSearchResults, focusLocationInput, focusSearchInput, renderLocationResults, renderSearchResults, locationTrackingAttributes, trackingAttributes, onSearch, initalSearchValue, }) {
816
+ const inputLocationWrapperRef = React.useRef(null);
817
+ const inputSearchWrapperRef = React.useRef(null);
818
+ const { focused, searchLocationKeywords, geoLocationPermission, selectedLocation, searchKeywords, inputSearchPlaceholder, } = state;
819
+ const { t } = useTranslations.useTranslations();
820
+ useAnimatedPlaceholder({
821
+ wrapperRef: inputSearchWrapperRef,
822
+ disabled: !!inputSearchPlaceholder,
823
+ });
824
+ useOutsideClick.useOutsideClick(inputLocationWrapperRef, () => {
825
+ if (!isMobile) {
826
+ dispatch({ type: ActionTypes.ClickOutsideInputLocation });
827
+ }
828
+ });
829
+ useOutsideClick.useOutsideClick(inputSearchWrapperRef, () => {
830
+ if (!isMobile) {
831
+ dispatch({ type: ActionTypes.ClickOutsideInputSearch });
832
+ }
833
+ });
834
+ function handleLocationInputClear() {
835
+ dispatch({ type: ActionTypes.ClearInputLocation });
836
+ debouncedFetchCitiesByKeyword.cancel();
837
+ focusLocationInput();
838
+ }
839
+ function handleSearchInputClear() {
840
+ dispatch({ type: ActionTypes.ClearInputSearch });
841
+ debouncedFetchSearchResults.cancel();
842
+ debouncedFetchSearchResults('', state);
843
+ focusSearchInput();
844
+ }
845
+ const searchInputPinIconColor = React.useMemo(() => {
846
+ if (geoLocationPermission === 'granted' &&
847
+ (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === constants.ID_OPTION_CURRENT_LOCATION) {
848
+ return miscTheme.theme.colors.primaryBase;
849
+ }
850
+ else {
851
+ return miscTheme.theme.colors.gray400;
852
+ }
853
+ }, [geoLocationPermission, selectedLocation]);
854
+ const handleSearchInputChange = React.useCallback(function handleSearchInputChange(value) {
855
+ dispatch({ type: ActionTypes.ChangeInputSearch, payload: value });
856
+ if (typeof onSearch === 'function') {
857
+ return;
858
+ }
859
+ if (value.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale] ||
860
+ initalSearchValue) {
861
+ debouncedFetchSearchResults(value.trim(), state);
862
+ }
863
+ else {
864
+ debouncedFetchSearchResults.cancel();
865
+ dispatch({ type: ActionTypes.DisplayInitialSearchResults });
866
+ }
867
+ }, [dispatch, state]);
868
+ const handleSearchLocationInputChange = React.useCallback(function handleSearchLocationInputChange(value) {
869
+ dispatch({ type: ActionTypes.ChangeInputLocation, payload: value });
870
+ if (value.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale]) {
871
+ debouncedFetchCitiesByKeyword(value.trim());
872
+ }
873
+ else {
874
+ debouncedFetchCitiesByKeyword.cancel();
875
+ dispatch({ type: ActionTypes.DisplayInitialCities });
876
+ }
877
+ }, [debouncedFetchCitiesByKeyword, dispatch]);
878
+ const handleKeyPress = (e) => {
879
+ if (state.autoCompleteDisabled && e.key === 'Enter' && onSearch) {
880
+ onSearch({
881
+ cityId: state.selectedLocation.id,
882
+ keyword: searchKeywords,
883
+ });
884
+ }
885
+ };
886
+ return (React__default["default"].createElement(StyledSearchBarInputsWrapper, null,
887
+ React__default["default"].createElement(StyledInputLocationWrapper, { ref: inputLocationWrapperRef },
888
+ React__default["default"].createElement(StyledInput, { inputClassName: focused === 'location' ? 'focused' : undefined, placeholder: t('booking.searchBar.locationPlaceholder'), autoComplete: "off", name: "search-location", displayIcon: React__default["default"].createElement(utils.PinIcon, { className: "location-pin-icon", color: searchInputPinIconColor }), actionIcon: React__default["default"].createElement(StyledClearIcon, { color: miscTheme.theme.colors.gray300, className: searchLocationKeywords !== '' ? 'shown' : '' }), onActionClick: handleLocationInputClear, value: searchLocationKeywords, onChange: handleSearchLocationInputChange, onFocus: () => dispatch({ type: ActionTypes.FocusInputLocation }), size: "md", trackingAttributes: locationTrackingAttributes }),
889
+ !isMobile && renderLocationResults()),
890
+ React__default["default"].createElement(StyledInputSearchWrapper, { ref: inputSearchWrapperRef },
891
+ React__default["default"].createElement(StyledInput, { placeholder: inputSearchPlaceholder ||
892
+ t('booking.searchBar.searchInput.placeholder'), autoComplete: "off", name: "search-results", actionIcon: React__default["default"].createElement(StyledClearIcon, { color: miscTheme.theme.colors.gray300, className: searchKeywords !== '' ? 'shown' : '' }), onActionClick: handleSearchInputClear, value: searchKeywords, onChange: handleSearchInputChange, onFocus: () => dispatch({ type: ActionTypes.FocusInputSearch }), inputClassName: focused === 'search' ? 'focused' : undefined, size: "md", trackingAttributes: trackingAttributes, onKeyPress: handleKeyPress, enterKeyHint: state.autoCompleteDisabled ? 'search' : undefined }),
893
+ !isMobile && renderSearchResults()),
894
+ state.autoCompleteDisabled && !state.isMobile && (React__default["default"].createElement(SearchButton, { onClick: () => {
895
+ onSearch({
896
+ cityId: state.selectedLocation.id,
897
+ keyword: searchKeywords,
898
+ });
899
+ } }))));
900
+ }
901
+
902
+ const DoctorIcon = () => (React__default["default"].createElement("svg", { width: "14", height: "18", viewBox: "0 0 14 18" },
903
+ React__default["default"].createElement("path", { d: "M7 .667c-1.702 0-3.36.146-4.48.365a1.67 1.67 0 0 0-1.353 1.64v2.162c0 .459.374.833.833.833h10a.835.835 0 0 0 .833-.833V2.698c0-.804-.566-1.487-1.354-1.64C10.356.84 8.693.667 7 .667m-.833.833h1.666v.834h.834V4h-.834v.834H6.167V4h-.834V2.334h.834zm-4.74 5a8 8 0 0 0-.234 1.276c-.046.404-.137 1.478-.13 1.589a1.94 1.94 0 0 0-.73 1.536c0 .935.645 1.735 1.51 1.928.902 2.19 2.71 4.505 5.157 4.505s4.255-2.338 5.156-4.532a1.935 1.935 0 0 0 1.51-1.9 1.94 1.94 0 0 0-.729-1.537c.007-.11-.08-1.205-.13-1.615a8.4 8.4 0 0 0-.234-1.25H5.359c1.169 1.706 3.916.687 5.678 1.12.537 1.172.13 2.813.13 2.813l.65.208c.095.03.183.114.183.26 0 .157-.114.293-.312.287l-.678-.104-.234.65C9.966 14.05 8.413 15.668 7 15.668s-2.965-1.618-3.776-3.932l-.26-.651-.704.104c-.143 0-.26-.13-.26-.287a.26.26 0 0 1 .182-.26l.651-.208c-.1.12-.423-1.729 0-2.396.759-.524 1.394-.16 2.292-1.537zm3.75 2.552c-.605 0-1.094.502-1.094 1.12s.489 1.12 1.094 1.12 1.094-.501 1.094-1.12c0-.618-.488-1.12-1.094-1.12m3.646 0c-.606 0-1.094.502-1.094 1.12s.488 1.12 1.094 1.12c.605 0 1.094-.501 1.094-1.12 0-.618-.489-1.12-1.094-1.12", fill: "#9AA2AC" })));
904
+ const ServiceIcon = () => (React__default["default"].createElement("svg", { width: "18", height: "18", viewBox: "0 0 18 18" },
905
+ React__default["default"].createElement("path", { d: "M9 .667A8.33 8.33 0 0 0 2.333 4H4.6A6.7 6.7 0 0 1 9 2.334c1.637 0 3.2.612 4.401 1.666h2.266A8.33 8.33 0 0 0 9 .667M1.786 4.834c-.71 2.207-1.12 4.765-1.12 7.5 0 1.751.16 3.434.47 5h15.729c.309-1.566.468-3.249.468-5 0-2.735-.41-5.293-1.12-7.5zM9 7.334a4.166 4.166 0 1 1 0 8.332 4.166 4.166 0 0 1 0-8.332M8.167 9v1.667H6.5v1.667h1.667V14h1.666v-1.666H11.5v-1.667H9.833V9z", fill: "#9AA2AC" })));
906
+ const HospitalIcon = () => (React__default["default"].createElement("svg", { width: "16", height: "17", viewBox: "0 0 16 17" },
907
+ React__default["default"].createElement("path", { d: "M8 .667.5 5.635v9.199c0 .92.746 1.666 1.667 1.666h11.666c.921 0 1.667-.745 1.667-1.666V5.635zm3.333 10h-2.5v2.5H7.167v-2.5h-2.5V9h2.5V6.5h1.666V9h2.5z", fill: "#9AA2AC" })));
908
+ const SpecialtyIcon = () => (React__default["default"].createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16" },
909
+ React__default["default"].createElement("path", { d: "M3.833.5a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667M10.5.5c-.92 0-1.667.746-1.667 1.667V5.5c0 .92.746 1.667 1.667 1.667h3.333c.921 0 1.667-.746 1.667-1.667V2.167C15.5 1.246 14.754.5 13.833.5zM3.833 8.833a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667m8.334 0a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667", fill: "#9AA2AC" })));
910
+
911
+ const StyledTypeHeader = styled__default["default"].header `
912
+ display: flex;
913
+ justify-content: space-between;
914
+ padding: 12px 24px;
915
+ background-color: ${miscTheme.theme.colors.neutral50};
916
+ box-shadow: inset 0px 1px 0px #e4e8ec;
917
+ `;
918
+ const StyledInfoWrapper = styled__default["default"].div `
919
+ display: grid;
920
+ flex: 2;
921
+ align-items: center;
922
+ gap: 16px;
923
+ grid-template-columns: 16px 1fr;
924
+ `;
925
+ const StyledTypeName = styled__default["default"].p `
926
+ color: ${miscTheme.theme.colors.neutral800};
927
+ font-size: 14px;
928
+ font-weight: ${miscTheme.theme.sizes.fwSemiBold};
929
+ letter-spacing: -0.2px;
930
+ line-height: 22px;
931
+ `;
932
+ const StyledSeeMoreButton = styled__default["default"].button `
933
+ flex: 1;
934
+ cursor: pointer;
935
+ text-align: end;
936
+ `;
937
+ const StyledResultsContainer = styled__default["default"].section `
938
+ padding: 12px 16px;
939
+ --rowGap: 16px;
940
+ --graphicSize: 32px;
941
+
942
+ ${utils$1.MediaQueries.tdUp} {
943
+ --rowGap: 8px;
944
+ }
945
+ `;
946
+ const StyledItemsWrapper = styled__default["default"].ul `
947
+ --gap: 16px;
948
+ ${utils$1.MediaQueries.tdUp} {
949
+ --gap: 8px;
950
+ }
951
+
952
+ display: grid;
953
+ overflow: hidden;
954
+ gap: var(--gap);
955
+ transition: max-height 0.8s ease-out;
956
+
957
+ ${({ isMore }) => isMore &&
958
+ `
959
+ height: auto;
960
+ max-height: 0;
961
+ margin-top: var(--gap);
962
+ `}
963
+
964
+ ${({ isShown }) => isShown &&
965
+ `
966
+ max-height: 600px;
967
+ `}
968
+
969
+ @media (prefers-reduced-motion) {
970
+ transition: none;
971
+ }
972
+
973
+ ${utils$1.MediaQueries.tdUp} {
974
+ grid-template-columns: 1fr 1fr;
975
+ }
976
+ `;
977
+ const StyledSeeMore = styled__default["default"](index$1.Text) `
978
+ margin-top: 12px;
979
+ margin-bottom: 8px;
980
+ cursor: pointer;
981
+ text-align: start;
982
+ text-transform: capitalize;
983
+ `;
984
+
985
+ const StyledResult = styled__default["default"].li `
986
+ display: flex;
987
+ align-items: center;
988
+ gap: var(--rowGap);
989
+ cursor: pointer;
990
+ &.not-nav {
991
+ cursor: default;
992
+ }
993
+ `;
994
+ const StyledRoundedIconWrapper = styled__default["default"].div `
995
+ --wrapper-size: var(--graphicSize);
996
+ border-radius: calc(var(--wrapper-size) / 2);
997
+ background-color: var(--neutral50);
998
+ width: var(--wrapper-size);
999
+ height: var(--wrapper-size);
1000
+ aspect-ratio: 1/1;
1001
+ overflow: hidden;
1002
+
1003
+ ${({ type }) => type &&
1004
+ type === 'doctors' &&
1005
+ `
1006
+ border-radius: calc(var(--graphicSize) / 2);
1007
+ `}
1008
+
1009
+ img {
1010
+ width: var(--graphicSize);
1011
+ height: var(--graphicSize);
1012
+ ${({ type }) => type && type === 'doctors'
1013
+ ? `
1014
+
1015
+ object-fit: cover;
1016
+ `
1017
+ : `
1018
+ object-fit: contain;
1019
+ `}
1020
+ }
1021
+
1022
+ &:focus-visible {
1023
+ outline: 1px solid ${miscTheme.theme.colors.gray600};
1024
+ }
1025
+ `;
1026
+ const StyledText = styled__default["default"](index$1.Text) `
1027
+ line-height: 22px;
1028
+ letter-spacing: -0.2px;
1029
+
1030
+ ${utils$1.MediaQueries.tdUp} {
1031
+ &[data-size='p3'] {
1032
+ font-size: 14px;
1033
+ }
1034
+ }
1035
+ `;
1036
+ const StyledPictureWrapper = styled__default["default"].figure `
1037
+ max-width: var(--graphicSize);
1038
+ min-width: var(--graphicSize);
1039
+ `;
1040
+ const StyledLocationPin = styled__default["default"].svg `
1041
+ margin: 0 auto;
1042
+ display: block;
1043
+ `;
1044
+ const StyledImageSkeletonWrapper = styled__default["default"].div `
1045
+ display: grid;
1046
+ place-items: center;
1047
+ `;
1048
+
1049
+ const defaultThumbnailByType = {
1050
+ doctors: utils.DefaultThumbnailDoctor,
1051
+ services: utils.DefaultThumbnailService,
1052
+ };
1053
+ const ResultSectionItem = ({ type, item, imageUrl, className, onClickItem, }) => {
1054
+ const onKeyDown = (e) => {
1055
+ if (e.key === 'Enter' || e.key === 'Space') {
1056
+ if (onClickItem) {
1057
+ onClickItem(item);
1058
+ }
1059
+ }
1060
+ };
1061
+ const defaultThumbnail = React.useMemo(() => {
1062
+ const Cmp = defaultThumbnailByType[type] || utils.DefaultThumbnailAny;
1063
+ return React__default["default"].createElement(Cmp, { width: 32, height: type === 'services' ? 32 : 24 });
1064
+ }, [type]);
1065
+ return (React__default["default"].createElement(StyledResult, { onClick: () => onClickItem && onClickItem(item), onKeyDown: onKeyDown, tabIndex: 0, role: "button", className: className },
1066
+ React__default["default"].createElement(StyledPictureWrapper, null, type === 'hospitals' ? (React__default["default"].createElement(StyledLocationPin, { width: "12", height: "16", viewBox: "0 0 12 16" },
1067
+ React__default["default"].createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.75 5.94873C0.75 3.04623 3.0975 0.69873 6 0.69873C8.9025 0.69873 11.25 3.04623 11.25 5.94873C11.25 9.07623 7.935 13.3887 6.5775 15.0312C6.2775 15.3912 5.73 15.3912 5.43 15.0312C4.065 13.3887 0.75 9.07623 0.75 5.94873ZM4.125 5.94873C4.125 6.98373 4.965 7.82373 6 7.82373C7.035 7.82373 7.875 6.98373 7.875 5.94873C7.875 4.91373 7.035 4.07373 6 4.07373C4.965 4.07373 4.125 4.91373 4.125 5.94873Z", fill: "#9AA2AC" }))) : (React__default["default"].createElement(StyledRoundedIconWrapper, { type: type }, imageUrl ? (React__default["default"].createElement("img", { src: imageUrl, width: 32, height: type === 'services' ? 32 : 24, loading: "lazy" })) : (defaultThumbnail)))),
1068
+ React__default["default"].createElement(StyledText, { color: miscTheme.theme.colors.gray800, size: "p3" }, item.name)));
1069
+ };
1070
+
1071
+ const ResultSection = ({ type, data, state, dispatch, itemsToShow, itemsToShowDesktop, isMobile, isLoading, keyword, isNavResultItem, }) => {
1072
+ const [seeMoreOpen, setSeeMoreOpen] = React.useState(false);
1073
+ const { t, locale } = useTranslations.useTranslations();
1074
+ const { selectedLocation, searchKeywords } = state;
1075
+ const slugs = React.useMemo(() => constants.LOCALIZED_SLUGS[locale], [locale]);
1076
+ const isMalay = locale === 'ms-MY';
1077
+ const typeInformation = React.useMemo(() => {
1078
+ return {
1079
+ doctors: {
1080
+ name: t('booking.searchPopup.doctors'),
1081
+ icon: React__default["default"].createElement(DoctorIcon, null),
1082
+ slug: slugs.DOCTOR,
1083
+ },
1084
+ services: {
1085
+ name: t('booking.searchPopup.services'),
1086
+ icon: React__default["default"].createElement(ServiceIcon, null),
1087
+ slug: slugs.SERVICE,
1088
+ },
1089
+ hospitals: {
1090
+ name: t('booking.searchPopup.hospitals'),
1091
+ icon: React__default["default"].createElement(HospitalIcon, null),
1092
+ slug: slugs.HOSPITAL,
1093
+ },
1094
+ specialties: {
1095
+ name: t('booking.searchPopup.specialties'),
1096
+ icon: React__default["default"].createElement(SpecialtyIcon, null),
1097
+ slug: slugs.SPECIALTIES,
1098
+ },
1099
+ };
1100
+ }, [type, slugs]);
1101
+ const typeSlug = React.useMemo(() => typeInformation[type].slug, [typeInformation]);
1102
+ const showItemCount = isMobile ? itemsToShow : itemsToShowDesktop;
1103
+ function onClickItem(item) {
1104
+ let url = '';
1105
+ switch (type) {
1106
+ case 'specialties':
1107
+ url = `/${selectedLocation.slug}/${typeInformation.doctors.slug}/${item.slug}`;
1108
+ break;
1109
+ case 'services':
1110
+ url = `/${selectedLocation.slug}/${typeSlug}/${item.slug}`;
1111
+ break;
1112
+ case 'doctors':
1113
+ case 'hospitals':
1114
+ url = `/${typeSlug}/${item.slug}-${item.id}`;
1115
+ break;
1116
+ }
1117
+ if (url) {
1118
+ dispatch({
1119
+ type: ActionTypes.SelectSearchResult,
1120
+ payload: { name: item.name, url },
1121
+ });
1122
+ }
1123
+ }
1124
+ function renderItem(item) {
1125
+ return (React__default["default"].createElement(ResultSectionItem, { key: item.id, item: item, type: type, imageUrl: item.logo || item.avatar || item.thumbnail, className: !isNavResultItem ? 'not-nav' : '', onClickItem: isNavResultItem && onClickItem }));
1126
+ }
1127
+ function onSeeAllClick() {
1128
+ let url = '';
1129
+ switch (type) {
1130
+ case 'specialties':
1131
+ url = `/${typeSlug}`;
1132
+ break;
1133
+ case 'services':
1134
+ case 'doctors':
1135
+ case 'hospitals':
1136
+ url = `/${selectedLocation.slug}/${typeSlug}`;
1137
+ break;
1138
+ }
1139
+ if (url) {
1140
+ dispatch({ type: ActionTypes.NavigateTo, payload: url });
1141
+ }
1142
+ }
1143
+ function onClickSearchByKeyword() {
1144
+ const { slug: typeSlug } = typeInformation[type];
1145
+ const url = `/${selectedLocation.slug}/${typeSlug}?q=${searchKeywords}`;
1146
+ dispatch({ type: ActionTypes.NavigateTo, payload: url });
1147
+ }
1148
+ return (React__default["default"].createElement("section", null,
1149
+ React__default["default"].createElement(StyledTypeHeader, null,
1150
+ React__default["default"].createElement(StyledInfoWrapper, null,
1151
+ typeInformation[type].icon,
1152
+ React__default["default"].createElement(StyledTypeName, null, typeInformation[type].name)),
1153
+ (keyword.trim().length <= SEARCH_KEYWORD_MIN_LENGTH[locale] ||
1154
+ isMalay) && (React__default["default"].createElement(StyledSeeMoreButton, { onClick: onSeeAllClick },
1155
+ React__default["default"].createElement(index$1.Text, { size: "p3", color: miscTheme.theme.colors.primaryBase }, t('booking.searchPopup.seeAll'))))),
1156
+ (isLoading || (data && data.length > 0)) && (React__default["default"].createElement(StyledResultsContainer, null,
1157
+ React__default["default"].createElement(StyledItemsWrapper, null,
1158
+ isLoading &&
1159
+ Array(2)
1160
+ .fill(undefined)
1161
+ .map((_, i) => (React__default["default"].createElement(StyledResult, { key: type + 'loading' + i },
1162
+ React__default["default"].createElement(StyledPictureWrapper, null,
1163
+ React__default["default"].createElement(StyledImageSkeletonWrapper, null,
1164
+ React__default["default"].createElement(Skeleton__default["default"], { height: 14, width: type === 'hospitals' ? 12 : 32, style: {
1165
+ maxWidth: 'var(--graphicSize)',
1166
+ minHeight: 'var(--graphicSize)',
1167
+ } }))),
1168
+ React__default["default"].createElement(Skeleton__default["default"], { width: 120, height: 24 })))),
1169
+ !isLoading &&
1170
+ data &&
1171
+ data.length > 0 &&
1172
+ data.slice(0, showItemCount).map(renderItem)),
1173
+ React__default["default"].createElement(StyledItemsWrapper, { isShown: seeMoreOpen, isMore: true }, data.slice(showItemCount, -1).map(renderItem)),
1174
+ type === 'specialties' &&
1175
+ showItemCount < data.length &&
1176
+ !isLoading && (React__default["default"].createElement("button", { onClick: () => setSeeMoreOpen(!seeMoreOpen) },
1177
+ React__default["default"].createElement(StyledSeeMore, { size: "p3", color: miscTheme.theme.colors.primaryBase }, seeMoreOpen
1178
+ ? t('booking.searchPopup.seeLessSpecialties')
1179
+ : t('booking.searchPopup.seeMoreSpecialties')))),
1180
+ type !== 'specialties' &&
1181
+ (showItemCount < data.length || isMalay) &&
1182
+ !isLoading &&
1183
+ keyword.trim().length > SEARCH_KEYWORD_MIN_LENGTH[locale] && (React__default["default"].createElement("button", { onClick: onClickSearchByKeyword },
1184
+ React__default["default"].createElement(StyledSeeMore, { size: "p3", color: miscTheme.theme.colors.primaryBase }, t(`booking.searchPopup.searchIn.${type}`, {
1185
+ name: keyword,
1186
+ })))))),
1187
+ !isLoading && (data === null || data === void 0 ? void 0 : data.length) === 0 && (React__default["default"].createElement(StyledResultsContainer, null,
1188
+ React__default["default"].createElement(index$1.Text, { size: "sm", color: miscTheme.theme.colors.gray400 }, t('booking.searchBar.noResults'))))));
1189
+ };
1190
+
1191
+ const StyledSection = styled__default["default"].section `
1192
+ background-color: white;
1193
+ border-radius: 4px;
1194
+ position: absolute;
1195
+ width: 100%;
1196
+ z-index: 30;
1197
+
1198
+ ${utils$1.MediaQueries.tdUp} {
1199
+ box-shadow: 0px 24px 32px rgba(0, 0, 0, 0.04),
1200
+ 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04),
1201
+ 0px 0px 1px rgba(0, 0, 0, 0.04);
1202
+ }
1203
+ `;
1204
+ const SearchResults = ({ data, state, dispatch, isMobile, isLoading, keyword, hideResults, isNavResultItem, }) => {
1205
+ return (React__default["default"].createElement(StyledSection, null, data &&
1206
+ data.map((data) => {
1207
+ if (hideResults && hideResults.includes(data.type)) {
1208
+ return React__default["default"].createElement(React__default["default"].Fragment, null);
1209
+ }
1210
+ return (React__default["default"].createElement(ResultSection, { type: data.type, state: state, dispatch: dispatch, itemsToShow: 2, itemsToShowDesktop: 4, key: data.type, data: data.results, isMobile: isMobile, isLoading: isLoading, keyword: keyword, isNavResultItem: isNavResultItem }));
1211
+ })));
1212
+ };
1213
+
1214
+ function useSearchBarApi({ dispatch, careApiDomain, locale = 'vi-VN', }) {
1215
+ const fetchCitiesApi = React.useCallback(function fetchCitiesApi(path, params = {}) {
1216
+ const url = `${careApiDomain}${path}`;
1217
+ dispatch({ type: ActionTypes.FetchCitiesStart });
1218
+ return fetch(utils.getApiPath(url, params, locale), { method: 'GET' })
1219
+ .then((res) => res.json())
1220
+ .then((data) => {
1221
+ if (data._status !== 1 || !data._data) {
1222
+ console.log('error loading cities', data);
1223
+ return Promise.reject(data);
1224
+ }
1225
+ return data === null || data === void 0 ? void 0 : data._data;
1226
+ })
1227
+ .finally(() => dispatch({ type: ActionTypes.FetchCitiesFinish }));
1228
+ }, [locale]);
1229
+ const fetchCitiesByLocation = React.useCallback(function fetchCitiesByLocation({ coordinates }) {
1230
+ let params = {};
1231
+ const moreParams = {};
1232
+ if (coordinates) {
1233
+ params = {
1234
+ lat: coordinates.lat,
1235
+ lng: coordinates.lng,
1236
+ };
1237
+ }
1238
+ if (locale === 'ms-MY') {
1239
+ moreParams.noPaging = 1;
1240
+ }
1241
+ const requests = [
1242
+ fetchCitiesApi(paths.PATHS.GET_CITY_BY_IP, Object.assign(Object.assign({}, params), moreParams)),
1243
+ ];
1244
+ if (locale === 'zh-TW') {
1245
+ requests.push(fetchCitiesApi(paths.PATHS.GET_CITIES_LIST, { noPaging: 1 }));
1246
+ }
1247
+ return Promise.all(requests)
1248
+ .then(([data1, data2]) => {
1249
+ const data = Object.assign({}, data1);
1250
+ if (data2) {
1251
+ const citiesIds = data.cities.map((c) => c.id);
1252
+ data.cities = data.cities.concat(data2.cities.filter((c) => !citiesIds.includes(c.id)));
1253
+ }
1254
+ dispatch({
1255
+ type: ActionTypes.FetchCitiesByGeoIpComplete,
1256
+ payload: data,
1257
+ });
1258
+ })
1259
+ .catch((err) => console.error('error loading cities by location', err));
1260
+ }, [locale, careApiDomain, dispatch]);
1261
+ const fetchCitiesByKeyword = React.useCallback(function fetchCitiesByKeyword(keyword) {
1262
+ return fetchCitiesApi(paths.PATHS.GET_CITIES_LIST, { keyword })
1263
+ .then((data) => {
1264
+ dispatch({
1265
+ type: ActionTypes.FetchCitiesByKeywordComplete,
1266
+ payload: data.cities,
1267
+ });
1268
+ })
1269
+ .catch((err) => console.error('error loading cities by keyword', err));
1270
+ }, [locale, careApiDomain, dispatch]);
1271
+ const fetchSearchResults = React.useCallback(function fetchSearchResults(searchKeywords, state) {
1272
+ const url = `${careApiDomain}${paths.PATHS.GET_SEARCH_V2}`;
1273
+ dispatch({ type: ActionTypes.FetchSearchResultsStart });
1274
+ const { defaultCity, selectedLocation, geoLocationCoordinates } = state;
1275
+ let cityId = '';
1276
+ if (!selectedLocation || !defaultCity) {
1277
+ dispatch({ type: ActionTypes.FetchSearchResultsFinish });
1278
+ return;
1279
+ }
1280
+ const isCurrentLocationSelected = selectedLocation.id === constants.ID_OPTION_CURRENT_LOCATION;
1281
+ if (isCurrentLocationSelected) {
1282
+ if (!geoLocationCoordinates) {
1283
+ cityId = defaultCity.id;
1284
+ }
1285
+ }
1286
+ else if (selectedLocation.id === constants.ID_OPTION_ALL_LOCATION) {
1287
+ cityId = '';
1288
+ }
1289
+ else {
1290
+ cityId = selectedLocation.id;
1291
+ }
1292
+ const lat = (geoLocationCoordinates === null || geoLocationCoordinates === void 0 ? void 0 : geoLocationCoordinates.lat) || '';
1293
+ const lng = (geoLocationCoordinates === null || geoLocationCoordinates === void 0 ? void 0 : geoLocationCoordinates.lng) || '';
1294
+ return fetch(utils.getApiPath(url, {
1295
+ domain: careApiDomain,
1296
+ searchType: 'global',
1297
+ keyword: searchKeywords.trim().length > SEARCH_KEYWORD_MIN_LENGTH[locale]
1298
+ ? searchKeywords.trim()
1299
+ : '',
1300
+ city: cityId === constants.ID_OPTION_CURRENT_LOCATION ? '' : cityId,
1301
+ lat,
1302
+ lng,
1303
+ }, locale), {
1304
+ method: 'GET',
1305
+ headers: {
1306
+ accept: 'version=2.0.0.0',
1307
+ },
1308
+ })
1309
+ .then((res) => res.json())
1310
+ .then((data) => {
1311
+ if (data._status !== 1 || !data._data) {
1312
+ return Promise.reject(data);
1313
+ }
1314
+ return data === null || data === void 0 ? void 0 : data._data;
1315
+ })
1316
+ .then((results) => dispatch({
1317
+ type: ActionTypes.FetchSearchResultsComplete,
1318
+ payload: results,
1319
+ }))
1320
+ .catch((error) => {
1321
+ console.log('error loading search results', { url, error });
1322
+ })
1323
+ .finally(() => dispatch({ type: ActionTypes.FetchSearchResultsFinish }));
1324
+ }, [locale, careApiDomain, dispatch]);
1325
+ return {
1326
+ fetchCitiesByLocation,
1327
+ fetchCitiesByKeyword,
1328
+ fetchSearchResults,
1329
+ };
1330
+ }
1331
+
1332
+ const BookingSearchBar = ({ isMobile, careApiDomain, geoLocationPermission: geoLocationPermissionFromProps, geoLocationCoordinates: geoLocationCoordinatesFromProps, initialSelectedCity: initialSelectedCityFromProps, initialSearchValue = '', careFrontDomain = '/care', isDebug = false, askForGeolocationPermission = false, gaTrackingSearchBar, gaTrackingLocationSearch, autoCompleteDisabled = false, inputSearchPlaceholder = '', isOptionAllLocation = false, hideResults = [], isNavResultItem = true, routerPush, onGeoLocationPermissionChange, onSearch, onChangeLocation, }) => {
1333
+ const { t, locale } = useTranslations.useTranslations();
1334
+ const wrapperRef = React.useRef(null);
1335
+ const hiddenInputRef = React.useRef(null);
1336
+ const [viewportHeight, setViewportHeight] = React.useState(undefined);
1337
+ const [isNavResultPage, setIsNavResultPage] = React.useState(false);
1338
+ const { geoLocationPermission: geoLocationPermissionFromHook, geoLocationCoordinates: geoLocationCoordinatesFromHook, requestGeoLocation, } = utils.useGeolocation();
1339
+ const [state, dispatch] = React.useReducer(reducer, initialState, (s) => (Object.assign(Object.assign({}, s), { isDebug,
1340
+ isMobile, geoLocationPermission: geoLocationPermissionFromProps ||
1341
+ geoLocationPermissionFromHook ||
1342
+ 'unset', geoLocationCoordinates: geoLocationCoordinatesFromProps ||
1343
+ geoLocationCoordinatesFromHook ||
1344
+ null, searchKeywords: initialSearchValue, initialSelectedCity: initialSelectedCityFromProps || null, selectedLocation: initialSelectedCityFromProps || s.selectedLocation || null, searchLocationKeywords: (initialSelectedCityFromProps === null || initialSelectedCityFromProps === void 0 ? void 0 : initialSelectedCityFromProps.name) || s.searchLocationKeywords, autoCompleteDisabled,
1345
+ inputSearchPlaceholder,
1346
+ locale })));
1347
+ const { navigateTo, focused, isLoadingCities, cities, searchKeywords, geoLocationPermission, selectedLocation, initialSelectedCity, defaultCity, searchResults, isLoadingSearchResults, isMobileModalOpened, inputSearchPlaceholder: inputSearchPlaceholderState, } = state;
1348
+ const { fetchCitiesByLocation, fetchCitiesByKeyword, fetchSearchResults } = useSearchBarApi({
1349
+ dispatch,
1350
+ locale,
1351
+ careApiDomain,
1352
+ });
1353
+ const currentLocationCityItem = React.useMemo(() => {
1354
+ var _a;
1355
+ return ({
1356
+ id: constants.ID_OPTION_CURRENT_LOCATION,
1357
+ name: t('booking.searchBar.currentLocation'),
1358
+ slug: (_a = constants.LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.CURRENT,
1359
+ });
1360
+ }, [t, locale]);
1361
+ const debouncedFetchCitiesByKeyword = React.useMemo(() => debounce__default["default"](fetchCitiesByKeyword, 400), [fetchCitiesByKeyword]);
1362
+ const debouncedFetchSearchResults = React.useMemo(() => debounce__default["default"](fetchSearchResults, 400), [fetchSearchResults]);
1363
+ React.useEffect(() => {
1364
+ if (initialSearchValue !== '' &&
1365
+ initialSearchValue !== state.searchKeywords) {
1366
+ dispatch({
1367
+ type: ActionTypes.UpdateInitialSearchValue,
1368
+ payload: initialSearchValue,
1369
+ });
1370
+ }
1371
+ }, [initialSearchValue]);
1372
+ React.useEffect(() => {
1373
+ if (askForGeolocationPermission &&
1374
+ (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === constants.ID_OPTION_CURRENT_LOCATION &&
1375
+ geoLocationPermission === 'unset') {
1376
+ requestGeoLocation();
1377
+ }
1378
+ }, [askForGeolocationPermission, selectedLocation, geoLocationPermission]);
1379
+ React.useEffect(() => {
1380
+ if (!geoLocationPermissionFromProps &&
1381
+ geoLocationPermission !== geoLocationPermissionFromHook) {
1382
+ if (geoLocationPermissionFromHook === 'granted' &&
1383
+ geoLocationCoordinatesFromHook) {
1384
+ dispatch({
1385
+ type: ActionTypes.GrantGeoLocationPermission,
1386
+ payload: geoLocationCoordinatesFromHook,
1387
+ });
1388
+ }
1389
+ else if (geoLocationPermissionFromHook === 'denied') {
1390
+ dispatch({ type: ActionTypes.DenyGeoLocationPermission });
1391
+ }
1392
+ }
1393
+ }, [
1394
+ geoLocationPermission,
1395
+ geoLocationPermissionFromHook,
1396
+ geoLocationCoordinatesFromHook,
1397
+ geoLocationPermissionFromProps,
1398
+ ]);
1399
+ React.useEffect(() => {
1400
+ if (navigateTo) {
1401
+ if (routerPush) {
1402
+ routerPush(navigateTo);
1403
+ }
1404
+ else {
1405
+ window.location.href = `${careFrontDomain}${navigateTo}`;
1406
+ }
1407
+ }
1408
+ }, [navigateTo]);
1409
+ const selectCurrentLocation = React.useCallback(function selectCurrentLocation() {
1410
+ dispatch({
1411
+ type: ActionTypes.SelectCurrentLocation,
1412
+ payload: currentLocationCityItem,
1413
+ });
1414
+ }, [t, dispatch]);
1415
+ React.useEffect(() => {
1416
+ var _a;
1417
+ if (geoLocationPermission !== 'denied' && !initialSelectedCity) {
1418
+ dispatch({
1419
+ type: ActionTypes.SelectLocation,
1420
+ payload: {
1421
+ name: t('booking.searchBar.allLocations'),
1422
+ id: constants.ID_OPTION_ALL_LOCATION,
1423
+ slug: (_a = constants.LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.ALL,
1424
+ },
1425
+ });
1426
+ }
1427
+ if (onGeoLocationPermissionChange) {
1428
+ onGeoLocationPermissionChange(geoLocationPermission, state.geoLocationCoordinates);
1429
+ }
1430
+ if (isMobile && geoLocationPermission === 'granted' && selectedLocation) {
1431
+ dispatch({ type: ActionTypes.FocusInputSearch });
1432
+ }
1433
+ fetchCitiesByLocation({ coordinates: state.geoLocationCoordinates });
1434
+ }, [geoLocationPermission]);
1435
+ React.useEffect(() => {
1436
+ if (selectedLocation && defaultCity) {
1437
+ fetchSearchResults(state.searchKeywords, state);
1438
+ }
1439
+ }, [selectedLocation, defaultCity]);
1440
+ React.useEffect(() => {
1441
+ if (inputSearchPlaceholder !== inputSearchPlaceholderState) {
1442
+ dispatch({
1443
+ type: ActionTypes.SetInputSearchPlaceholder,
1444
+ payload: inputSearchPlaceholder,
1445
+ });
1446
+ }
1447
+ }, [inputSearchPlaceholder, inputSearchPlaceholderState]);
1448
+ React.useEffect(() => {
1449
+ if (isMobileModalOpened) {
1450
+ document.body.classList.add('care-popup-open');
1451
+ }
1452
+ else {
1453
+ document.body.classList.remove('care-popup-open');
1454
+ }
1455
+ }, [isMobileModalOpened]);
1456
+ const handleLocationClick = React.useCallback(function handleLocationClick(city) {
1457
+ if (locale === 'ms-MY') {
1458
+ setIsNavResultPage(true);
1459
+ }
1460
+ dispatch({ type: ActionTypes.SelectLocation, payload: city });
1461
+ if (locale !== 'ms-MY') {
1462
+ focusSearchInput();
1463
+ }
1464
+ if (onChangeLocation) {
1465
+ onChangeLocation(city);
1466
+ }
1467
+ }, [t, dispatch]);
1468
+ function handleCurrentLocationClick() {
1469
+ if (locale === 'ms-MY') {
1470
+ setIsNavResultPage(true);
1471
+ }
1472
+ if (isMobile && state.geoLocationPermission !== 'granted') {
1473
+ requestGeoLocation();
1474
+ }
1475
+ else {
1476
+ selectCurrentLocation();
1477
+ if (locale !== 'ms-MY') {
1478
+ focusSearchInput();
1479
+ }
1480
+ }
1481
+ }
1482
+ function handleMobileFakeInputClick() {
1483
+ var _a;
1484
+ return tslib_es6.__awaiter(this, void 0, void 0, function* () {
1485
+ if (hiddenInputRef.current) {
1486
+ hiddenInputRef.current.focus();
1487
+ }
1488
+ dispatch({ type: ActionTypes.OpenMobileModal });
1489
+ yield Promise.resolve();
1490
+ if (wrapperRef.current) {
1491
+ (_a = wrapperRef.current
1492
+ .querySelector('input[name="search-location"]')) === null || _a === void 0 ? void 0 : _a.focus();
1493
+ }
1494
+ });
1495
+ }
1496
+ function focusLocationInput() {
1497
+ var _a;
1498
+ if (wrapperRef.current) {
1499
+ (_a = wrapperRef.current
1500
+ .querySelector('input[name="search-location"]')) === null || _a === void 0 ? void 0 : _a.focus();
1501
+ }
1502
+ }
1503
+ function focusSearchInput() {
1504
+ var _a;
1505
+ if (wrapperRef.current) {
1506
+ (_a = wrapperRef.current
1507
+ .querySelector('input[name="search-results"]')) === null || _a === void 0 ? void 0 : _a.focus();
1508
+ }
1509
+ }
1510
+ function handleMobileTopBarClose() {
1511
+ dispatch({ type: ActionTypes.CloseMobileModal });
1512
+ }
1513
+ function renderLocationResults() {
1514
+ if (focused !== 'location') {
1515
+ return null;
1516
+ }
1517
+ return (React__default["default"].createElement(LocationResults, { isLoading: isLoadingCities, cities: cities, onLocationClick: handleLocationClick, onCurrentLocationClick: handleCurrentLocationClick, isLocationLoading: isLoadingCities, geoLocationPermission: geoLocationPermission, selectedLocation: selectedLocation, isOptionAllLocation: isOptionAllLocation }));
1518
+ }
1519
+ function renderSearchResults() {
1520
+ if (focused !== 'search') {
1521
+ return null;
1522
+ }
1523
+ if (state.autoCompleteDisabled) {
1524
+ if (!isMobile) {
1525
+ return null;
1526
+ }
1527
+ return (React__default["default"].createElement(SearchButton, { onClick: () => {
1528
+ onSearch({
1529
+ cityId: state.selectedLocation.id,
1530
+ keyword: searchKeywords,
1531
+ });
1532
+ handleMobileTopBarClose();
1533
+ } }));
1534
+ }
1535
+ return (React__default["default"].createElement(SearchResults, { data: searchResults, state: state, dispatch: dispatch, isMobile: false, keyword: searchKeywords, isLoading: isLoadingSearchResults, hideResults: hideResults, isNavResultItem: isNavResultItem }));
1536
+ }
1537
+ function renderSearchInputs() {
1538
+ return (React__default["default"].createElement(SearchInputs, { isMobile: isMobile, state: state, dispatch: dispatch, debouncedFetchCitiesByKeyword: debouncedFetchCitiesByKeyword, debouncedFetchSearchResults: debouncedFetchSearchResults, focusLocationInput: focusLocationInput, focusSearchInput: focusSearchInput, renderLocationResults: renderLocationResults, renderSearchResults: renderSearchResults, trackingAttributes: gaTrackingSearchBar, locationTrackingAttributes: gaTrackingLocationSearch, onSearch: onSearch, initalSearchValue: initialSearchValue }));
1539
+ }
1540
+ React.useEffect(() => {
1541
+ if (window.visualViewport) {
1542
+ const resizeHandler = (evt) => {
1543
+ const viewport = evt.target;
1544
+ setViewportHeight(viewport === null || viewport === void 0 ? void 0 : viewport.height);
1545
+ };
1546
+ window.visualViewport.addEventListener('resize', resizeHandler, {
1547
+ passive: true,
1548
+ });
1549
+ return () => {
1550
+ window.visualViewport.removeEventListener('resize', resizeHandler);
1551
+ };
1552
+ }
1553
+ }, [setViewportHeight]);
1554
+ React.useEffect(() => {
1555
+ // Apply for ms-MY. Navigation to result page after selected location
1556
+ if (selectedLocation && isNavResultPage && locale === 'ms-MY') {
1557
+ const url = `/${selectedLocation.slug}/hospital`;
1558
+ dispatch({ type: ActionTypes.NavigateTo, payload: url });
1559
+ setIsNavResultPage(false);
1560
+ }
1561
+ }, [isNavResultPage, locale, selectedLocation]);
1562
+ if (isMobile) {
1563
+ return (React__default["default"].createElement(React__default["default"].Fragment, null,
1564
+ React__default["default"].createElement(react.Global, { styles: react.css `
1565
+ .care-popup-open {
1566
+ overflow: hidden;
1567
+ position: fixed;
1568
+ &::before {
1569
+ content: '';
1570
+ inset: 0;
1571
+ position: absolute;
1572
+ background-color: white;
1573
+ min-height: 100vh;
1574
+ min-width: 100vw;
1575
+ z-index: 2;
1576
+ }
1577
+ }
1578
+ ` }),
1579
+ React__default["default"].createElement(StyledHiddenInputMobile, { ref: hiddenInputRef }),
1580
+ React__default["default"].createElement(StyledSearchBarMobileWrapper, { id: "booking-search-bar", ref: wrapperRef, "data-is-modal": isMobile && isMobileModalOpened, style: {
1581
+ '--mobile-care-searchbar-height': isMobileModalOpened && viewportHeight
1582
+ ? `${viewportHeight}px`
1583
+ : '100%',
1584
+ } }, !isMobileModalOpened ? (React__default["default"].createElement(MobileFakeInput, { onClick: handleMobileFakeInputClick, focused: focused, value: searchKeywords, trackingAttributes: gaTrackingSearchBar, inputSearchPlaceholder: inputSearchPlaceholder })) : (React__default["default"].createElement(React__default["default"].Fragment, null,
1585
+ React__default["default"].createElement(StyledSearchBarMobileModalHeader, null,
1586
+ React__default["default"].createElement(MobileTopBar, { headingText: t('booking.searchBar.searchButton'), onLeftClick: handleMobileTopBarClose }),
1587
+ renderSearchInputs()),
1588
+ renderLocationResults(),
1589
+ renderSearchResults())))));
1590
+ }
1591
+ return (React__default["default"].createElement(StyledSearchBarWrapper, { id: "booking-search-bar", ref: wrapperRef }, renderSearchInputs()));
1592
+ };
1593
+
1594
+ exports.BookingSearchBar = BookingSearchBar;