@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
@@ -1,3433 +0,0 @@
1
- import { a as __awaiter } from './tslib.es6-3970c414.js';
2
- import React__default, { useState, useCallback, useMemo, useEffect, useRef, useReducer } from 'react';
3
- import { Global, css } from '@emotion/react';
4
- import { u as useTranslations } from './useTranslations-160e66cc.js';
5
- import debounce from 'lodash/debounce';
6
- import { I as ID_OPTION_ALL_LOCATION, L as LOCALIZED_SLUGS, a as ID_OPTION_CURRENT_LOCATION, M as MAPPING_CLIENT_WITH_SLUG, S as SLUG_VACIN_ID, C as CLIENT_KEY } from './constants-410be40f.js';
7
- import styled from '@emotion/styled';
8
- import { I as Input } from './index-f42f0c66.js';
9
- import { T as Text } from './index-7d97103f.js';
10
- import { theme } from './miscTheme.js';
11
- import shuffle from 'lodash/shuffle';
12
- import { a as useOutsideClick } from './useOutsideClick-2fae5fb5.js';
13
- import { M as MediaQueries } from './utils-cee25689.js';
14
- import Skeleton from 'react-loading-skeleton';
15
- import { P as PATHS } from './paths-650d5eee.js';
16
- import { Skeleton as Skeleton$1, Input as Input$1, Divider, Tabs, Flex, Button } from '@mantine/core';
17
- import { U as USER_GEOLOCATION_COORDINATES_COOKIE } from './index-69ca7b6a.js';
18
- import { getCookie, setCookie, deleteCookie } from './miscCookieHelper.js';
19
- import { C as Container } from './index-fcd9b927.js';
20
- import { Search } from '@hhgtech/icons/core';
21
- import { C as ChevronDown } from './ChevronDown-5633c5e8.js';
22
- import formatString from 'string-format';
23
- import { domainLocales } from './constantsDomainLocales.js';
24
-
25
- function useGeolocation() {
26
- const [permission, setPermission] = useState(() => {
27
- if (typeof window === 'undefined') {
28
- return 'unset';
29
- }
30
- if (getCookie(USER_GEOLOCATION_COORDINATES_COOKIE)) {
31
- return 'granted';
32
- }
33
- const blocked = !location.protocol.includes('https') && location.hostname !== 'localhost';
34
- if (!navigator.geolocation || blocked) {
35
- return 'denied';
36
- }
37
- return 'unset';
38
- });
39
- const [coordinates, setCoordinates] = useState(() => {
40
- if (typeof window === 'undefined') {
41
- return null;
42
- }
43
- const cookie = getCookie(USER_GEOLOCATION_COORDINATES_COOKIE);
44
- if (cookie) {
45
- try {
46
- return JSON.parse(cookie);
47
- }
48
- catch (err) {
49
- console.log(err);
50
- }
51
- }
52
- return null;
53
- });
54
- const request = useCallback(function request() {
55
- // setPermission()
56
- if (navigator.geolocation) {
57
- navigator.geolocation.getCurrentPosition((position) => {
58
- const gps = {
59
- lat: `${Math.round(position.coords.latitude * 10000000) / 10000000}`,
60
- lng: `${Math.round(position.coords.longitude * 10000000) / 10000000}`,
61
- };
62
- setCookie(USER_GEOLOCATION_COORDINATES_COOKIE, JSON.stringify(gps), {
63
- minutes: 15,
64
- });
65
- setCoordinates(gps);
66
- setPermission('granted');
67
- }, () => {
68
- deleteCookie(USER_GEOLOCATION_COORDINATES_COOKIE);
69
- setPermission('denied');
70
- });
71
- }
72
- }, []);
73
- return useMemo(() => ({
74
- geoLocationPermission: permission,
75
- geoLocationCoordinates: coordinates,
76
- requestGeoLocation: request,
77
- }), [permission, coordinates]);
78
- }
79
-
80
- const StyledSearchBarWrapper$1 = styled.div ``;
81
- const StyledSearchBarMobileWrapper = styled.div `
82
- --searchbar-z-index: 305;
83
- &[data-is-modal='true'] {
84
- position: fixed;
85
- left: 0;
86
- right: 0;
87
- top: 0;
88
- height: var(--mobile-care-searchbar-height, 100%);
89
- overflow-y: auto;
90
- -webkit-overflow-scrolling: touch;
91
- background-color: white;
92
- z-index: var(--searchbar-z-index);
93
- }
94
- `;
95
- const StyledSearchBarMobileModalHeader = styled.section ``;
96
- const StyledHiddenInputMobile = styled.input `
97
- position: fixed;
98
- left: -100%;
99
- top: -100%;
100
- `;
101
- const StyledInput = styled(Input) `
102
- #booking-search-bar & {
103
- input {
104
- font-size: 16px;
105
- }
106
- }
107
- `;
108
-
109
- const ClearIcon = ({ className, color }) => (React__default.createElement("svg", { className: className, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" },
110
- React__default.createElement("rect", { x: "4", y: "4", width: "16", height: "16", rx: "8", fill: "white" }),
111
- React__default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8.29289 8.29289C8.68342 7.90237 9.31658 7.90237 9.70711 8.29289L12 10.5858L14.2929 8.29289C14.6834 7.90237 15.3166 7.90237 15.7071 8.29289C16.0976 8.68342 16.0976 9.31658 15.7071 9.70711L13.4142 12L15.7071 14.2929C16.0976 14.6834 16.0976 15.3166 15.7071 15.7071C15.3166 16.0976 14.6834 16.0976 14.2929 15.7071L12 13.4142L9.70711 15.7071C9.31658 16.0976 8.68342 16.0976 8.29289 15.7071C7.90237 15.3166 7.90237 14.6834 8.29289 14.2929L10.5858 12L8.29289 9.70711C7.90237 9.31658 7.90237 8.68342 8.29289 8.29289Z", fill: color || 'currentColor' })));
112
- const CloseIcon = ({ className, color }) => (React__default.createElement("svg", { className: className, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" },
113
- React__default.createElement("path", { d: "M18 6L6 18", stroke: color || 'currentColor', strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
114
- React__default.createElement("path", { d: "M6 6L18 18", stroke: color || 'currentColor', strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })));
115
- const PinIcon = ({ className, color }) => (React__default.createElement("svg", { width: "14", height: "20", viewBox: "0 0 14 20", className: className },
116
- React__default.createElement("path", { d: "M7 0C3.134 0 0 3.134 0 7C0 10.966 4.404 16.82 6.226 19.071C6.626 19.565 7.374 19.565 7.774 19.071C9.596 16.82 14 10.966 14 7C14 3.134 10.866 0 7 0ZM7 9.5C5.619 9.5 4.5 8.381 4.5 7C4.5 5.619 5.619 4.5 7 4.5C8.381 4.5 9.5 5.619 9.5 7C9.5 8.381 8.381 9.5 7 9.5Z", fill: color || 'currentColor' })));
117
- const MagnifierIcon = ({ className, color }) => (React__default.createElement("svg", { className: className, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" },
118
- React__default.createElement("path", { d: "M11 18C14.866 18 18 14.866 18 11C18 7.13401 14.866 4 11 4C7.13401 4 4 7.13401 4 11C4 14.866 7.13401 18 11 18Z", stroke: color || 'currentColor', strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
119
- React__default.createElement("path", { d: "M20 20L16 16", stroke: color || 'currentColor', strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })));
120
- const DefaultThumbnailAny = ({ width, height, }) => (React__default.createElement("svg", { width: width || 30, height: height || 30, viewBox: "0 0 30 30", fill: "none" },
121
- React__default.createElement("circle", { cx: "15", cy: "15", r: "15", fill: "#F7F9FC" })));
122
- const DefaultThumbnailDoctor = ({ width, height, }) => (React__default.createElement("svg", { width: width || 32, height: height || 32, viewBox: "0 0 32 32", fill: "none" },
123
- React__default.createElement("g", { clipPath: "url(#clip0_14712_400114)" },
124
- React__default.createElement("rect", { width: "32", height: "32", rx: "16", fill: "#E4E8EC" }),
125
- React__default.createElement("path", { d: "M22.065 9.58305C22.1108 9.80952 22.1431 10.0396 22.1614 10.2722C22.3769 13.0522 22.5858 16.1276 22.5727 17.618C22.5306 20.5688 19.708 21.1325 19.4564 21.1769L19.4495 21.5357L19.5228 23.9014C20.8688 23.9341 22.203 24.1759 23.4772 24.6196C24.5264 24.9739 25.4827 25.5591 26.2757 26.332C27.0688 27.105 27.6783 28.0461 28.0594 29.0858L31.9886 39.2068C31.91 39.3048 30.6939 39.6356 29.4888 39.944C30.1695 42.3315 30.4582 44.8142 30.3432 47.2953C30.2991 48.2666 30.1816 49.264 29.7245 50.1211C29.4508 50.6342 29.0319 51.0912 28.5296 51.3753C28.5099 51.4347 28.4864 51.4928 28.4593 51.5495C28.4293 51.6146 28.3908 51.6756 28.3448 51.7307C28.3293 51.7772 28.3232 51.8406 28.3162 51.9135C28.3004 52.0779 28.2799 52.2909 28.1362 52.4685C28.001 52.6373 27.8519 52.7945 27.6905 52.9386C27.6905 52.9386 27.092 52.9667 26.4133 52.9845L26.458 58.4088H5.7492L6.30965 52.9523L5.66093 53.1637C5.07664 53.3528 4.45628 53.4028 3.84925 53.3099C3.24222 53.2169 2.66526 52.9835 2.1643 52.6283C1.61489 52.2388 1.17445 51.715 0.884966 51.1068C0.595484 50.4987 0.46662 49.8266 0.510669 49.1545L0.644528 47.1369L1.41503 38.3366L1.81323 38.4135L-0.914307 37.8437L-0.402886 36.5663C-0.407359 36.5645 -0.411803 36.5627 -0.416214 36.5608C-0.410804 36.56 -0.40538 36.5594 -0.399946 36.5589L2.05995 30.4146C3.00034 28.0825 4.7421 26.1624 6.97187 24.9999C8.56171 24.176 10.3028 23.6861 12.0882 23.5597L11.788 16.5865C11.1882 16.6507 10.0095 16.5266 9.96087 14.954C9.91229 13.3824 11.0457 13.3171 11.6507 13.3961L11.6445 13.2523C11.5785 12.8433 11.5088 12.439 11.4577 12.2132C11.3782 11.8628 11.2611 11.4953 11.1419 11.1207C10.8794 10.2967 10.6061 9.43855 10.697 8.65293C10.697 8.65293 10.6909 8.00438 11.4565 7.24044C11.3707 6.86644 11.3686 6.47786 11.4507 6.10258C11.5366 5.70965 11.7125 5.34199 11.9645 5.02848C12.2165 4.71497 12.5377 4.46414 12.9029 4.29569C13.2682 4.12725 13.6675 4.04577 14.0696 4.05766C14.2277 4.06393 14.3849 4.08493 14.5418 4.10589C14.7932 4.13945 15.0439 4.17294 15.2971 4.14581C15.7708 4.09409 16.177 3.83884 16.5862 3.58167C16.8357 3.42492 17.0863 3.26745 17.354 3.15494C17.9119 2.93744 18.5266 2.91281 19.1002 3.08497C19.6738 3.25713 20.1733 3.61619 20.5192 4.105C20.5943 4.21716 20.6621 4.33678 20.7298 4.45631C20.9035 4.76299 21.077 5.06915 21.373 5.24769C21.5927 5.38236 21.8482 5.42658 22.1057 5.47114C22.2633 5.49842 22.4216 5.52582 22.5728 5.57417C23.0267 5.71015 23.3999 6.0411 23.6319 6.45436C23.6327 6.40753 23.6317 6.36062 23.629 6.31374C23.6502 6.3657 23.6623 6.42092 23.6649 6.47698C23.6661 6.49165 23.667 6.50632 23.6677 6.521C23.8246 6.82609 23.9058 7.17114 23.8885 7.51347C23.8544 7.93447 23.7053 8.33801 23.4574 8.68001C23.2096 9.02201 22.8725 9.28933 22.483 9.45278C22.3469 9.50712 22.2071 9.55061 22.065 9.58305Z", fill: "white" })),
126
- React__default.createElement("defs", null,
127
- React__default.createElement("clipPath", { id: "clip0_14712_400114" },
128
- React__default.createElement("rect", { width: "32", height: "32", rx: "16", fill: "white" })))));
129
- const DefaultThumbnailService = ({ width, height, }) => (React__default.createElement("svg", { width: width || 30, height: height || 30, viewBox: "0 0 30 30", fill: "none" },
130
- React__default.createElement("circle", { cx: "15", cy: "15", r: "15", fill: "#F7F9FC" }),
131
- React__default.createElement("path", { d: "M14.9998 6.66663C12.2752 6.66663 9.85335 7.97848 8.33317 9.99996H10.5988C11.8 8.94527 13.3625 8.33329 14.9998 8.33329C16.6372 8.33329 18.1997 8.94527 19.4009 9.99996H21.6665C20.1463 7.97848 17.7244 6.66663 14.9998 6.66663ZM7.7863 10.8333C7.07666 13.0403 6.6665 15.5989 6.6665 18.3333C6.6665 20.0846 6.82601 21.7675 7.13525 23.3333H22.8644C23.1737 21.7675 23.3332 20.0846 23.3332 18.3333C23.3332 15.5989 22.923 13.0403 22.2134 10.8333H7.7863ZM14.9998 13.3333C17.3013 13.3333 19.1665 15.1985 19.1665 17.5C19.1665 19.8014 17.3013 21.6666 14.9998 21.6666C12.6984 21.6666 10.8332 19.8014 10.8332 17.5C10.8332 15.1985 12.6984 13.3333 14.9998 13.3333ZM14.1665 15V16.6666H12.4998V18.3333H14.1665V20H15.8332V18.3333H17.4998V16.6666H15.8332V15H14.1665Z", fill: "#BFC5CC" })));
132
-
133
- const StyledLiSkeleton$1 = styled.li `
134
- display: flex;
135
- align-items: center;
136
- gap: 12px;
137
- padding: 8px 16px;
138
-
139
- > :first-child {
140
- flex: 1;
141
- }
142
-
143
- > :nth-child(2) {
144
- flex: 6;
145
- }
146
-
147
- & + li::before {
148
- content: '';
149
- position: absolute;
150
- left: 18px;
151
- right: 18px;
152
- top: 0;
153
- height: 1px;
154
- background-color: ${theme.colors.neutral100};
155
- }
156
- `;
157
- const LiSkeleton = ({ count, className }) => {
158
- return (React__default.createElement(React__default.Fragment, null, [...Array(count)].map((__v, i) => (React__default.createElement(StyledLiSkeleton$1, { className: className, key: i },
159
- React__default.createElement(Skeleton, { count: 1, height: 32 }),
160
- React__default.createElement(Skeleton, { count: 1, height: 24 }))))));
161
- };
162
-
163
- const checkMarkIconUrl = `url("data:image/svg+xml,%3Csvg width='19' height='14' viewBox='0 0 19 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.9803 0.990669C16.7205 0.99841 16.4739 1.10699 16.2928 1.2934L5.99984 11.5864L2.70687 8.2934C2.61473 8.19743 2.50436 8.12081 2.38223 8.06802C2.2601 8.01524 2.12867 7.98735 1.99563 7.986C1.86259 7.98464 1.73061 8.00985 1.60743 8.06014C1.48426 8.11043 1.37235 8.18479 1.27827 8.27887C1.1842 8.37295 1.10983 8.48485 1.05954 8.60803C1.00926 8.73121 0.98405 8.86318 0.985403 8.99622C0.986757 9.12926 1.01464 9.26069 1.06743 9.38282C1.12021 9.50495 1.19684 9.61532 1.29281 9.70747L5.29281 13.7075C5.48035 13.8949 5.73467 14.0002 5.99984 14.0002C6.26501 14.0002 6.51933 13.8949 6.70687 13.7075L17.7069 2.70747C17.8514 2.567 17.9501 2.38616 17.99 2.18864C18.03 1.99112 18.0093 1.78614 17.9308 1.60055C17.8523 1.41497 17.7195 1.25744 17.5499 1.14861C17.3803 1.03978 17.1817 0.984729 16.9803 0.990669Z' fill='%232685F1'/%3E%3C/svg%3E%0A")`;
164
- const StyledLocationResultsWrapper = styled.div `
165
- display: flex;
166
- position: absolute;
167
- top: 48px;
168
- min-width: 100%;
169
- box-shadow: 0px 24px 32px rgba(0, 0, 0, 0.04),
170
- 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04),
171
- 0px 0px 1px rgba(0, 0, 0, 0.04);
172
- border-radius: ${theme.borderRadius};
173
- background-color: white;
174
- z-index: 30;
175
-
176
- ${MediaQueries.tdDown} {
177
- position: relative;
178
- top: 0;
179
- box-shadow: initial;
180
- }
181
- `;
182
- const StyledLocationResultsList = styled.ul `
183
- width: 100%;
184
- max-height: 600px;
185
- overflow-y: auto;
186
- `;
187
- const StyledPinIcon$1 = styled(PinIcon) `
188
- width: 12px;
189
- height: 18px;
190
- `;
191
- const StyledLocationItem$1 = styled.li `
192
- position: relative;
193
- cursor: pointer;
194
- padding: 12px 18px;
195
- display: flex;
196
- align-items: center;
197
- gap: 14px;
198
- overflow: hidden;
199
-
200
- ${({ isSelected }) => isSelected &&
201
- `
202
- &::after {
203
- content: ${checkMarkIconUrl};
204
- top: 50%;
205
- right: 18px;
206
- position: absolute;
207
- transform: translateY(-50%);
208
- }
209
- `}
210
-
211
- & + li::before {
212
- content: '';
213
- position: absolute;
214
- left: 18px;
215
- right: 18px;
216
- top: 0;
217
- height: 1px;
218
- background-color: ${theme.colors.neutral100};
219
- }
220
-
221
- &:not([data-is-denied='true']):hover {
222
- background-color: ${theme.colors.neutral50};
223
- }
224
-
225
- &:last-child:hover {
226
- border-bottom-right-radius: 6px;
227
- border-bottom-left-radius: 6px;
228
- }
229
-
230
- &:first-child:hover {
231
- border-top-right-radius: 6px;
232
- border-top-left-radius: 6px;
233
- }
234
-
235
- &[data-is-denied='true'] {
236
- cursor: not-allowed;
237
- }
238
- `;
239
- const StyledLiSkeleton = styled(LiSkeleton) `
240
- &:first-child {
241
- padding-top: 18px;
242
- }
243
- `;
244
-
245
- const LocationResults = ({ cities, isLoading, onLocationClick, selectedLocation, }) => {
246
- const { t, locale } = useTranslations();
247
- const renderContent = () => {
248
- if (isLoading) {
249
- return React__default.createElement(StyledLiSkeleton, { count: 5 });
250
- }
251
- if (!cities || cities.length < 1) {
252
- return (React__default.createElement(React__default.Fragment, null,
253
- React__default.createElement(StyledLocationItem$1, { "data-is-denied": "true" },
254
- React__default.createElement(Text, { size: "sm", color: "#ccc" }, t('booking.searchBar.noResults')))));
255
- }
256
- return (React__default.createElement(React__default.Fragment, null,
257
- React__default.createElement(StyledLocationItem$1, { key: "all-location", role: "button", tabIndex: 0, onClick: () => {
258
- var _a;
259
- if (onLocationClick) {
260
- onLocationClick({
261
- name: t('booking.searchBar.allLocations'),
262
- id: ID_OPTION_ALL_LOCATION,
263
- slug: (_a = LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.ALL,
264
- });
265
- }
266
- } },
267
- React__default.createElement(StyledPinIcon$1, { color: theme.colors.neutral400 }),
268
- React__default.createElement(Text, { size: "md" }, t('booking.searchBar.allLocations'))),
269
- cities.map((city) => (React__default.createElement(StyledLocationItem$1, { key: city.id, onClick: (evt) => {
270
- evt.nativeEvent.stopImmediatePropagation();
271
- if (onLocationClick) {
272
- onLocationClick(city);
273
- }
274
- }, role: "button", tabIndex: 0, "aria-label": `Select ${city.name} as location`, isSelected: (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === city.id },
275
- React__default.createElement(StyledPinIcon$1, { color: theme.colors.neutral400 }),
276
- React__default.createElement(Text, { size: "md" }, city.name))))));
277
- };
278
- return (React__default.createElement(StyledLocationResultsWrapper, { "data-testid": "location-search-results" },
279
- React__default.createElement(StyledLocationResultsList, null, renderContent())));
280
- };
281
-
282
- const EVENT_NAMES = {
283
- TYPE_CHARACTER: 'TYPE_CHARACTER',
284
- REMOVE_CHARACTER: 'REMOVE_CHARACTER',
285
- REMOVE_ALL: 'REMOVE_ALL',
286
- REMOVE_LAST_VISIBLE_NODE: 'REMOVE_LAST_VISIBLE_NODE',
287
- PAUSE_FOR: 'PAUSE_FOR',
288
- CHANGE_DELETE_SPEED: 'CHANGE_DELETE_SPEED',
289
- CHANGE_DELAY: 'CHANGE_DELAY',
290
- PASTE_STRING: 'PASTE_STRING',
291
- };
292
- const getRandomInteger = (min, max) => {
293
- return Math.floor(Math.random() * (max - min + 1)) + min;
294
- };
295
- const VISIBLE_NODE_TYPES = {
296
- TEXT_NODE: 'TEXT_NODE',
297
- };
298
- class Typewriter {
299
- constructor(options) {
300
- this.state = {
301
- lastFrameTime: null,
302
- pauseUntil: null,
303
- eventQueue: [],
304
- eventLoop: null,
305
- eventLoopPaused: false,
306
- reverseCalledEvents: [],
307
- calledEvents: [],
308
- visibleNodes: [],
309
- initialOptions: null,
310
- };
311
- this.options = {
312
- strings: null,
313
- delay: 'natural',
314
- pauseFor: 1500,
315
- deleteSpeed: 'natural',
316
- loop: false,
317
- autoStart: false,
318
- stringSplitter: null,
319
- onCreateTextNode: null,
320
- onRemoveNode: null,
321
- };
322
- this.start = () => {
323
- this.state.eventLoopPaused = false;
324
- this.runEventLoop();
325
- return this;
326
- };
327
- this.pause = () => {
328
- this.state.eventLoopPaused = true;
329
- return this;
330
- };
331
- this.stop = () => {
332
- if (this.state.eventLoop) {
333
- window.cancelAnimationFrame(this.state.eventLoop);
334
- this.state.eventLoop = null;
335
- }
336
- return this;
337
- };
338
- this.pauseFor = (ms) => {
339
- this.addEventToQueue(EVENT_NAMES.PAUSE_FOR, { ms });
340
- return this;
341
- };
342
- this.typeOutAllStrings = () => {
343
- if (typeof this.options.strings === 'string') {
344
- this.typeString(this.options.strings).pauseFor(this.options.pauseFor);
345
- return this;
346
- }
347
- this.options.strings.forEach((string) => {
348
- this.typeString(string)
349
- .pauseFor(this.options.pauseFor)
350
- .deleteAll(this.options.deleteSpeed);
351
- });
352
- return this;
353
- };
354
- this.typeString = (string, node = null) => {
355
- if (string) {
356
- const { stringSplitter } = this.options || {};
357
- const characters = typeof stringSplitter === 'function'
358
- ? stringSplitter(string)
359
- : string.split('');
360
- this.typeCharacters(characters, node);
361
- }
362
- return this;
363
- };
364
- this.pasteString = (string, node = null) => {
365
- if (string) {
366
- this.addEventToQueue(EVENT_NAMES.PASTE_STRING, {
367
- character: string,
368
- node,
369
- });
370
- }
371
- return this;
372
- };
373
- this.deleteAll = (speed = 'natural') => {
374
- this.addEventToQueue(EVENT_NAMES.REMOVE_ALL, { speed });
375
- return this;
376
- };
377
- this.changeDeleteSpeed = (speed) => {
378
- if (!speed) {
379
- throw new Error('Must provide new delete speed');
380
- }
381
- this.addEventToQueue(EVENT_NAMES.CHANGE_DELETE_SPEED, { speed });
382
- return this;
383
- };
384
- this.changeDelay = (delay) => {
385
- if (!delay) {
386
- throw new Error('Must provide new delay');
387
- }
388
- this.addEventToQueue(EVENT_NAMES.CHANGE_DELAY, { delay });
389
- return this;
390
- };
391
- this.deleteChars = (amount) => {
392
- if (!amount) {
393
- throw new Error('Must provide amount of characters to delete');
394
- }
395
- for (let i = 0; i < amount; i++) {
396
- this.addEventToQueue(EVENT_NAMES.REMOVE_CHARACTER);
397
- }
398
- return this;
399
- };
400
- this.typeCharacters = (characters, node = null) => {
401
- if (!characters || !Array.isArray(characters)) {
402
- throw new Error('Characters must be an array');
403
- }
404
- characters.forEach((character) => {
405
- this.addEventToQueue(EVENT_NAMES.TYPE_CHARACTER, { character, node });
406
- });
407
- return this;
408
- };
409
- this.removeCharacters = (characters) => {
410
- if (!characters || !Array.isArray(characters)) {
411
- throw new Error('Characters must be an array');
412
- }
413
- characters.forEach(() => {
414
- this.addEventToQueue(EVENT_NAMES.REMOVE_CHARACTER);
415
- });
416
- return this;
417
- };
418
- this.addEventToQueue = (eventName, eventArgs, prepend = false) => {
419
- return this.addEventToStateProperty(eventName, eventArgs, prepend, 'eventQueue');
420
- };
421
- this.addReverseCalledEvent = (eventName, eventArgs, prepend = false) => {
422
- const { loop } = this.options;
423
- if (!loop) {
424
- return this;
425
- }
426
- return this.addEventToStateProperty(eventName, eventArgs, prepend, 'reverseCalledEvents');
427
- };
428
- this.addEventToStateProperty = (eventName, eventArgs, prepend = false, property) => {
429
- const eventItem = {
430
- eventName,
431
- eventArgs: eventArgs || {},
432
- };
433
- if (prepend) {
434
- this.state[property] = [eventItem, ...this.state[property]];
435
- }
436
- else {
437
- this.state[property] = [...this.state[property], eventItem];
438
- }
439
- return this;
440
- };
441
- this.runEventLoop = () => {
442
- if (!this.state.lastFrameTime) {
443
- this.state.lastFrameTime = Date.now();
444
- }
445
- // Setup variables to calculate if this frame should run
446
- const nowTime = Date.now();
447
- const delta = nowTime - this.state.lastFrameTime;
448
- if (!this.state.eventQueue.length) {
449
- if (!this.options.loop) {
450
- return;
451
- }
452
- // Reset event queue if we are looping
453
- this.state.eventQueue = [...this.state.calledEvents];
454
- this.state.calledEvents = [];
455
- this.options = Object.assign({}, this.state.initialOptions);
456
- }
457
- // Request next frame
458
- this.state.eventLoop = window.requestAnimationFrame(this.runEventLoop);
459
- // Check if event loop is paused
460
- if (this.state.eventLoopPaused) {
461
- return;
462
- }
463
- // Check if state has pause until time
464
- if (this.state.pauseUntil) {
465
- // Check if event loop should be paused
466
- if (nowTime < this.state.pauseUntil) {
467
- return;
468
- }
469
- // Reset pause time
470
- this.state.pauseUntil = null;
471
- }
472
- // Make a clone of event queue
473
- const eventQueue = [...this.state.eventQueue];
474
- // Get first event from queue
475
- const currentEvent = eventQueue.shift();
476
- // Setup delay variable
477
- let delay = 0;
478
- // Check if frame should run or be
479
- // skipped based on fps interval
480
- if (currentEvent.eventName === EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE ||
481
- currentEvent.eventName === EVENT_NAMES.REMOVE_CHARACTER) {
482
- delay =
483
- this.options.deleteSpeed === 'natural'
484
- ? getRandomInteger(40, 80)
485
- : this.options.deleteSpeed;
486
- }
487
- else {
488
- delay =
489
- this.options.delay === 'natural'
490
- ? getRandomInteger(120, 160)
491
- : this.options.delay;
492
- }
493
- if (delta <= delay) {
494
- return;
495
- }
496
- // Get current event args
497
- const { eventName, eventArgs } = currentEvent;
498
- // Run item from event loop
499
- switch (eventName) {
500
- case EVENT_NAMES.PASTE_STRING:
501
- case EVENT_NAMES.TYPE_CHARACTER: {
502
- const { character } = eventArgs;
503
- const textNode = document.createTextNode(character);
504
- let textNodeToUse = textNode;
505
- if (this.options.onCreateTextNode &&
506
- typeof this.options.onCreateTextNode === 'function') {
507
- textNodeToUse = this.options.onCreateTextNode(character, textNode);
508
- }
509
- this.state.visibleNodes = [
510
- ...this.state.visibleNodes,
511
- {
512
- type: VISIBLE_NODE_TYPES.TEXT_NODE,
513
- character,
514
- node: textNodeToUse,
515
- },
516
- ];
517
- break;
518
- }
519
- case EVENT_NAMES.REMOVE_CHARACTER: {
520
- eventQueue.unshift({
521
- eventName: EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE,
522
- eventArgs: { removingCharacterNode: true },
523
- });
524
- break;
525
- }
526
- case EVENT_NAMES.PAUSE_FOR: {
527
- const { ms } = currentEvent.eventArgs;
528
- this.state.pauseUntil = Date.now() + parseInt(ms);
529
- break;
530
- }
531
- case EVENT_NAMES.REMOVE_ALL: {
532
- const { visibleNodes } = this.state;
533
- const { speed } = eventArgs;
534
- const removeAllEventItems = [];
535
- if (speed) {
536
- removeAllEventItems.push({
537
- eventName: EVENT_NAMES.CHANGE_DELETE_SPEED,
538
- eventArgs: { speed, temp: true },
539
- });
540
- }
541
- for (let i = 0, length = visibleNodes.length; i < length; i++) {
542
- removeAllEventItems.push({
543
- eventName: EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE,
544
- eventArgs: { removingCharacterNode: false },
545
- });
546
- }
547
- if (speed) {
548
- removeAllEventItems.push({
549
- eventName: EVENT_NAMES.CHANGE_DELETE_SPEED,
550
- eventArgs: { speed: this.options.deleteSpeed, temp: true },
551
- });
552
- }
553
- eventQueue.unshift(...removeAllEventItems);
554
- break;
555
- }
556
- case EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE: {
557
- if (this.state.visibleNodes.length) {
558
- const { node, character } = this.state.visibleNodes.pop();
559
- if (this.options.onRemoveNode &&
560
- typeof this.options.onRemoveNode === 'function') {
561
- this.options.onRemoveNode({
562
- node,
563
- character,
564
- });
565
- }
566
- if (node) {
567
- node.parentNode.removeChild(node);
568
- }
569
- }
570
- break;
571
- }
572
- case EVENT_NAMES.CHANGE_DELETE_SPEED: {
573
- this.options.deleteSpeed = currentEvent.eventArgs.speed;
574
- break;
575
- }
576
- case EVENT_NAMES.CHANGE_DELAY: {
577
- this.options.delay = currentEvent.eventArgs.delay;
578
- break;
579
- }
580
- }
581
- // Add que item to called queue if we are looping
582
- if (this.options.loop) {
583
- if (currentEvent.eventName !== EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE &&
584
- !(currentEvent.eventArgs && currentEvent.eventArgs.temp)) {
585
- this.state.calledEvents = [...this.state.calledEvents, currentEvent];
586
- }
587
- }
588
- // Replace state event queue with cloned queue
589
- this.state.eventQueue = eventQueue;
590
- // Set last frame time so it can be used to calculate next frame
591
- this.state.lastFrameTime = nowTime;
592
- };
593
- if (options) {
594
- this.options = Object.assign(Object.assign({}, this.options), options);
595
- }
596
- this.state.initialOptions = Object.assign({}, this.options);
597
- this.init();
598
- }
599
- init() {
600
- this.addEventToQueue(EVENT_NAMES.REMOVE_ALL, null, true);
601
- if (this.options.autoStart === true && this.options.strings) {
602
- this.typeOutAllStrings().start();
603
- }
604
- }
605
- }
606
-
607
- function useAnimatedPlaceholder({ inputRef, wrapperRef, disabled, }) {
608
- const { t, locale } = useTranslations();
609
- const values = useMemo(() => {
610
- if (disabled) {
611
- return [];
612
- }
613
- const shuffleKeys = [
614
- 'booking.searchBar.placeholder.hospital',
615
- 'booking.searchBar.placeholder.doctor',
616
- ];
617
- if (locale !== 'zh-TW') {
618
- shuffleKeys.push('booking.searchBar.placeholder.specialty', 'booking.searchBar.placeholder.service');
619
- }
620
- return shuffle(shuffleKeys).map((s) => t(s));
621
- }, [t, locale]);
622
- useEffect(() => {
623
- if (disabled) {
624
- return;
625
- }
626
- const input = getInput();
627
- if (input) {
628
- input.placeholder = '';
629
- new Typewriter({
630
- strings: values,
631
- autoStart: true,
632
- loop: true,
633
- delay: 32,
634
- deleteSpeed: 32,
635
- pauseFor: 1500,
636
- onCreateTextNode: customNodeCreator,
637
- onRemoveNode: onRemoveNode,
638
- });
639
- }
640
- }, [inputRef, wrapperRef]);
641
- function customNodeCreator(character) {
642
- const input = getInput();
643
- if (input) {
644
- input.placeholder = input.placeholder + character;
645
- }
646
- return null;
647
- }
648
- function onRemoveNode() {
649
- const input = getInput();
650
- if (input) {
651
- input.placeholder = input.placeholder.slice(0, -1);
652
- }
653
- }
654
- function getInput() {
655
- if (inputRef && inputRef.current) {
656
- return inputRef.current;
657
- }
658
- else if (wrapperRef && wrapperRef.current) {
659
- return wrapperRef.current.querySelector('input') || null;
660
- }
661
- return null;
662
- }
663
- return;
664
- }
665
-
666
- const StyledFakeInputSearchMobile = styled.div `
667
- user-select: none;
668
- input {
669
- pointer-events: none;
670
- background-color: white;
671
- }
672
- `;
673
- function MobileFakeInput({ focused, value = '', onClick, trackingAttributes, inputSearchPlaceholder, }) {
674
- const { t } = useTranslations();
675
- const wrapperRef = useRef(null);
676
- useAnimatedPlaceholder({ wrapperRef, disabled: !!inputSearchPlaceholder });
677
- const gaAttributes = useMemo(() => {
678
- if (trackingAttributes) {
679
- return {
680
- 'data-event-category': trackingAttributes.dataEventCategory,
681
- 'data-event-action': trackingAttributes.dataEventAction,
682
- 'data-event-label': trackingAttributes.dataEventLabel,
683
- };
684
- }
685
- else {
686
- return {};
687
- }
688
- }, [trackingAttributes]);
689
- return (React__default.createElement(StyledFakeInputSearchMobile, Object.assign({ onClick: () => onClick && onClick(), ref: wrapperRef }, gaAttributes),
690
- React__default.createElement(StyledInput, { inputClassName: focused === 'location' ? 'focused' : undefined, name: "booking-search-placeholder", displayIcon: React__default.createElement(MagnifierIcon, { color: theme.colors.gray400 }), placeholder: t('booking.searchBar.searchInput.placeholder'), value: value, size: "md" })));
691
- }
692
-
693
- const StyledTopBar = styled.header `
694
- display: flex;
695
- height: 64px;
696
- align-items: center;
697
- justify-content: space-between;
698
- margin: 0 auto;
699
- position: sticky;
700
- z-index: 99;
701
- background-color: white;
702
- top: 0;
703
- left: 0;
704
- `;
705
- const StyledTopBarHeaderRight = styled.div `
706
- display: inline-flex;
707
- flex: 1;
708
- justify-content: flex-end;
709
- cursor: pointer;
710
- text-decoration: underline;
711
- `;
712
- const StyledTopBarIcon = styled.div `
713
- display: flex;
714
- align-items: center;
715
- margin-left: 16px;
716
- cursor: pointer;
717
- `;
718
- const StyledTopbarHeading = styled.div `
719
- width: 100%;
720
- margin-left: 24px;
721
- `;
722
- const StyledTopbarHeadingText = styled(Text) `
723
- color: ${theme.colors.secondaryDark};
724
- text-align: start;
725
- `;
726
-
727
- const MobileTopBar = ({ className, onLeftClick, headingText, onRightClick, iconLeft, textRight, }) => {
728
- return (React__default.createElement(StyledTopBar, { className: className },
729
- React__default.createElement(StyledTopBarIcon, { onClick: onLeftClick }, iconLeft || React__default.createElement(CloseIcon, { color: theme.colors.gray800 })),
730
- React__default.createElement(StyledTopbarHeading, null,
731
- React__default.createElement(StyledTopbarHeadingText, { size: "md", weight: "bold" }, headingText)),
732
- React__default.createElement(StyledTopBarHeaderRight, { onClick: onRightClick }, textRight && React__default.createElement("p", null, textRight))));
733
- };
734
-
735
- const SEARCH_KEYWORD_MIN_LENGTH$1 = {
736
- 'en-PH': 3,
737
- 'tl-PH': 2,
738
- 'id-ID': 3,
739
- 'vi-VN': 2,
740
- 'zh-TW': 0,
741
- 'ms-MY': 2,
742
- };
743
-
744
- const initialState$1 = {
745
- isMobile: false,
746
- isDebug: false,
747
- navigateTo: null,
748
- geoLocationPermission: 'unset',
749
- geoLocationCoordinates: null,
750
- focused: 'none',
751
- searchLocationKeywords: '',
752
- searchKeywords: '',
753
- selectedLocation: null,
754
- defaultCity: null,
755
- initialCities: [],
756
- cities: [],
757
- searchResults: [],
758
- initialSearchResults: [],
759
- isLoadingCities: false,
760
- isLoadingSearchResults: false,
761
- isMobileModalOpened: false,
762
- initialSelectedCity: null,
763
- autoCompleteDisabled: false,
764
- inputSearchPlaceholder: '',
765
- locale: 'vi-VN',
766
- };
767
- var ActionTypes$1;
768
- (function (ActionTypes) {
769
- ActionTypes["NavigateTo"] = "navigate to url";
770
- ActionTypes["ClickOutsideInputLocation"] = "click outside input location";
771
- ActionTypes["ClickOutsideInputSearch"] = "click outside input search";
772
- ActionTypes["SelectCurrentLocation"] = "select current location";
773
- ActionTypes["FocusInputLocation"] = "focus input location";
774
- ActionTypes["FocusInputSearch"] = "focus input search";
775
- ActionTypes["ChangeInputLocation"] = "change input location";
776
- ActionTypes["ChangeInputSearch"] = "change input search";
777
- ActionTypes["ClearInputLocation"] = "clear input location";
778
- ActionTypes["ClearInputSearch"] = "clear input search";
779
- ActionTypes["SelectLocation"] = "select location";
780
- ActionTypes["FetchCitiesStart"] = "fetch cities start";
781
- ActionTypes["FetchCitiesFinish"] = "fetch cities finish";
782
- ActionTypes["FetchSearchResultsStart"] = "fetch search results start";
783
- ActionTypes["FetchSearchResultsComplete"] = "fetch search results complete";
784
- ActionTypes["FetchSearchResultsFinish"] = "fetch search results finish";
785
- ActionTypes["FetchCitiesByGeoIpComplete"] = "fetch cities by geo IP finish";
786
- ActionTypes["FetchCitiesByKeywordComplete"] = "fetch cities by keyword finish";
787
- ActionTypes["DisplayInitialCities"] = "display initial cities";
788
- ActionTypes["DisplayInitialSearchResults"] = "display initial search results";
789
- ActionTypes["GrantGeoLocationPermission"] = "grant geolocation permission";
790
- ActionTypes["DenyGeoLocationPermission"] = "deny geolocation permission";
791
- ActionTypes["OpenMobileModal"] = "open mobile modal";
792
- ActionTypes["CloseMobileModal"] = "close mobile modal";
793
- ActionTypes["UpdateInitialSearchValue"] = "update initial search value";
794
- ActionTypes["SelectSearchResult"] = "select search result";
795
- ActionTypes["SetInputSearchPlaceholder"] = "set input search placeholder";
796
- })(ActionTypes$1 || (ActionTypes$1 = {}));
797
- function resetSearchLocationKeywords$1(state) {
798
- const { selectedLocation, searchLocationKeywords } = state;
799
- if (selectedLocation && searchLocationKeywords !== selectedLocation.name) {
800
- return Object.assign(Object.assign({}, state), { searchLocationKeywords: selectedLocation.name });
801
- }
802
- return state;
803
- }
804
- function reducer$1(state, action) {
805
- var _a;
806
- if (state.isDebug) {
807
- console.log('bookingSearchBar', { action, state });
808
- }
809
- switch (action.type) {
810
- case ActionTypes$1.NavigateTo:
811
- return Object.assign(Object.assign({}, state), { navigateTo: action.payload, focused: 'none', isMobileModalOpened: false });
812
- case ActionTypes$1.ClickOutsideInputLocation: {
813
- if (state.isMobile || state.focused !== 'location') {
814
- return state;
815
- }
816
- return resetSearchLocationKeywords$1(Object.assign(Object.assign({}, state), { focused: 'none' }));
817
- }
818
- case ActionTypes$1.ClickOutsideInputSearch: {
819
- if (state.isMobile || state.focused !== 'search') {
820
- return state;
821
- }
822
- return Object.assign(Object.assign({}, state), { focused: 'none' });
823
- }
824
- case ActionTypes$1.FocusInputLocation: {
825
- const nextState = Object.assign(Object.assign({}, state), { focused: 'location' });
826
- if (((_a = state.selectedLocation) === null || _a === void 0 ? void 0 : _a.id) === ID_OPTION_CURRENT_LOCATION) {
827
- nextState.searchLocationKeywords = '';
828
- }
829
- return nextState;
830
- }
831
- case ActionTypes$1.FocusInputSearch:
832
- const nextState = Object.assign(Object.assign({}, state), { focused: 'search' });
833
- if (state.isMobile) {
834
- return resetSearchLocationKeywords$1(nextState);
835
- }
836
- return nextState;
837
- case ActionTypes$1.ChangeInputLocation:
838
- return Object.assign(Object.assign({}, state), { searchLocationKeywords: action.payload });
839
- case ActionTypes$1.ChangeInputSearch: {
840
- const keyword = action.payload;
841
- return Object.assign(Object.assign({}, state), { searchKeywords: keyword, isLoadingSearchResults: keyword.trim().length > SEARCH_KEYWORD_MIN_LENGTH$1[state.locale] });
842
- }
843
- case ActionTypes$1.SelectCurrentLocation:
844
- return Object.assign(Object.assign({}, state), { focused: 'none', selectedLocation: action.payload, searchLocationKeywords: action.payload.name });
845
- case ActionTypes$1.ClearInputLocation:
846
- return Object.assign(Object.assign({}, state), { focused: 'location', cities: state.initialCities, searchLocationKeywords: '' });
847
- case ActionTypes$1.ClearInputSearch:
848
- return Object.assign(Object.assign({}, state), { focused: 'search', searchKeywords: '' });
849
- case ActionTypes$1.SelectLocation:
850
- return Object.assign(Object.assign({}, state), { focused: 'none', selectedLocation: action.payload, searchLocationKeywords: action.payload.name });
851
- case ActionTypes$1.SelectSearchResult:
852
- return Object.assign(Object.assign({}, state), { searchKeywords: action.payload.name, isMobileModalOpened: false, focused: 'none', navigateTo: action.payload.url });
853
- case ActionTypes$1.FetchCitiesStart:
854
- return Object.assign(Object.assign({}, state), { isLoadingCities: true });
855
- case ActionTypes$1.FetchCitiesFinish:
856
- return Object.assign(Object.assign({}, state), { isLoadingCities: false });
857
- case ActionTypes$1.FetchSearchResultsStart:
858
- return Object.assign(Object.assign({}, state), { isLoadingSearchResults: true });
859
- case ActionTypes$1.FetchSearchResultsFinish:
860
- return Object.assign(Object.assign({}, state), { isLoadingSearchResults: false });
861
- case ActionTypes$1.FetchSearchResultsComplete: {
862
- const nextState = Object.assign(Object.assign({}, state), { searchResults: action.payload });
863
- if (state.initialSearchResults.length === 0) {
864
- nextState.initialSearchResults = action.payload;
865
- }
866
- return nextState;
867
- }
868
- case ActionTypes$1.FetchCitiesByGeoIpComplete: {
869
- let { cities } = action.payload;
870
- const { default: defaultCity } = action.payload;
871
- cities = cities.filter((c) => c.id !== defaultCity.id);
872
- cities.unshift(defaultCity);
873
- if (state.initialSelectedCity &&
874
- !cities.find((c) => c.id === state.initialSelectedCity.id)) {
875
- cities.unshift(state.initialSelectedCity);
876
- }
877
- const nextState = Object.assign(Object.assign({}, state), { defaultCity, initialCities: cities, cities });
878
- if (state.geoLocationPermission === 'denied' &&
879
- !state.initialSelectedCity) {
880
- nextState.selectedLocation = defaultCity;
881
- nextState.searchLocationKeywords = defaultCity.name;
882
- }
883
- return nextState;
884
- }
885
- case ActionTypes$1.FetchCitiesByKeywordComplete:
886
- return Object.assign(Object.assign({}, state), { cities: action.payload });
887
- case ActionTypes$1.DisplayInitialCities:
888
- return Object.assign(Object.assign({}, state), { cities: state.initialCities });
889
- case ActionTypes$1.DisplayInitialSearchResults:
890
- return Object.assign(Object.assign({}, state), { searchResults: state.initialSearchResults, isLoadingSearchResults: false });
891
- case ActionTypes$1.GrantGeoLocationPermission:
892
- return Object.assign(Object.assign({}, state), { geoLocationPermission: 'granted', geoLocationCoordinates: action.payload });
893
- case ActionTypes$1.DenyGeoLocationPermission:
894
- return Object.assign(Object.assign({}, state), { geoLocationPermission: 'denied', geoLocationCoordinates: null });
895
- case ActionTypes$1.OpenMobileModal:
896
- return Object.assign(Object.assign({}, state), { isMobileModalOpened: true });
897
- case ActionTypes$1.CloseMobileModal:
898
- return Object.assign(Object.assign({}, state), { isMobileModalOpened: false });
899
- case ActionTypes$1.UpdateInitialSearchValue:
900
- return Object.assign(Object.assign({}, state), { searchKeywords: action.payload });
901
- case ActionTypes$1.SetInputSearchPlaceholder:
902
- return Object.assign(Object.assign({}, state), { inputSearchPlaceholder: action.payload });
903
- default:
904
- return state;
905
- }
906
- }
907
-
908
- const StyledSearchBarInputsWrapper = styled.div `
909
- display: flex;
910
- gap: 16px;
911
- ${MediaQueries.mbDown} {
912
- flex-direction: column;
913
- padding: 14px;
914
- background-color: ${theme.colors.primary50};
915
-
916
- input {
917
- filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.04))
918
- drop-shadow(0px 0px 2px rgba(0, 0, 0, 0.06))
919
- drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.04));
920
- }
921
- }
922
-
923
- input {
924
- background-color: white;
925
- }
926
- `;
927
- const StyledInputWrapper = styled.div `
928
- position: relative;
929
- `;
930
- const StyledInputLocationWrapper = styled(StyledInputWrapper) `
931
- flex: 1;
932
- `;
933
- const StyledInputSearchWrapper = styled(StyledInputWrapper) `
934
- flex: 2;
935
- `;
936
- const StyledClearIcon = styled(ClearIcon) `
937
- display: none;
938
- &.shown {
939
- display: block;
940
- }
941
- `;
942
-
943
- const SearchIcon = () => (React__default.createElement("svg", { width: "18", height: "18", viewBox: "0 0 18 18" },
944
- React__default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.97887 8.15493C2.97887 5.29627 5.29627 2.97887 8.15493 2.97887C11.0136 2.97887 13.331 5.29627 13.331 8.15493C13.331 11.0136 11.0136 13.331 8.15493 13.331C5.29627 13.331 2.97887 11.0136 2.97887 8.15493ZM8.15493 1.5C4.47951 1.5 1.5 4.47951 1.5 8.15493C1.5 11.8303 4.47951 14.8099 8.15493 14.8099C9.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" })));
945
- const StyledSearchIcon = styled.button `
946
- min-height: 100%;
947
- border-radius: 6px;
948
- background-color: ${theme.colors.primaryBase};
949
- display: flex;
950
- justify-content: center;
951
- align-items: center;
952
- gap: 11px;
953
- cursor: pointer;
954
- flex: 0.3;
955
-
956
- ${MediaQueries.mbDown} {
957
- --margin: 16px;
958
- min-height: 44px;
959
- margin: var(--margin);
960
- width: calc(100% - var(--margin) * 2);
961
- position: absolute;
962
- bottom: 0;
963
- }
964
-
965
- &:hover {
966
- background-color: ${theme.colors.primaryHover};
967
- }
968
-
969
- &:active {
970
- background-color: ${theme.colors.primaryActive};
971
- }
972
-
973
- &:focus-visible {
974
- outline: 1px solid black;
975
- }
976
- `;
977
- const StyledText$1 = styled(Text) `
978
- font-weight: ${theme.sizes.fwSemiBold};
979
- `;
980
- const SearchButton = ({ onClick }) => {
981
- const { t } = useTranslations();
982
- const title = t('booking.searchBar.searchButton');
983
- return (React__default.createElement(StyledSearchIcon, { onClick: onClick, title: title },
984
- React__default.createElement(SearchIcon, null),
985
- React__default.createElement(StyledText$1, { size: "s3", color: "white" }, title)));
986
- };
987
-
988
- function SearchInputs$1({ isMobile, state, dispatch, debouncedFetchCitiesByKeyword, debouncedFetchSearchResults, focusLocationInput, focusSearchInput, renderLocationResults, renderSearchResults, locationTrackingAttributes, trackingAttributes, onSearch, initalSearchValue, }) {
989
- const inputLocationWrapperRef = useRef(null);
990
- const inputSearchWrapperRef = useRef(null);
991
- const { focused, searchLocationKeywords, geoLocationPermission, selectedLocation, searchKeywords, inputSearchPlaceholder, } = state;
992
- const { t } = useTranslations();
993
- useAnimatedPlaceholder({
994
- wrapperRef: inputSearchWrapperRef,
995
- disabled: !!inputSearchPlaceholder,
996
- });
997
- useOutsideClick(inputLocationWrapperRef, () => {
998
- if (!isMobile) {
999
- dispatch({ type: ActionTypes$1.ClickOutsideInputLocation });
1000
- }
1001
- });
1002
- useOutsideClick(inputSearchWrapperRef, () => {
1003
- if (!isMobile) {
1004
- dispatch({ type: ActionTypes$1.ClickOutsideInputSearch });
1005
- }
1006
- });
1007
- function handleLocationInputClear() {
1008
- dispatch({ type: ActionTypes$1.ClearInputLocation });
1009
- debouncedFetchCitiesByKeyword.cancel();
1010
- focusLocationInput();
1011
- }
1012
- function handleSearchInputClear() {
1013
- dispatch({ type: ActionTypes$1.ClearInputSearch });
1014
- debouncedFetchSearchResults.cancel();
1015
- debouncedFetchSearchResults('', state);
1016
- focusSearchInput();
1017
- }
1018
- const searchInputPinIconColor = useMemo(() => {
1019
- if (geoLocationPermission === 'granted' &&
1020
- (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === ID_OPTION_CURRENT_LOCATION) {
1021
- return theme.colors.primaryBase;
1022
- }
1023
- else {
1024
- return theme.colors.gray400;
1025
- }
1026
- }, [geoLocationPermission, selectedLocation]);
1027
- const handleSearchInputChange = useCallback(function handleSearchInputChange(value) {
1028
- dispatch({ type: ActionTypes$1.ChangeInputSearch, payload: value });
1029
- if (typeof onSearch === 'function') {
1030
- return;
1031
- }
1032
- if (value.trim().length > SEARCH_KEYWORD_MIN_LENGTH$1[state.locale] ||
1033
- initalSearchValue) {
1034
- debouncedFetchSearchResults(value.trim(), state);
1035
- }
1036
- else {
1037
- debouncedFetchSearchResults.cancel();
1038
- dispatch({ type: ActionTypes$1.DisplayInitialSearchResults });
1039
- }
1040
- }, [dispatch, state]);
1041
- const handleSearchLocationInputChange = useCallback(function handleSearchLocationInputChange(value) {
1042
- dispatch({ type: ActionTypes$1.ChangeInputLocation, payload: value });
1043
- if (value.trim().length > SEARCH_KEYWORD_MIN_LENGTH$1[state.locale]) {
1044
- debouncedFetchCitiesByKeyword(value.trim());
1045
- }
1046
- else {
1047
- debouncedFetchCitiesByKeyword.cancel();
1048
- dispatch({ type: ActionTypes$1.DisplayInitialCities });
1049
- }
1050
- }, [debouncedFetchCitiesByKeyword, dispatch]);
1051
- const handleKeyPress = (e) => {
1052
- if (state.autoCompleteDisabled && e.key === 'Enter' && onSearch) {
1053
- onSearch({
1054
- cityId: state.selectedLocation.id,
1055
- keyword: searchKeywords,
1056
- });
1057
- }
1058
- };
1059
- return (React__default.createElement(StyledSearchBarInputsWrapper, null,
1060
- React__default.createElement(StyledInputLocationWrapper, { ref: inputLocationWrapperRef },
1061
- React__default.createElement(StyledInput, { inputClassName: focused === 'location' ? 'focused' : undefined, placeholder: t('booking.searchBar.locationPlaceholder'), autoComplete: "off", name: "search-location", displayIcon: React__default.createElement(PinIcon, { className: "location-pin-icon", color: searchInputPinIconColor }), actionIcon: React__default.createElement(StyledClearIcon, { color: theme.colors.gray300, className: searchLocationKeywords !== '' ? 'shown' : '' }), onActionClick: handleLocationInputClear, value: searchLocationKeywords, onChange: handleSearchLocationInputChange, onFocus: () => dispatch({ type: ActionTypes$1.FocusInputLocation }), size: "md", trackingAttributes: locationTrackingAttributes }),
1062
- !isMobile && renderLocationResults()),
1063
- React__default.createElement(StyledInputSearchWrapper, { ref: inputSearchWrapperRef },
1064
- React__default.createElement(StyledInput, { placeholder: inputSearchPlaceholder ||
1065
- t('booking.searchBar.searchInput.placeholder'), autoComplete: "off", name: "search-results", actionIcon: React__default.createElement(StyledClearIcon, { color: theme.colors.gray300, className: searchKeywords !== '' ? 'shown' : '' }), onActionClick: handleSearchInputClear, value: searchKeywords, onChange: handleSearchInputChange, onFocus: () => dispatch({ type: ActionTypes$1.FocusInputSearch }), inputClassName: focused === 'search' ? 'focused' : undefined, size: "md", trackingAttributes: trackingAttributes, onKeyPress: handleKeyPress, enterKeyHint: state.autoCompleteDisabled ? 'search' : undefined }),
1066
- !isMobile && renderSearchResults()),
1067
- state.autoCompleteDisabled && !state.isMobile && (React__default.createElement(SearchButton, { onClick: () => {
1068
- onSearch({
1069
- cityId: state.selectedLocation.id,
1070
- keyword: searchKeywords,
1071
- });
1072
- } }))));
1073
- }
1074
-
1075
- const DoctorIcon$1 = () => (React__default.createElement("svg", { width: "14", height: "18", viewBox: "0 0 14 18" },
1076
- React__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" })));
1077
- const ServiceIcon$1 = () => (React__default.createElement("svg", { width: "18", height: "18", viewBox: "0 0 18 18" },
1078
- React__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" })));
1079
- const HospitalIcon$1 = () => (React__default.createElement("svg", { width: "16", height: "17", viewBox: "0 0 16 17" },
1080
- React__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" })));
1081
- const SpecialtyIcon$1 = () => (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16" },
1082
- React__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" })));
1083
-
1084
- const StyledTypeHeader = styled.header `
1085
- display: flex;
1086
- justify-content: space-between;
1087
- padding: 12px 24px;
1088
- background-color: ${theme.colors.neutral50};
1089
- box-shadow: inset 0px 1px 0px #e4e8ec;
1090
- `;
1091
- const StyledInfoWrapper = styled.div `
1092
- display: grid;
1093
- flex: 2;
1094
- align-items: center;
1095
- gap: 16px;
1096
- grid-template-columns: 16px 1fr;
1097
- `;
1098
- const StyledTypeName = styled.p `
1099
- color: ${theme.colors.neutral800};
1100
- font-size: 14px;
1101
- font-weight: ${theme.sizes.fwSemiBold};
1102
- letter-spacing: -0.2px;
1103
- line-height: 22px;
1104
- `;
1105
- const StyledSeeMoreButton = styled.button `
1106
- flex: 1;
1107
- cursor: pointer;
1108
- text-align: end;
1109
- `;
1110
- const StyledResultsContainer = styled.section `
1111
- padding: 12px 16px;
1112
- --rowGap: 16px;
1113
- --graphicSize: 32px;
1114
-
1115
- ${MediaQueries.tdUp} {
1116
- --rowGap: 8px;
1117
- }
1118
- `;
1119
- const StyledItemsWrapper = styled.ul `
1120
- --gap: 16px;
1121
- ${MediaQueries.tdUp} {
1122
- --gap: 8px;
1123
- }
1124
-
1125
- display: grid;
1126
- overflow: hidden;
1127
- gap: var(--gap);
1128
- transition: max-height 0.8s ease-out;
1129
-
1130
- ${({ isMore }) => isMore &&
1131
- `
1132
- height: auto;
1133
- max-height: 0;
1134
- margin-top: var(--gap);
1135
- `}
1136
-
1137
- ${({ isShown }) => isShown &&
1138
- `
1139
- max-height: 600px;
1140
- `}
1141
-
1142
- @media (prefers-reduced-motion) {
1143
- transition: none;
1144
- }
1145
-
1146
- ${MediaQueries.tdUp} {
1147
- grid-template-columns: 1fr 1fr;
1148
- }
1149
- `;
1150
- const StyledSeeMore = styled(Text) `
1151
- margin-top: 12px;
1152
- margin-bottom: 8px;
1153
- cursor: pointer;
1154
- text-align: start;
1155
- text-transform: capitalize;
1156
- `;
1157
-
1158
- const StyledResult = styled.li `
1159
- display: flex;
1160
- align-items: center;
1161
- gap: var(--rowGap);
1162
- cursor: pointer;
1163
- &.not-nav {
1164
- cursor: default;
1165
- }
1166
- `;
1167
- const StyledRoundedIconWrapper = styled.div `
1168
- --wrapper-size: var(--graphicSize);
1169
- border-radius: calc(var(--wrapper-size) / 2);
1170
- background-color: var(--neutral50);
1171
- width: var(--wrapper-size);
1172
- height: var(--wrapper-size);
1173
- aspect-ratio: 1/1;
1174
- overflow: hidden;
1175
-
1176
- ${({ type }) => type &&
1177
- type === 'doctors' &&
1178
- `
1179
- border-radius: calc(var(--graphicSize) / 2);
1180
- `}
1181
-
1182
- img {
1183
- width: var(--graphicSize);
1184
- height: var(--graphicSize);
1185
- ${({ type }) => type && type === 'doctors'
1186
- ? `
1187
-
1188
- object-fit: cover;
1189
- `
1190
- : `
1191
- object-fit: contain;
1192
- `}
1193
- }
1194
-
1195
- &:focus-visible {
1196
- outline: 1px solid ${theme.colors.gray600};
1197
- }
1198
- `;
1199
- const StyledText = styled(Text) `
1200
- line-height: 22px;
1201
- letter-spacing: -0.2px;
1202
-
1203
- ${MediaQueries.tdUp} {
1204
- &[data-size='p3'] {
1205
- font-size: 14px;
1206
- }
1207
- }
1208
- `;
1209
- const StyledPictureWrapper = styled.figure `
1210
- max-width: var(--graphicSize);
1211
- min-width: var(--graphicSize);
1212
- `;
1213
- const StyledLocationPin = styled.svg `
1214
- margin: 0 auto;
1215
- display: block;
1216
- `;
1217
- const StyledImageSkeletonWrapper = styled.div `
1218
- display: grid;
1219
- place-items: center;
1220
- `;
1221
-
1222
- const defaultThumbnailByType = {
1223
- doctors: DefaultThumbnailDoctor,
1224
- services: DefaultThumbnailService,
1225
- };
1226
- const ResultSectionItem = ({ type, item, imageUrl, className, onClickItem, }) => {
1227
- const onKeyDown = (e) => {
1228
- if (e.key === 'Enter' || e.key === 'Space') {
1229
- if (onClickItem) {
1230
- onClickItem(item);
1231
- }
1232
- }
1233
- };
1234
- const defaultThumbnail = useMemo(() => {
1235
- const Cmp = defaultThumbnailByType[type] || DefaultThumbnailAny;
1236
- return React__default.createElement(Cmp, { width: 32, height: type === 'services' ? 32 : 24 });
1237
- }, [type]);
1238
- return (React__default.createElement(StyledResult, { onClick: () => onClickItem && onClickItem(item), onKeyDown: onKeyDown, tabIndex: 0, role: "button", className: className },
1239
- React__default.createElement(StyledPictureWrapper, null, type === 'hospitals' ? (React__default.createElement(StyledLocationPin, { width: "12", height: "16", viewBox: "0 0 12 16" },
1240
- React__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.createElement(StyledRoundedIconWrapper, { type: type }, imageUrl ? (React__default.createElement("img", { src: imageUrl, width: 32, height: type === 'services' ? 32 : 24, loading: "lazy" })) : (defaultThumbnail)))),
1241
- React__default.createElement(StyledText, { color: theme.colors.gray800, size: "p3" }, item.name)));
1242
- };
1243
-
1244
- const ResultSection = ({ type, data, state, dispatch, itemsToShow, itemsToShowDesktop, isMobile, isLoading, keyword, isNavResultItem, }) => {
1245
- const [seeMoreOpen, setSeeMoreOpen] = useState(false);
1246
- const { t, locale } = useTranslations();
1247
- const { selectedLocation, searchKeywords } = state;
1248
- const slugs = useMemo(() => LOCALIZED_SLUGS[locale], [locale]);
1249
- const isMalay = locale === 'ms-MY';
1250
- const typeInformation = useMemo(() => {
1251
- return {
1252
- doctors: {
1253
- name: t('booking.searchPopup.doctors'),
1254
- icon: React__default.createElement(DoctorIcon$1, null),
1255
- slug: slugs.DOCTOR,
1256
- },
1257
- services: {
1258
- name: t('booking.searchPopup.services'),
1259
- icon: React__default.createElement(ServiceIcon$1, null),
1260
- slug: slugs.SERVICE,
1261
- },
1262
- hospitals: {
1263
- name: t('booking.searchPopup.hospitals'),
1264
- icon: React__default.createElement(HospitalIcon$1, null),
1265
- slug: slugs.HOSPITAL,
1266
- },
1267
- specialties: {
1268
- name: t('booking.searchPopup.specialties'),
1269
- icon: React__default.createElement(SpecialtyIcon$1, null),
1270
- slug: slugs.SPECIALTIES,
1271
- },
1272
- };
1273
- }, [type, slugs]);
1274
- const typeSlug = useMemo(() => typeInformation[type].slug, [typeInformation]);
1275
- const showItemCount = isMobile ? itemsToShow : itemsToShowDesktop;
1276
- function onClickItem(item) {
1277
- let url = '';
1278
- switch (type) {
1279
- case 'specialties':
1280
- url = `/${selectedLocation.slug}/${typeInformation.doctors.slug}/${item.slug}`;
1281
- break;
1282
- case 'services':
1283
- url = `/${selectedLocation.slug}/${typeSlug}/${item.slug}`;
1284
- break;
1285
- case 'doctors':
1286
- case 'hospitals':
1287
- url = `/${typeSlug}/${item.slug}-${item.id}`;
1288
- break;
1289
- }
1290
- if (url) {
1291
- dispatch({
1292
- type: ActionTypes$1.SelectSearchResult,
1293
- payload: { name: item.name, url },
1294
- });
1295
- }
1296
- }
1297
- function renderItem(item) {
1298
- return (React__default.createElement(ResultSectionItem, { key: item.id, item: item, type: type, imageUrl: item.logo || item.avatar || item.thumbnail, className: !isNavResultItem ? 'not-nav' : '', onClickItem: isNavResultItem && onClickItem }));
1299
- }
1300
- function onSeeAllClick() {
1301
- let url = '';
1302
- switch (type) {
1303
- case 'specialties':
1304
- url = `/${typeSlug}`;
1305
- break;
1306
- case 'services':
1307
- case 'doctors':
1308
- case 'hospitals':
1309
- url = `/${selectedLocation.slug}/${typeSlug}`;
1310
- break;
1311
- }
1312
- if (url) {
1313
- dispatch({ type: ActionTypes$1.NavigateTo, payload: url });
1314
- }
1315
- }
1316
- function onClickSearchByKeyword() {
1317
- const { slug: typeSlug } = typeInformation[type];
1318
- const url = `/${selectedLocation.slug}/${typeSlug}?q=${searchKeywords}`;
1319
- dispatch({ type: ActionTypes$1.NavigateTo, payload: url });
1320
- }
1321
- return (React__default.createElement("section", null,
1322
- React__default.createElement(StyledTypeHeader, null,
1323
- React__default.createElement(StyledInfoWrapper, null,
1324
- typeInformation[type].icon,
1325
- React__default.createElement(StyledTypeName, null, typeInformation[type].name)),
1326
- (keyword.trim().length <= SEARCH_KEYWORD_MIN_LENGTH$1[locale] ||
1327
- isMalay) && (React__default.createElement(StyledSeeMoreButton, { onClick: onSeeAllClick },
1328
- React__default.createElement(Text, { size: "p3", color: theme.colors.primaryBase }, t('booking.searchPopup.seeAll'))))),
1329
- (isLoading || (data && data.length > 0)) && (React__default.createElement(StyledResultsContainer, null,
1330
- React__default.createElement(StyledItemsWrapper, null,
1331
- isLoading &&
1332
- Array(2)
1333
- .fill(undefined)
1334
- .map((_, i) => (React__default.createElement(StyledResult, { key: type + 'loading' + i },
1335
- React__default.createElement(StyledPictureWrapper, null,
1336
- React__default.createElement(StyledImageSkeletonWrapper, null,
1337
- React__default.createElement(Skeleton, { height: 14, width: type === 'hospitals' ? 12 : 32, style: {
1338
- maxWidth: 'var(--graphicSize)',
1339
- minHeight: 'var(--graphicSize)',
1340
- } }))),
1341
- React__default.createElement(Skeleton, { width: 120, height: 24 })))),
1342
- !isLoading &&
1343
- data &&
1344
- data.length > 0 &&
1345
- data.slice(0, showItemCount).map(renderItem)),
1346
- React__default.createElement(StyledItemsWrapper, { isShown: seeMoreOpen, isMore: true }, data.slice(showItemCount, -1).map(renderItem)),
1347
- type === 'specialties' &&
1348
- showItemCount < data.length &&
1349
- !isLoading && (React__default.createElement("button", { onClick: () => setSeeMoreOpen(!seeMoreOpen) },
1350
- React__default.createElement(StyledSeeMore, { size: "p3", color: theme.colors.primaryBase }, seeMoreOpen
1351
- ? t('booking.searchPopup.seeLessSpecialties')
1352
- : t('booking.searchPopup.seeMoreSpecialties')))),
1353
- type !== 'specialties' &&
1354
- (showItemCount < data.length || isMalay) &&
1355
- !isLoading &&
1356
- keyword.trim().length > SEARCH_KEYWORD_MIN_LENGTH$1[locale] && (React__default.createElement("button", { onClick: onClickSearchByKeyword },
1357
- React__default.createElement(StyledSeeMore, { size: "p3", color: theme.colors.primaryBase }, t(`booking.searchPopup.searchIn.${type}`, {
1358
- name: keyword,
1359
- })))))),
1360
- !isLoading && (data === null || data === void 0 ? void 0 : data.length) === 0 && (React__default.createElement(StyledResultsContainer, null,
1361
- React__default.createElement(Text, { size: "sm", color: theme.colors.gray400 }, t('booking.searchBar.noResults'))))));
1362
- };
1363
-
1364
- const StyledSection = styled.section `
1365
- background-color: white;
1366
- border-radius: 4px;
1367
- position: absolute;
1368
- width: 100%;
1369
- z-index: 30;
1370
-
1371
- ${MediaQueries.tdUp} {
1372
- box-shadow: 0px 24px 32px rgba(0, 0, 0, 0.04),
1373
- 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04),
1374
- 0px 0px 1px rgba(0, 0, 0, 0.04);
1375
- }
1376
- `;
1377
- const SearchResults = ({ data, state, dispatch, isMobile, isLoading, keyword, hideResults, isNavResultItem, }) => {
1378
- return (React__default.createElement(StyledSection, null, data &&
1379
- data.map((data) => {
1380
- if (hideResults && hideResults.includes(data.type)) {
1381
- return React__default.createElement(React__default.Fragment, null);
1382
- }
1383
- return (React__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 }));
1384
- })));
1385
- };
1386
-
1387
- const getApiPath = (path, params, locale) => {
1388
- return formatString(path, Object.assign(Object.assign({}, params), { domain: domainLocales[locale || 'en-PH'] }));
1389
- };
1390
-
1391
- function useSearchBarApi$1({ dispatch, careApiDomain, locale = 'vi-VN', }) {
1392
- const fetchCitiesApi = useCallback(function fetchCitiesApi(path, params = {}) {
1393
- const url = `${careApiDomain}${path}`;
1394
- dispatch({ type: ActionTypes$1.FetchCitiesStart });
1395
- return fetch(getApiPath(url, params, locale), { method: 'GET' })
1396
- .then((res) => res.json())
1397
- .then((data) => {
1398
- if (data._status !== 1 || !data._data) {
1399
- console.log('error loading cities', data);
1400
- return Promise.reject(data);
1401
- }
1402
- return data === null || data === void 0 ? void 0 : data._data;
1403
- })
1404
- .finally(() => dispatch({ type: ActionTypes$1.FetchCitiesFinish }));
1405
- }, [locale]);
1406
- const fetchCitiesByLocation = useCallback(function fetchCitiesByLocation({ coordinates }) {
1407
- let params = {};
1408
- const moreParams = {};
1409
- if (coordinates) {
1410
- params = {
1411
- lat: coordinates.lat,
1412
- lng: coordinates.lng,
1413
- };
1414
- }
1415
- if (locale === 'ms-MY') {
1416
- moreParams.noPaging = 1;
1417
- }
1418
- const requests = [
1419
- fetchCitiesApi(PATHS.GET_CITY_BY_IP, Object.assign(Object.assign({}, params), moreParams)),
1420
- ];
1421
- if (locale === 'zh-TW') {
1422
- requests.push(fetchCitiesApi(PATHS.GET_CITIES_LIST, { noPaging: 1 }));
1423
- }
1424
- return Promise.all(requests)
1425
- .then(([data1, data2]) => {
1426
- const data = Object.assign({}, data1);
1427
- if (data2) {
1428
- const citiesIds = data.cities.map((c) => c.id);
1429
- data.cities = data.cities.concat(data2.cities.filter((c) => !citiesIds.includes(c.id)));
1430
- }
1431
- dispatch({
1432
- type: ActionTypes$1.FetchCitiesByGeoIpComplete,
1433
- payload: data,
1434
- });
1435
- })
1436
- .catch((err) => console.error('error loading cities by location', err));
1437
- }, [locale, careApiDomain, dispatch]);
1438
- const fetchCitiesByKeyword = useCallback(function fetchCitiesByKeyword(keyword) {
1439
- return fetchCitiesApi(PATHS.GET_CITIES_LIST, { keyword })
1440
- .then((data) => {
1441
- dispatch({
1442
- type: ActionTypes$1.FetchCitiesByKeywordComplete,
1443
- payload: data.cities,
1444
- });
1445
- })
1446
- .catch((err) => console.error('error loading cities by keyword', err));
1447
- }, [locale, careApiDomain, dispatch]);
1448
- const fetchSearchResults = useCallback(function fetchSearchResults(searchKeywords, state) {
1449
- const url = `${careApiDomain}${PATHS.GET_SEARCH_V2}`;
1450
- dispatch({ type: ActionTypes$1.FetchSearchResultsStart });
1451
- const { defaultCity, selectedLocation, geoLocationCoordinates } = state;
1452
- let cityId = '';
1453
- if (!selectedLocation || !defaultCity) {
1454
- dispatch({ type: ActionTypes$1.FetchSearchResultsFinish });
1455
- return;
1456
- }
1457
- const isCurrentLocationSelected = selectedLocation.id === ID_OPTION_CURRENT_LOCATION;
1458
- if (isCurrentLocationSelected) {
1459
- if (!geoLocationCoordinates) {
1460
- cityId = defaultCity.id;
1461
- }
1462
- }
1463
- else if (selectedLocation.id === ID_OPTION_ALL_LOCATION) {
1464
- cityId = '';
1465
- }
1466
- else {
1467
- cityId = selectedLocation.id;
1468
- }
1469
- const lat = (geoLocationCoordinates === null || geoLocationCoordinates === void 0 ? void 0 : geoLocationCoordinates.lat) || '';
1470
- const lng = (geoLocationCoordinates === null || geoLocationCoordinates === void 0 ? void 0 : geoLocationCoordinates.lng) || '';
1471
- return fetch(getApiPath(url, {
1472
- domain: careApiDomain,
1473
- searchType: 'global',
1474
- keyword: searchKeywords.trim().length > SEARCH_KEYWORD_MIN_LENGTH$1[locale]
1475
- ? searchKeywords.trim()
1476
- : '',
1477
- city: cityId === ID_OPTION_CURRENT_LOCATION ? '' : cityId,
1478
- lat,
1479
- lng,
1480
- }, locale), {
1481
- method: 'GET',
1482
- headers: {
1483
- accept: 'version=2.0.0.0',
1484
- },
1485
- })
1486
- .then((res) => res.json())
1487
- .then((data) => {
1488
- if (data._status !== 1 || !data._data) {
1489
- return Promise.reject(data);
1490
- }
1491
- return data === null || data === void 0 ? void 0 : data._data;
1492
- })
1493
- .then((results) => dispatch({
1494
- type: ActionTypes$1.FetchSearchResultsComplete,
1495
- payload: results,
1496
- }))
1497
- .catch((error) => {
1498
- console.log('error loading search results', { url, error });
1499
- })
1500
- .finally(() => dispatch({ type: ActionTypes$1.FetchSearchResultsFinish }));
1501
- }, [locale, careApiDomain, dispatch]);
1502
- return {
1503
- fetchCitiesByLocation,
1504
- fetchCitiesByKeyword,
1505
- fetchSearchResults,
1506
- };
1507
- }
1508
-
1509
- 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, }) => {
1510
- const { t, locale } = useTranslations();
1511
- const wrapperRef = useRef(null);
1512
- const hiddenInputRef = useRef(null);
1513
- const [viewportHeight, setViewportHeight] = useState(undefined);
1514
- const [isNavResultPage, setIsNavResultPage] = useState(false);
1515
- const { geoLocationPermission: geoLocationPermissionFromHook, geoLocationCoordinates: geoLocationCoordinatesFromHook, requestGeoLocation, } = useGeolocation();
1516
- const [state, dispatch] = useReducer(reducer$1, initialState$1, (s) => (Object.assign(Object.assign({}, s), { isDebug,
1517
- isMobile, geoLocationPermission: geoLocationPermissionFromProps ||
1518
- geoLocationPermissionFromHook ||
1519
- 'unset', geoLocationCoordinates: geoLocationCoordinatesFromProps ||
1520
- geoLocationCoordinatesFromHook ||
1521
- null, searchKeywords: initialSearchValue, initialSelectedCity: initialSelectedCityFromProps || null, selectedLocation: initialSelectedCityFromProps || s.selectedLocation || null, searchLocationKeywords: (initialSelectedCityFromProps === null || initialSelectedCityFromProps === void 0 ? void 0 : initialSelectedCityFromProps.name) || s.searchLocationKeywords, autoCompleteDisabled,
1522
- inputSearchPlaceholder,
1523
- locale })));
1524
- const { navigateTo, focused, isLoadingCities, cities, searchKeywords, geoLocationPermission, selectedLocation, initialSelectedCity, defaultCity, searchResults, isLoadingSearchResults, isMobileModalOpened, inputSearchPlaceholder: inputSearchPlaceholderState, } = state;
1525
- const { fetchCitiesByLocation, fetchCitiesByKeyword, fetchSearchResults } = useSearchBarApi$1({
1526
- dispatch,
1527
- locale,
1528
- careApiDomain,
1529
- });
1530
- const currentLocationCityItem = useMemo(() => {
1531
- var _a;
1532
- return ({
1533
- id: ID_OPTION_CURRENT_LOCATION,
1534
- name: t('booking.searchBar.currentLocation'),
1535
- slug: (_a = LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.CURRENT,
1536
- });
1537
- }, [t, locale]);
1538
- const debouncedFetchCitiesByKeyword = useMemo(() => debounce(fetchCitiesByKeyword, 400), [fetchCitiesByKeyword]);
1539
- const debouncedFetchSearchResults = useMemo(() => debounce(fetchSearchResults, 400), [fetchSearchResults]);
1540
- useEffect(() => {
1541
- if (initialSearchValue !== '' &&
1542
- initialSearchValue !== state.searchKeywords) {
1543
- dispatch({
1544
- type: ActionTypes$1.UpdateInitialSearchValue,
1545
- payload: initialSearchValue,
1546
- });
1547
- }
1548
- }, [initialSearchValue]);
1549
- useEffect(() => {
1550
- if (askForGeolocationPermission &&
1551
- (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === ID_OPTION_CURRENT_LOCATION &&
1552
- geoLocationPermission === 'unset') {
1553
- requestGeoLocation();
1554
- }
1555
- }, [askForGeolocationPermission, selectedLocation, geoLocationPermission]);
1556
- useEffect(() => {
1557
- if (!geoLocationPermissionFromProps &&
1558
- geoLocationPermission !== geoLocationPermissionFromHook) {
1559
- if (geoLocationPermissionFromHook === 'granted' &&
1560
- geoLocationCoordinatesFromHook) {
1561
- dispatch({
1562
- type: ActionTypes$1.GrantGeoLocationPermission,
1563
- payload: geoLocationCoordinatesFromHook,
1564
- });
1565
- }
1566
- else if (geoLocationPermissionFromHook === 'denied') {
1567
- dispatch({ type: ActionTypes$1.DenyGeoLocationPermission });
1568
- }
1569
- }
1570
- }, [
1571
- geoLocationPermission,
1572
- geoLocationPermissionFromHook,
1573
- geoLocationCoordinatesFromHook,
1574
- geoLocationPermissionFromProps,
1575
- ]);
1576
- useEffect(() => {
1577
- if (navigateTo) {
1578
- if (routerPush) {
1579
- routerPush(navigateTo);
1580
- }
1581
- else {
1582
- window.location.href = `${careFrontDomain}${navigateTo}`;
1583
- }
1584
- }
1585
- }, [navigateTo]);
1586
- const selectCurrentLocation = useCallback(function selectCurrentLocation() {
1587
- dispatch({
1588
- type: ActionTypes$1.SelectCurrentLocation,
1589
- payload: currentLocationCityItem,
1590
- });
1591
- }, [t, dispatch]);
1592
- useEffect(() => {
1593
- var _a;
1594
- if (geoLocationPermission !== 'denied' && !initialSelectedCity) {
1595
- dispatch({
1596
- type: ActionTypes$1.SelectLocation,
1597
- payload: {
1598
- name: t('booking.searchBar.allLocations'),
1599
- id: ID_OPTION_ALL_LOCATION,
1600
- slug: (_a = LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.ALL,
1601
- },
1602
- });
1603
- }
1604
- if (onGeoLocationPermissionChange) {
1605
- onGeoLocationPermissionChange(geoLocationPermission, state.geoLocationCoordinates);
1606
- }
1607
- if (isMobile && geoLocationPermission === 'granted' && selectedLocation) {
1608
- dispatch({ type: ActionTypes$1.FocusInputSearch });
1609
- }
1610
- fetchCitiesByLocation({ coordinates: state.geoLocationCoordinates });
1611
- }, [geoLocationPermission]);
1612
- useEffect(() => {
1613
- if (selectedLocation && defaultCity) {
1614
- fetchSearchResults(state.searchKeywords, state);
1615
- }
1616
- }, [selectedLocation, defaultCity]);
1617
- useEffect(() => {
1618
- if (inputSearchPlaceholder !== inputSearchPlaceholderState) {
1619
- dispatch({
1620
- type: ActionTypes$1.SetInputSearchPlaceholder,
1621
- payload: inputSearchPlaceholder,
1622
- });
1623
- }
1624
- }, [inputSearchPlaceholder, inputSearchPlaceholderState]);
1625
- useEffect(() => {
1626
- if (isMobileModalOpened) {
1627
- document.body.classList.add('care-popup-open');
1628
- }
1629
- else {
1630
- document.body.classList.remove('care-popup-open');
1631
- }
1632
- }, [isMobileModalOpened]);
1633
- const handleLocationClick = useCallback(function handleLocationClick(city) {
1634
- if (locale === 'ms-MY') {
1635
- setIsNavResultPage(true);
1636
- }
1637
- dispatch({ type: ActionTypes$1.SelectLocation, payload: city });
1638
- if (locale !== 'ms-MY') {
1639
- focusSearchInput();
1640
- }
1641
- if (onChangeLocation) {
1642
- onChangeLocation(city);
1643
- }
1644
- }, [t, dispatch]);
1645
- function handleCurrentLocationClick() {
1646
- if (locale === 'ms-MY') {
1647
- setIsNavResultPage(true);
1648
- }
1649
- if (isMobile && state.geoLocationPermission !== 'granted') {
1650
- requestGeoLocation();
1651
- }
1652
- else {
1653
- selectCurrentLocation();
1654
- if (locale !== 'ms-MY') {
1655
- focusSearchInput();
1656
- }
1657
- }
1658
- }
1659
- function handleMobileFakeInputClick() {
1660
- var _a;
1661
- return __awaiter(this, void 0, void 0, function* () {
1662
- if (hiddenInputRef.current) {
1663
- hiddenInputRef.current.focus();
1664
- }
1665
- dispatch({ type: ActionTypes$1.OpenMobileModal });
1666
- yield Promise.resolve();
1667
- if (wrapperRef.current) {
1668
- (_a = wrapperRef.current
1669
- .querySelector('input[name="search-location"]')) === null || _a === void 0 ? void 0 : _a.focus();
1670
- }
1671
- });
1672
- }
1673
- function focusLocationInput() {
1674
- var _a;
1675
- if (wrapperRef.current) {
1676
- (_a = wrapperRef.current
1677
- .querySelector('input[name="search-location"]')) === null || _a === void 0 ? void 0 : _a.focus();
1678
- }
1679
- }
1680
- function focusSearchInput() {
1681
- var _a;
1682
- if (wrapperRef.current) {
1683
- (_a = wrapperRef.current
1684
- .querySelector('input[name="search-results"]')) === null || _a === void 0 ? void 0 : _a.focus();
1685
- }
1686
- }
1687
- function handleMobileTopBarClose() {
1688
- dispatch({ type: ActionTypes$1.CloseMobileModal });
1689
- }
1690
- function renderLocationResults() {
1691
- if (focused !== 'location') {
1692
- return null;
1693
- }
1694
- return (React__default.createElement(LocationResults, { isLoading: isLoadingCities, cities: cities, onLocationClick: handleLocationClick, onCurrentLocationClick: handleCurrentLocationClick, isLocationLoading: isLoadingCities, geoLocationPermission: geoLocationPermission, selectedLocation: selectedLocation, isOptionAllLocation: isOptionAllLocation }));
1695
- }
1696
- function renderSearchResults() {
1697
- if (focused !== 'search') {
1698
- return null;
1699
- }
1700
- if (state.autoCompleteDisabled) {
1701
- if (!isMobile) {
1702
- return null;
1703
- }
1704
- return (React__default.createElement(SearchButton, { onClick: () => {
1705
- onSearch({
1706
- cityId: state.selectedLocation.id,
1707
- keyword: searchKeywords,
1708
- });
1709
- handleMobileTopBarClose();
1710
- } }));
1711
- }
1712
- return (React__default.createElement(SearchResults, { data: searchResults, state: state, dispatch: dispatch, isMobile: false, keyword: searchKeywords, isLoading: isLoadingSearchResults, hideResults: hideResults, isNavResultItem: isNavResultItem }));
1713
- }
1714
- function renderSearchInputs() {
1715
- return (React__default.createElement(SearchInputs$1, { 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 }));
1716
- }
1717
- useEffect(() => {
1718
- if (window.visualViewport) {
1719
- const resizeHandler = (evt) => {
1720
- const viewport = evt.target;
1721
- setViewportHeight(viewport === null || viewport === void 0 ? void 0 : viewport.height);
1722
- };
1723
- window.visualViewport.addEventListener('resize', resizeHandler, {
1724
- passive: true,
1725
- });
1726
- return () => {
1727
- window.visualViewport.removeEventListener('resize', resizeHandler);
1728
- };
1729
- }
1730
- }, [setViewportHeight]);
1731
- useEffect(() => {
1732
- // Apply for ms-MY. Navigation to result page after selected location
1733
- if (selectedLocation && isNavResultPage && locale === 'ms-MY') {
1734
- const url = `/${selectedLocation.slug}/hospital`;
1735
- dispatch({ type: ActionTypes$1.NavigateTo, payload: url });
1736
- setIsNavResultPage(false);
1737
- }
1738
- }, [isNavResultPage, locale, selectedLocation]);
1739
- if (isMobile) {
1740
- return (React__default.createElement(React__default.Fragment, null,
1741
- React__default.createElement(Global, { styles: css `
1742
- .care-popup-open {
1743
- overflow: hidden;
1744
- position: fixed;
1745
- &::before {
1746
- content: '';
1747
- inset: 0;
1748
- position: absolute;
1749
- background-color: white;
1750
- min-height: 100vh;
1751
- min-width: 100vw;
1752
- z-index: 2;
1753
- }
1754
- }
1755
- ` }),
1756
- React__default.createElement(StyledHiddenInputMobile, { ref: hiddenInputRef }),
1757
- React__default.createElement(StyledSearchBarMobileWrapper, { id: "booking-search-bar", ref: wrapperRef, "data-is-modal": isMobile && isMobileModalOpened, style: {
1758
- '--mobile-care-searchbar-height': isMobileModalOpened && viewportHeight
1759
- ? `${viewportHeight}px`
1760
- : '100%',
1761
- } }, !isMobileModalOpened ? (React__default.createElement(MobileFakeInput, { onClick: handleMobileFakeInputClick, focused: focused, value: searchKeywords, trackingAttributes: gaTrackingSearchBar, inputSearchPlaceholder: inputSearchPlaceholder })) : (React__default.createElement(React__default.Fragment, null,
1762
- React__default.createElement(StyledSearchBarMobileModalHeader, null,
1763
- React__default.createElement(MobileTopBar, { headingText: t('booking.searchBar.searchButton'), onLeftClick: handleMobileTopBarClose }),
1764
- renderSearchInputs()),
1765
- renderLocationResults(),
1766
- renderSearchResults())))));
1767
- }
1768
- return (React__default.createElement(StyledSearchBarWrapper$1, { id: "booking-search-bar", ref: wrapperRef }, renderSearchInputs()));
1769
- };
1770
-
1771
- const StyledSearchBarWrapper = styled.div ``;
1772
- const StyleWrapperContainer = styled.div `
1773
- background-color: ${theme.colors.neutral50};
1774
- padding-bottom: 1px;
1775
- ${MediaQueries.mbDown} {
1776
- padding: 0 16px 10px;
1777
- }
1778
- `;
1779
- const StyleSearchInputContainer = styled(Container) `
1780
- padding: 0 16px;
1781
-
1782
- ${MediaQueries.mbDown} {
1783
- padding: 0;
1784
- }
1785
- `;
1786
- const StyleSearchContent = styled.div `
1787
- padding: 24px 56px;
1788
- border-radius: 16px;
1789
- background-color: ${theme.colors.white};
1790
- box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.04),
1791
- 0px 0px 2px 0px rgba(0, 0, 0, 0.06), 0px 4px 8px 0px rgba(0, 0, 0, 0.04);
1792
-
1793
- ${MediaQueries.mbDown} {
1794
- padding: 16px 16px;
1795
- border-radius: 0px 0px 12px 12px;
1796
- }
1797
-
1798
- .flex-search-input {
1799
- flex-direction: row;
1800
- ${MediaQueries.mbDown} {
1801
- flex-direction: column;
1802
- }
1803
- }
1804
- `;
1805
-
1806
- const SEARCH_KEYWORD_MIN_LENGTH = {
1807
- 'en-PH': 3,
1808
- 'tl-PH': 2,
1809
- 'id-ID': 3,
1810
- 'vi-VN': 2,
1811
- 'zh-TW': 0,
1812
- 'ms-MY': 2,
1813
- };
1814
-
1815
- const initialState = {
1816
- isMobile: false,
1817
- isDebug: false,
1818
- navigateTo: null,
1819
- geoLocationPermission: 'unset',
1820
- geoLocationCoordinates: null,
1821
- focused: 'none',
1822
- focusedSpecialty: 'none',
1823
- searchLocationKeywords: '',
1824
- searchSpecialtyKeywords: '',
1825
- searchKeywords: '',
1826
- selectedLocation: null,
1827
- selectedSpecialty: null,
1828
- defaultCity: null,
1829
- initialCities: [],
1830
- cities: [],
1831
- searchResults: {},
1832
- initialSearchResults: {},
1833
- isLoadingCities: false,
1834
- isLoadingSearchResults: false,
1835
- isMobileModalOpened: false,
1836
- initialSelectedCity: null,
1837
- autoCompleteDisabled: false,
1838
- inputSearchPlaceholder: '',
1839
- locale: 'vi-VN',
1840
- allSpecialties: [],
1841
- popularKeys: [],
1842
- };
1843
- var ActionTypes;
1844
- (function (ActionTypes) {
1845
- ActionTypes["NavigateTo"] = "navigate to url";
1846
- ActionTypes["ClickOutsideInputLocation"] = "click outside input location";
1847
- ActionTypes["ClickOutsideInputSearch"] = "click outside input search";
1848
- ActionTypes["ClickOutsideInputSearchSpecialty"] = "click outside input search specialty";
1849
- ActionTypes["ClickOutsideInputSpecialty"] = "click outside input specialty";
1850
- ActionTypes["SelectCurrentLocation"] = "select current location";
1851
- ActionTypes["FocusInputLocation"] = "focus input location";
1852
- ActionTypes["FocusInputSearch"] = "focus input search";
1853
- ActionTypes["FocusInputSearchSpecialty"] = "focus input search specialty";
1854
- ActionTypes["ChangeInputLocation"] = "change input location";
1855
- ActionTypes["ChangeInputSearch"] = "change input search";
1856
- ActionTypes["ClearInputLocation"] = "clear input location";
1857
- ActionTypes["ClearInputSearch"] = "clear input search";
1858
- ActionTypes["SelectLocation"] = "select location";
1859
- ActionTypes["SelectSpecialty"] = "select specialty";
1860
- ActionTypes["FetchCitiesStart"] = "fetch cities start";
1861
- ActionTypes["FetchCitiesFinish"] = "fetch cities finish";
1862
- ActionTypes["FetchSearchResultsStart"] = "fetch search results start";
1863
- ActionTypes["FetchSearchResultsComplete"] = "fetch search results complete";
1864
- ActionTypes["FetchSearchResultsFinish"] = "fetch search results finish";
1865
- ActionTypes["FetchCitiesByGeoIpComplete"] = "fetch cities by geo IP finish";
1866
- ActionTypes["FetchCitiesByKeywordComplete"] = "fetch cities by keyword finish";
1867
- ActionTypes["DisplayInitialCities"] = "display initial cities";
1868
- ActionTypes["DisplayInitialSearchResults"] = "display initial search results";
1869
- ActionTypes["UpdateInitialSearchResults"] = "update initial search results";
1870
- ActionTypes["GrantGeoLocationPermission"] = "grant geolocation permission";
1871
- ActionTypes["DenyGeoLocationPermission"] = "deny geolocation permission";
1872
- ActionTypes["OpenMobileModal"] = "open mobile modal";
1873
- ActionTypes["CloseMobileModal"] = "close mobile modal";
1874
- ActionTypes["UpdateInitialSearchValue"] = "update initial search value";
1875
- ActionTypes["SelectSearchResult"] = "select search result";
1876
- ActionTypes["SetInputSearchPlaceholder"] = "set input search placeholder";
1877
- ActionTypes["FocusInputSpecialty"] = "focus input specialty";
1878
- ActionTypes["FetchAllSpecialties"] = "fetch all specialty";
1879
- ActionTypes["FetchPopularKeys"] = "fetch popular key by type";
1880
- })(ActionTypes || (ActionTypes = {}));
1881
- function resetSearchLocationKeywords(state) {
1882
- const { selectedLocation, searchLocationKeywords } = state;
1883
- if (selectedLocation && searchLocationKeywords !== selectedLocation.name) {
1884
- return Object.assign(Object.assign({}, state), { searchLocationKeywords: selectedLocation.name });
1885
- }
1886
- return state;
1887
- }
1888
- function reducer(state, action) {
1889
- var _a, _b;
1890
- if (state.isDebug) {
1891
- console.log('bookingSearchBar', { action, state });
1892
- }
1893
- switch (action.type) {
1894
- case ActionTypes.NavigateTo:
1895
- return Object.assign(Object.assign({}, state), { navigateTo: action.payload, focused: 'none', isMobileModalOpened: false });
1896
- case ActionTypes.ClickOutsideInputLocation: {
1897
- if (state.focused !== 'location') {
1898
- return state;
1899
- }
1900
- return resetSearchLocationKeywords(Object.assign(Object.assign({}, state), { focused: 'none' }));
1901
- }
1902
- case ActionTypes.ClickOutsideInputSpecialty: {
1903
- if (state.focused !== 'specialty') {
1904
- return state;
1905
- }
1906
- return resetSearchLocationKeywords(Object.assign(Object.assign({}, state), { focused: 'none' }));
1907
- }
1908
- case ActionTypes.ClickOutsideInputSearch: {
1909
- if (state.focused !== 'search') {
1910
- return state;
1911
- }
1912
- return Object.assign(Object.assign({}, state), { focused: 'none' });
1913
- }
1914
- case ActionTypes.ClickOutsideInputSearchSpecialty: {
1915
- if (state.focusedSpecialty !== 'search') {
1916
- return state;
1917
- }
1918
- return Object.assign(Object.assign({}, state), { focusedSpecialty: 'none' });
1919
- }
1920
- case ActionTypes.FocusInputLocation: {
1921
- const nextState = Object.assign(Object.assign({}, state), { focused: 'location' });
1922
- if (((_a = state.selectedLocation) === null || _a === void 0 ? void 0 : _a.id) === ID_OPTION_CURRENT_LOCATION) {
1923
- nextState.searchLocationKeywords = '';
1924
- }
1925
- return nextState;
1926
- }
1927
- case ActionTypes.FocusInputSpecialty: {
1928
- const nextState = Object.assign(Object.assign({}, state), { focused: 'specialty' });
1929
- if (((_b = state.selectedLocation) === null || _b === void 0 ? void 0 : _b.id) === ID_OPTION_CURRENT_LOCATION) {
1930
- nextState.searchLocationKeywords = '';
1931
- }
1932
- return nextState;
1933
- }
1934
- case ActionTypes.FocusInputSearch:
1935
- const nextState = Object.assign(Object.assign({}, state), { focused: 'search' });
1936
- if (state.isMobile) {
1937
- return resetSearchLocationKeywords(nextState);
1938
- }
1939
- return nextState;
1940
- case ActionTypes.FocusInputSearchSpecialty: {
1941
- const nextState = Object.assign(Object.assign({}, state), { focusedSpecialty: 'search' });
1942
- return nextState;
1943
- }
1944
- case ActionTypes.ChangeInputLocation:
1945
- return Object.assign(Object.assign({}, state), { searchLocationKeywords: action.payload });
1946
- case ActionTypes.ChangeInputSearch: {
1947
- const keyword = action.payload;
1948
- return Object.assign(Object.assign({}, state), { searchKeywords: keyword, isLoadingSearchResults: keyword.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale] });
1949
- }
1950
- case ActionTypes.SelectCurrentLocation:
1951
- return Object.assign(Object.assign({}, state), { focused: 'none', selectedLocation: action.payload, searchLocationKeywords: action.payload.name });
1952
- case ActionTypes.ClearInputLocation:
1953
- return Object.assign(Object.assign({}, state), { focused: 'location', cities: state.initialCities, searchLocationKeywords: '' });
1954
- case ActionTypes.ClearInputSearch:
1955
- return Object.assign(Object.assign({}, state), { focused: 'search', searchKeywords: '' });
1956
- case ActionTypes.SelectLocation:
1957
- return Object.assign(Object.assign({}, state), { focused: 'none', selectedLocation: action.payload, searchLocationKeywords: action.payload.name });
1958
- case ActionTypes.SelectSpecialty:
1959
- return Object.assign(Object.assign({}, state), { focused: 'none', selectedSpecialty: action.payload });
1960
- case ActionTypes.SelectSearchResult:
1961
- return Object.assign(Object.assign({}, state), { searchKeywords: action.payload.name, isMobileModalOpened: false, focused: 'none', navigateTo: action.payload.url });
1962
- case ActionTypes.FetchCitiesStart:
1963
- return Object.assign(Object.assign({}, state), { isLoadingCities: true });
1964
- case ActionTypes.FetchCitiesFinish:
1965
- return Object.assign(Object.assign({}, state), { isLoadingCities: false });
1966
- case ActionTypes.FetchSearchResultsStart:
1967
- return Object.assign(Object.assign({}, state), { isLoadingSearchResults: true });
1968
- case ActionTypes.FetchSearchResultsFinish:
1969
- return Object.assign(Object.assign({}, state), { isLoadingSearchResults: false });
1970
- case ActionTypes.FetchSearchResultsComplete: {
1971
- const nextState = Object.assign(Object.assign({}, state), { searchResults: Object.assign(Object.assign({}, state.searchResults), { [action.payload.key]: action.payload.searches }) });
1972
- return nextState;
1973
- }
1974
- case ActionTypes.FetchCitiesByGeoIpComplete: {
1975
- let { cities } = action.payload;
1976
- const { default: defaultCity } = action.payload;
1977
- cities = cities.filter((c) => c.id !== defaultCity.id);
1978
- if (defaultCity) {
1979
- cities.unshift(defaultCity);
1980
- }
1981
- if (state.initialSelectedCity &&
1982
- !cities.find((c) => c.id === state.initialSelectedCity.id)) {
1983
- cities.unshift(state.initialSelectedCity);
1984
- }
1985
- const nextState = Object.assign(Object.assign({}, state), { defaultCity, initialCities: cities, cities });
1986
- if (state.geoLocationPermission === 'denied' &&
1987
- !state.initialSelectedCity) {
1988
- nextState.selectedLocation = defaultCity;
1989
- nextState.searchLocationKeywords = defaultCity.name;
1990
- }
1991
- return nextState;
1992
- }
1993
- case ActionTypes.FetchCitiesByKeywordComplete:
1994
- return Object.assign(Object.assign({}, state), { cities: action.payload });
1995
- case ActionTypes.DisplayInitialCities:
1996
- return Object.assign(Object.assign({}, state), { cities: state.initialCities });
1997
- case ActionTypes.DisplayInitialSearchResults:
1998
- return Object.assign(Object.assign({}, state), { searchResults: state.initialSearchResults, isLoadingSearchResults: false });
1999
- case ActionTypes.UpdateInitialSearchResults:
2000
- return Object.assign(Object.assign({}, state), { initialSearchResults: Object.assign(Object.assign({}, state.initialSearchResults), { [action.payload.key]: action.payload.searches }) });
2001
- case ActionTypes.GrantGeoLocationPermission:
2002
- return Object.assign(Object.assign({}, state), { geoLocationPermission: 'granted', geoLocationCoordinates: action.payload });
2003
- case ActionTypes.DenyGeoLocationPermission:
2004
- return Object.assign(Object.assign({}, state), { geoLocationPermission: 'denied', geoLocationCoordinates: null });
2005
- case ActionTypes.OpenMobileModal:
2006
- return Object.assign(Object.assign({}, state), { isMobileModalOpened: true });
2007
- case ActionTypes.CloseMobileModal:
2008
- return Object.assign(Object.assign({}, state), { isMobileModalOpened: false });
2009
- case ActionTypes.UpdateInitialSearchValue:
2010
- return Object.assign(Object.assign({}, state), { searchKeywords: action.payload });
2011
- case ActionTypes.SetInputSearchPlaceholder:
2012
- return Object.assign(Object.assign({}, state), { inputSearchPlaceholder: action.payload });
2013
- case ActionTypes.FetchAllSpecialties:
2014
- return Object.assign(Object.assign({}, state), { allSpecialties: action.payload });
2015
- case ActionTypes.FetchPopularKeys:
2016
- return Object.assign(Object.assign({}, state), { popularKeys: action.payload });
2017
- default:
2018
- return state;
2019
- }
2020
- }
2021
-
2022
- const StyleSearchInputsWrapper = styled.div `
2023
- flex: 1;
2024
- position: relative;
2025
-
2026
- ${MediaQueries.mbDown} {
2027
- width: 100%;
2028
- display: flex;
2029
- flex-direction: column;
2030
- gap: 12px;
2031
- }
2032
- `;
2033
- const StyleResultWrapper$2 = styled.div `
2034
- position: absolute;
2035
- top: calc(100% + 2px);
2036
- width: 100%;
2037
- border-radius: 4px;
2038
- background: ${theme.colors.white};
2039
- box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1);
2040
- z-index: 10;
2041
-
2042
- ${MediaQueries.mbDown} {
2043
- width: calc(100% + 64px);
2044
- left: -32px;
2045
- }
2046
- `;
2047
-
2048
- const StyledSearchResultWrapper = styled.div ``;
2049
- const StyleResultHeader = styled.div `
2050
- display: flex;
2051
- justify-content: space-between;
2052
- align-item: center;
2053
- padding: 9px 14px 9px 22px;
2054
- background: #f7f9fc;
2055
-
2056
- .title {
2057
- color: ${theme.colors.gray800};
2058
- font-size: 14px;
2059
- font-weight: 600;
2060
- line-height: 22px;
2061
- }
2062
-
2063
- .btn-see-all {
2064
- color: ${theme.colors.blue600};
2065
- font-size: 14px;
2066
- line-height: 22px;
2067
- cursor: pointer;
2068
- }
2069
- `;
2070
- const StyleResultBody = styled.div `
2071
- padding: 10px 16px;
2072
- max-height: 400px;
2073
- overflow: auto;
2074
- `;
2075
- const StyleResultItem = styled.div `
2076
- display: flex;
2077
- gap: 12px;
2078
- align-items: center;
2079
- cursor: pointer;
2080
-
2081
- &:hover {
2082
- background-color: ${theme.colors.blue50};
2083
- }
2084
- .image-item {
2085
- flex: 0 0 48px;
2086
- width: 48px;
2087
- height: 48px;
2088
- border-radius: 50%;
2089
-
2090
- img {
2091
- object-fit: contain;
2092
- width: 100%;
2093
- height: 100%;
2094
- border-radius: 50%;
2095
- }
2096
- }
2097
- .infor {
2098
- overflow: hidden;
2099
- padding: 12px 0;
2100
- flex: 1;
2101
- border-bottom: 1px solid ${theme.colors.neutral100};
2102
- .title {
2103
- color: ${theme.colors.gray800};
2104
- font-size: 16px;
2105
- font-weight: 600;
2106
- line-height: 24px;
2107
- }
2108
- .description {
2109
- overflow: hidden;
2110
- color: ${theme.colors.gray600};
2111
- text-overflow: ellipsis;
2112
- white-space: nowrap;
2113
- font-size: 12px;
2114
- line-height: 18px;
2115
- display: flex;
2116
- gap: 8px;
2117
- align-items: center;
2118
- margin-top: 5px;
2119
-
2120
- svg {
2121
- flex: 0 0 16px;
2122
- }
2123
-
2124
- .sub-description {
2125
- overflow: hidden;
2126
- white-space: nowrap;
2127
- text-overflow: ellipsis;
2128
- flex: 1;
2129
- }
2130
- }
2131
- }
2132
-
2133
- &.last-item {
2134
- .infor {
2135
- border-bottom: none;
2136
- }
2137
- }
2138
- `;
2139
- styled.div `
2140
- padding: 0 16px 16px;
2141
-
2142
- .search-detail-btn {
2143
- color: ${theme.colors.blue600};
2144
- font-size: 14px;
2145
- line-height: 22px;
2146
- cursor: pointer;
2147
- }
2148
- `;
2149
-
2150
- const SearchResult = ({ state, type, results, location, isLoading, typeInformation, clientSlug = '', dispatch, }) => {
2151
- const { locale, t } = useTranslations();
2152
- const { selectedLocation } = state;
2153
- const typeSlug = useMemo(() => typeInformation[type].slug, [typeInformation, type]);
2154
- const handleOnClick = (item) => {
2155
- let url = '';
2156
- switch (type) {
2157
- case 'service':
2158
- url = `/${selectedLocation.slug}/${typeSlug}/${item.slug}`;
2159
- break;
2160
- case 'doctor':
2161
- case 'hospital':
2162
- url = `/${typeSlug}/${item.slug}-${item.id}`;
2163
- break;
2164
- }
2165
- if (url) {
2166
- dispatch({
2167
- type: ActionTypes.NavigateTo,
2168
- payload: url,
2169
- });
2170
- }
2171
- };
2172
- const handleSeeAll = () => {
2173
- let url = `/${selectedLocation.slug}/${typeSlug}`;
2174
- const slugClientUrl = MAPPING_CLIENT_WITH_SLUG[locale][clientSlug];
2175
- if (slugClientUrl) {
2176
- url += `/${slugClientUrl}`;
2177
- }
2178
- if ((type === 'doctor' || type === 'hospital') &&
2179
- state.selectedSpecialty.id > 0) {
2180
- url += `?specialtyId=${state.selectedSpecialty.id}`;
2181
- }
2182
- if (url) {
2183
- dispatch({ type: ActionTypes.NavigateTo, payload: url });
2184
- }
2185
- };
2186
- return (React__default.createElement(StyledSearchResultWrapper, null,
2187
- React__default.createElement(StyleResultHeader, null,
2188
- React__default.createElement("div", { className: "title" }, t('booking.searchResult.description', {
2189
- search_type: typeInformation[type].name,
2190
- search_location: location,
2191
- })),
2192
- results.length > 0 && (React__default.createElement("div", { className: "btn-see-all", onClick: handleSeeAll }, t('home.seeAll')))),
2193
- React__default.createElement(StyleResultBody, null,
2194
- isLoading &&
2195
- Array(3)
2196
- .fill(undefined)
2197
- .map((_, i) => (React__default.createElement(StyleResultItem, { key: type + 'loading' + i, className: i === 2 ? 'last-item' : '' },
2198
- React__default.createElement("div", { className: "image-item" },
2199
- React__default.createElement(Skeleton$1, { height: 48, circle: true, mb: "xl", animate: true })),
2200
- React__default.createElement("div", { className: "infor" },
2201
- React__default.createElement("div", { className: "title" },
2202
- React__default.createElement(Skeleton$1, { height: 8, mt: 10, radius: "xl", animate: true })),
2203
- React__default.createElement("div", { className: "description" },
2204
- React__default.createElement("div", { className: "sub-description" },
2205
- React__default.createElement(Skeleton$1, { height: 8, mt: 10, radius: "xl", width: "80%", animate: true }))))))),
2206
- !isLoading && results && results.length > 0 && (React__default.createElement(React__default.Fragment, null, results.map((item, index) => {
2207
- var _a, _b;
2208
- const isLastItem = (results.length > 4 && index === 3) ||
2209
- (results.length <= 4 && index === results.length - 1);
2210
- let subDescription = '';
2211
- if (type === 'hospital') {
2212
- subDescription = (item === null || item === void 0 ? void 0 : item.address) || '';
2213
- }
2214
- if (type === 'doctor') {
2215
- subDescription = ((_a = item === null || item === void 0 ? void 0 : item.specialties) === null || _a === void 0 ? void 0 : _a.join(', ')) || '';
2216
- }
2217
- if (type === 'service') {
2218
- subDescription = ((_b = item === null || item === void 0 ? void 0 : item.hospital_branch) === null || _b === void 0 ? void 0 : _b.name) || '';
2219
- }
2220
- if (index >= 4) {
2221
- return React__default.createElement(React__default.Fragment, null);
2222
- }
2223
- return (React__default.createElement(StyleResultItem, { key: item.id, className: isLastItem ? 'last-item' : '', onClick: () => handleOnClick(item) },
2224
- React__default.createElement("div", { className: "image-item" },
2225
- React__default.createElement("img", { src: item.logo || item.avatar, alt: item.name })),
2226
- React__default.createElement("div", { className: "infor" },
2227
- React__default.createElement("div", { className: "title" }, item.name),
2228
- React__default.createElement("div", { className: "description" },
2229
- typeInformation[type].icon,
2230
- React__default.createElement("div", { className: "sub-description" }, subDescription)))));
2231
- }))),
2232
- !isLoading && (results === null || results === void 0 ? void 0 : results.length) === 0 && (React__default.createElement(Text, { size: "sm", color: theme.colors.gray400 }, t('booking.searchBar.noResults'))))));
2233
- };
2234
-
2235
- const StyleSearchSpecialtyWrapper = styled.div `
2236
- position: relative;
2237
-
2238
- ${MediaQueries.mbDown} {
2239
- width: 100%;
2240
- display: flex;
2241
- flex-direction: column;
2242
- gap: 12px;
2243
- }
2244
- `;
2245
- const StyleResultWrapper$1 = styled.div `
2246
- position: absolute;
2247
- top: calc(100% + 2px);
2248
- width: calc(100% + 100px);
2249
- border-radius: 4px;
2250
- background: ${theme.colors.white};
2251
- box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1);
2252
- z-index: 10;
2253
- max-height: 300px;
2254
- overflow: auto;
2255
-
2256
- ${MediaQueries.mbDown} {
2257
- width: calc(100% + 64px);
2258
- left: -32px;
2259
- }
2260
- `;
2261
- const StyledSpecialtyItem = styled.li `
2262
- position: relative;
2263
- cursor: pointer;
2264
- padding: 12px 18px;
2265
- display: flex;
2266
- align-items: center;
2267
- gap: 14px;
2268
- overflow: hidden;
2269
-
2270
- .image-item {
2271
- display: flex;
2272
- align-items: center;
2273
- width: 40px;
2274
- height: 40px;
2275
-
2276
- img {
2277
- width: 100%;
2278
- object-fit: cover;
2279
- }
2280
-
2281
- svg {
2282
- width: 40px;
2283
- }
2284
- }
2285
-
2286
- ${({ isSelected }) => isSelected &&
2287
- `
2288
- &::after {
2289
- content: ${checkMarkIconUrl};
2290
- top: 50%;
2291
- right: 18px;
2292
- position: absolute;
2293
- transform: translateY(-50%);
2294
- }
2295
- `}
2296
-
2297
- & + li::before {
2298
- content: '';
2299
- position: absolute;
2300
- left: 18px;
2301
- right: 18px;
2302
- top: 0;
2303
- height: 1px;
2304
- background-color: ${theme.colors.neutral100};
2305
- }
2306
-
2307
- &:not([data-is-denied='true']):hover {
2308
- background-color: ${theme.colors.neutral50};
2309
- }
2310
-
2311
- &:last-child:hover {
2312
- border-bottom-right-radius: 6px;
2313
- border-bottom-left-radius: 6px;
2314
- }
2315
-
2316
- &:first-child:hover {
2317
- border-top-right-radius: 6px;
2318
- border-top-left-radius: 6px;
2319
- }
2320
-
2321
- &[data-is-denied='true'] {
2322
- cursor: not-allowed;
2323
- }
2324
- `;
2325
-
2326
- const DoctorIcon = () => (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" },
2327
- React__default.createElement("path", { d: "M8.983 14.333q-1.666 0-2.833-1.166Q4.983 12 4.983 10.333v-.366a3.48 3.48 0 0 1-2.258-1.2 3.57 3.57 0 0 1-.909-2.434V3.1a.58.58 0 0 1 .175-.425.58.58 0 0 1 .425-.175h1.4v-.167a.486.486 0 0 1 .5-.5q.217 0 .36.142a.5.5 0 0 1 .14.358v1.334a.485.485 0 0 1-.5.5.484.484 0 0 1-.5-.5V3.5h-1v2.833q0 1.1.784 1.884Q4.383 9 5.483 9t1.883-.783.784-1.884V3.5h-1v.167a.485.485 0 0 1-.5.5.484.484 0 0 1-.5-.5V2.333a.486.486 0 0 1 .5-.5q.217 0 .358.142a.5.5 0 0 1 .142.358V2.5h1.4a.58.58 0 0 1 .425.175.58.58 0 0 1 .175.425v3.233q0 1.4-.908 2.434a3.5 3.5 0 0 1-2.259 1.2v.366q0 1.25.875 2.126a2.9 2.9 0 0 0 2.125.874q1.25 0 2.125-.874a2.9 2.9 0 0 0 .875-2.126V9.25a1.74 1.74 0 0 1-.858-.609 1.6 1.6 0 0 1-.342-1.008q0-.716.5-1.216t1.2-.5q.716 0 1.217.5.5.5.5 1.216 0 .567-.342 1.008t-.875.609v1.083q0 1.667-1.167 2.834-1.166 1.166-2.833 1.166m3.5-6q.3 0 .509-.208a.67.67 0 0 0 .208-.492q0-.3-.208-.508a.7.7 0 0 0-.509-.208q-.3 0-.5.208a.7.7 0 0 0-.2.508q0 .284.2.492t.5.208", fill: "#595959" })));
2328
- const ServiceIcon = () => (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" },
2329
- React__default.createElement("path", { d: "M6.868 9.265v.974q0 .405.284.69.284.283.69.283t.69-.284.284-.69v-.973h.973q.405 0 .69-.284a.94.94 0 0 0 .284-.689.94.94 0 0 0-.284-.69.94.94 0 0 0-.69-.284h-.973v-.974a.94.94 0 0 0-.284-.69.94.94 0 0 0-.69-.284.94.94 0 0 0-.689.284.94.94 0 0 0-.285.69v.974h-.973a.94.94 0 0 0-.69.283.94.94 0 0 0-.284.69q0 .405.284.69.285.284.69.284zm-3.46 4.868q-.581 0-.994-.413A1.36 1.36 0 0 1 2 12.725v-6.65a1.4 1.4 0 0 1 .563-1.127l4.434-3.333q.369-.282.844-.282.474 0 .846.282l4.434 3.333q.264.193.413.493.15.3.15.633v6.651q0 .58-.414.995a1.36 1.36 0 0 1-.994.413zm0-1.168h8.868q.105 0 .172-.068a.23.23 0 0 0 .068-.172v-6.65a.2.2 0 0 0-.027-.11.3.3 0 0 0-.07-.085L7.983 2.554a.2.2 0 0 0-.142-.052.2.2 0 0 0-.142.052L3.266 5.88a.3.3 0 0 0-.071.086.2.2 0 0 0-.027.108v6.651q0 .105.068.172a.23.23 0 0 0 .172.068", fill: "#595959" })));
2330
- const HospitalIcon = () => (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" },
2331
- React__default.createElement("path", { d: "M8 8q.55 0 .941-.392.393-.391.392-.941 0-.55-.392-.942A1.28 1.28 0 0 0 8 5.333q-.55 0-.942.392a1.28 1.28 0 0 0-.391.942q0 .55.391.941Q7.45 8 8 8m0 4.9q2.032-1.866 3.017-3.392Q12 7.983 12 6.8q0-1.817-1.158-2.975Q9.682 2.667 8 2.667T5.158 3.825Q4 4.983 4 6.8q0 1.184.983 2.708Q5.966 11.034 8 12.9m0 1.517a.8.8 0 0 1-.5-.183q-2.433-2.151-3.633-3.992T2.667 6.8q0-2.5 1.608-3.983Q5.883 1.332 8 1.333q2.116 0 3.725 1.484T13.333 6.8q0 1.6-1.2 3.442-1.2 1.841-3.633 3.991a.8.8 0 0 1-.5.184", fill: "#8C8C8C" })));
2332
- const SpecialtyIcon = () => (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16" },
2333
- React__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" })));
2334
-
2335
- const SearchSpecialty = ({ state, isMobile, debouncedFetchSearchResults, selectedLocation, onSpecialtyClick, dispatch, }) => {
2336
- var _a;
2337
- const { t, locale } = useTranslations();
2338
- const inputSpecialtyWrapperRef = useRef(null);
2339
- const slugs = useMemo(() => LOCALIZED_SLUGS[locale], [locale]);
2340
- const styleSpecialties = useMemo(() => {
2341
- return {
2342
- wrapper: {
2343
- '&:after': {
2344
- content: '""',
2345
- width: '1px',
2346
- height: '20px',
2347
- backgroundColor: '#E4E8EC',
2348
- position: 'absolute',
2349
- right: 0,
2350
- top: '13px',
2351
- },
2352
- },
2353
- input: {
2354
- border: isMobile ? 'border: 1px solid #d9d9d9' : 'none',
2355
- height: isMobile ? '40px' : '46px !important',
2356
- paddingRight: '30px',
2357
- '&:focus': {
2358
- boxShadow: isMobile ? 'box-shadow: 0px 0px 0px 2px #91caff' : 'none',
2359
- },
2360
- },
2361
- rightSection: {
2362
- width: '30px',
2363
- svg: {
2364
- fontSize: '20px',
2365
- },
2366
- },
2367
- };
2368
- }, [isMobile]);
2369
- const handleSearchSpecialtyInputChange = useCallback(function handleSearchSpecialtyInputChange(value) {
2370
- // dispatch({ type: ActionTypes.ChangeInputLocation, payload: value })
2371
- // if (value.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale]) {
2372
- // debouncedFetchSearchResults(value.trim())
2373
- // } else {
2374
- // debouncedFetchSearchResults.cancel()
2375
- // dispatch({ type: ActionTypes.DisplayInitialCities })
2376
- // }
2377
- console.log(value);
2378
- }, [debouncedFetchSearchResults, dispatch]);
2379
- useOutsideClick(inputSpecialtyWrapperRef, () => {
2380
- dispatch({ type: ActionTypes.ClickOutsideInputSpecialty });
2381
- });
2382
- return (React__default.createElement(StyleSearchSpecialtyWrapper, { ref: inputSpecialtyWrapperRef },
2383
- React__default.createElement(Input$1.Wrapper, null,
2384
- React__default.createElement(Input$1, { size: isMobile ? 'md' : 'lg', placeholder: t('booking.searchPopup.specialties'), value: ((_a = state === null || state === void 0 ? void 0 : state.selectedSpecialty) === null || _a === void 0 ? void 0 : _a.name) || '', rightSection: React__default.createElement(ChevronDown, null), styles: styleSpecialties, onFocus: () => dispatch({ type: ActionTypes.FocusInputSpecialty }), onChange: (event) => {
2385
- handleSearchSpecialtyInputChange(event.target.value);
2386
- } })),
2387
- state.focused === 'specialty' && (React__default.createElement(StyleResultWrapper$1, null,
2388
- React__default.createElement(StyledSpecialtyItem, { key: "all-location", role: "button", tabIndex: 0, onClick: () => {
2389
- if (onSpecialtyClick) {
2390
- onSpecialtyClick({
2391
- name: t('booking.searchBar.allSpecialties'),
2392
- id: -1,
2393
- thumbnail: '',
2394
- total_doctor: 0,
2395
- slug: slugs.SPECIALTIES,
2396
- });
2397
- }
2398
- } },
2399
- React__default.createElement("div", { className: "image-item" },
2400
- React__default.createElement(SpecialtyIcon, null)),
2401
- React__default.createElement(Text, { size: "md" }, t('booking.searchBar.allSpecialties'))),
2402
- state.allSpecialties.map((specialty) => (React__default.createElement(StyledSpecialtyItem, { key: specialty.id, onClick: (evt) => {
2403
- evt.nativeEvent.stopImmediatePropagation();
2404
- if (onSpecialtyClick) {
2405
- onSpecialtyClick(Object.assign(Object.assign({}, specialty), { total_doctor: 0 }));
2406
- }
2407
- }, role: "button", tabIndex: 0, "aria-label": `Select ${specialty.name} as location`, isSelected: (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === specialty.id },
2408
- React__default.createElement("div", { className: "image-item" },
2409
- React__default.createElement("img", { src: specialty.thumbnail, alt: specialty.name })),
2410
- React__default.createElement(Text, { size: "md" }, specialty.name))))))));
2411
- };
2412
-
2413
- const SearchInputs = ({ state, type, isMobile, isLoading, initalSearchValue, typeInformation, debouncedFetchSearchResults, trackingAttributes, hideSpecialtySelection = false, clientSlug = '', focusSearchInput, onSearch, onEnterSearch, dispatch, }) => {
2414
- var _a;
2415
- const { t } = useTranslations();
2416
- const inputSearchWrapperRef = useRef(null);
2417
- const gaAttributes = useMemo(() => {
2418
- if (trackingAttributes) {
2419
- return {
2420
- 'data-event-category': trackingAttributes.dataEventCategory,
2421
- 'data-event-action': trackingAttributes.dataEventAction,
2422
- 'data-event-label': trackingAttributes.dataEventLabel,
2423
- };
2424
- }
2425
- else {
2426
- return {};
2427
- }
2428
- }, [trackingAttributes]);
2429
- const placeholderSearch = useMemo(() => {
2430
- if (type === 'doctor') {
2431
- return t('booking.searchBar.placeholder.doctor');
2432
- }
2433
- if (type === 'service') {
2434
- return t('booking.searchBar.placeholder.service');
2435
- }
2436
- if (type === 'hospital') {
2437
- return t('booking.searchBar.placeholder.hospital');
2438
- }
2439
- if (type === 'specialty') {
2440
- return t('booking.searchBar.placeholder.specialty');
2441
- }
2442
- return '';
2443
- }, [type]);
2444
- const styleInputWrapper = useMemo(() => {
2445
- return {
2446
- root: {
2447
- flex: 1,
2448
- '&.hide-specialty-selection': {
2449
- '.mantine-Input-rightSection': {
2450
- display: 'none',
2451
- },
2452
- input: {
2453
- paddingLeft: '48px',
2454
- },
2455
- '.mantine-Input-icon': {
2456
- left: '0',
2457
- },
2458
- },
2459
- },
2460
- };
2461
- }, []);
2462
- const styleInput = useMemo(() => {
2463
- return {
2464
- icon: {
2465
- left: '165px',
2466
- },
2467
- input: {
2468
- color: '#262626',
2469
- '&[data-with-icon="true"]': {
2470
- paddingLeft: '205px',
2471
- paddingRight: '16px',
2472
- },
2473
- },
2474
- rightSection: {
2475
- left: 0,
2476
- width: '165px',
2477
- padding: '1px',
2478
- },
2479
- };
2480
- }, []);
2481
- const styleInputSpecialties = useMemo(() => {
2482
- return {
2483
- input: {
2484
- color: '#262626',
2485
- },
2486
- };
2487
- }, []);
2488
- useOutsideClick(inputSearchWrapperRef, () => {
2489
- dispatch({ type: ActionTypes.ClickOutsideInputSearch });
2490
- });
2491
- const handleSearchInputChange = useCallback(function handleSearchInputChange(value) {
2492
- dispatch({ type: ActionTypes.ChangeInputSearch, payload: value });
2493
- if (typeof onSearch === 'function') {
2494
- return;
2495
- }
2496
- if (value.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale] ||
2497
- initalSearchValue ||
2498
- value.trim().length === 0) {
2499
- debouncedFetchSearchResults(value.trim(), state, type, clientSlug);
2500
- }
2501
- else {
2502
- debouncedFetchSearchResults.cancel();
2503
- dispatch({ type: ActionTypes.DisplayInitialSearchResults });
2504
- }
2505
- }, [dispatch, state, type]);
2506
- const handleSpecialtyClick = useCallback(function handleSpecialtyClick(specialty) {
2507
- dispatch({ type: ActionTypes.SelectSpecialty, payload: specialty });
2508
- focusSearchInput();
2509
- }, [dispatch]);
2510
- const inputOnKeyDown = useCallback((e) => {
2511
- if (e.keyCode === 13) {
2512
- e.stopPropagation();
2513
- e.preventDefault();
2514
- onEnterSearch && onEnterSearch();
2515
- }
2516
- }, [onEnterSearch]);
2517
- return (React__default.createElement(StyleSearchInputsWrapper, { ref: inputSearchWrapperRef }, type === 'specialty' ? (React__default.createElement(Input$1.Wrapper, { styles: styleInputWrapper },
2518
- React__default.createElement(Input$1, { icon: React__default.createElement(Search, null), size: isMobile ? 'md' : 'lg', placeholder: placeholderSearch, styles: styleInputSpecialties, value: state.searchKeywords, onFocus: () => dispatch({ type: ActionTypes.FocusInputSearchSpecialty }), onChange: (event) => {
2519
- handleSearchInputChange(event.target.value);
2520
- }, onKeyDown: inputOnKeyDown }))) : (React__default.createElement(React__default.Fragment, null,
2521
- type === 'service' ? (React__default.createElement(Input$1.Wrapper, { styles: styleInputWrapper },
2522
- React__default.createElement(Input$1, { icon: React__default.createElement(Search, null), size: isMobile ? 'md' : 'lg', name: "search-results", placeholder: placeholderSearch, onFocus: () => dispatch({ type: ActionTypes.FocusInputSearch }), value: state.searchKeywords, onChange: (event) => {
2523
- handleSearchInputChange(event.target.value);
2524
- }, onKeyDown: inputOnKeyDown }))) : (React__default.createElement(React__default.Fragment, null, isMobile && !hideSpecialtySelection ? (React__default.createElement(React__default.Fragment, null,
2525
- React__default.createElement(SearchSpecialty, { state: state, isMobile: isMobile, dispatch: dispatch, debouncedFetchSearchResults: debouncedFetchSearchResults, onSpecialtyClick: handleSpecialtyClick }),
2526
- React__default.createElement(Input$1.Wrapper, { styles: styleInputWrapper },
2527
- React__default.createElement(Input$1, { icon: React__default.createElement(Search, null), size: "md", placeholder: placeholderSearch, value: state.searchKeywords, name: "search-results", onFocus: () => dispatch({ type: ActionTypes.FocusInputSearch }), onChange: (event) => {
2528
- handleSearchInputChange(event.target.value);
2529
- }, onKeyDown: inputOnKeyDown })))) : (React__default.createElement(Input$1.Wrapper, { styles: styleInputWrapper, className: hideSpecialtySelection ? 'hide-specialty-selection' : '' },
2530
- React__default.createElement(Input$1, Object.assign({ icon: React__default.createElement(Search, null), size: "lg", placeholder: placeholderSearch, styles: styleInput, name: "search-results", autoComplete: "off", value: state.searchKeywords, onChange: (event) => {
2531
- handleSearchInputChange(event.target.value);
2532
- }, onFocus: () => dispatch({ type: ActionTypes.FocusInputSearch }), onKeyDown: inputOnKeyDown }, gaAttributes, { rightSection: hideSpecialtySelection ? (React__default.createElement(React__default.Fragment, null)) : (React__default.createElement(SearchSpecialty, { state: state, isMobile: isMobile, dispatch: dispatch, debouncedFetchSearchResults: debouncedFetchSearchResults, onSpecialtyClick: handleSpecialtyClick })) })))))),
2533
- state.focused === 'search' && (React__default.createElement(StyleResultWrapper$2, null,
2534
- React__default.createElement(SearchResult, { type: type, state: state, results: ((_a = state.searchResults) === null || _a === void 0 ? void 0 : _a[type]) || [], location: state.selectedLocation.name, dispatch: dispatch, isLoading: isLoading, typeInformation: typeInformation, clientSlug: clientSlug })))))));
2535
- };
2536
-
2537
- const StyleSearchLocationWrapper = styled.div `
2538
- position: relative;
2539
-
2540
- ${MediaQueries.mbDown} {
2541
- width: 100%;
2542
- display: flex;
2543
- flex-direction: column;
2544
- gap: 12px;
2545
- }
2546
- `;
2547
- const StyleResultWrapper = styled.div `
2548
- position: absolute;
2549
- top: calc(100% + 2px);
2550
- width: 100%;
2551
- border-radius: 4px;
2552
- background: ${theme.colors.white};
2553
- box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1);
2554
- z-index: 10;
2555
-
2556
- ${MediaQueries.mbDown} {
2557
- width: calc(100% + 64px);
2558
- left: -32px;
2559
- }
2560
- `;
2561
- const StyledLocationItem = styled.li `
2562
- position: relative;
2563
- cursor: pointer;
2564
- padding: 12px 18px;
2565
- display: flex;
2566
- align-items: center;
2567
- gap: 14px;
2568
- overflow: hidden;
2569
-
2570
- ${({ isSelected }) => isSelected &&
2571
- `
2572
- &::after {
2573
- content: ${checkMarkIconUrl};
2574
- top: 50%;
2575
- right: 18px;
2576
- position: absolute;
2577
- transform: translateY(-50%);
2578
- }
2579
- `}
2580
-
2581
- & + li::before {
2582
- content: '';
2583
- position: absolute;
2584
- left: 18px;
2585
- right: 18px;
2586
- top: 0;
2587
- height: 1px;
2588
- background-color: ${theme.colors.neutral100};
2589
- }
2590
-
2591
- &:not([data-is-denied='true']):hover {
2592
- background-color: ${theme.colors.neutral50};
2593
- }
2594
-
2595
- &:last-child:hover {
2596
- border-bottom-right-radius: 6px;
2597
- border-bottom-left-radius: 6px;
2598
- }
2599
-
2600
- &:first-child:hover {
2601
- border-top-right-radius: 6px;
2602
- border-top-left-radius: 6px;
2603
- }
2604
-
2605
- &[data-is-denied='true'] {
2606
- cursor: not-allowed;
2607
- }
2608
- `;
2609
- const StyledPinIcon = styled(PinIcon) `
2610
- width: 12px;
2611
- height: 18px;
2612
- flex: 0 0 12px;
2613
- `;
2614
-
2615
- const SearchLocation = ({ state, isMobile, debouncedFetchCitiesByKeyword, selectedLocation, trackingAttributes, onLocationClick, dispatch, }) => {
2616
- const { t, locale } = useTranslations();
2617
- const inputLocationWrapperRef = useRef(null);
2618
- const gaAttributes = useMemo(() => {
2619
- if (trackingAttributes) {
2620
- return {
2621
- 'data-event-category': trackingAttributes.dataEventCategory,
2622
- 'data-event-action': trackingAttributes.dataEventAction,
2623
- 'data-event-label': trackingAttributes.dataEventLabel,
2624
- };
2625
- }
2626
- else {
2627
- return {};
2628
- }
2629
- }, [trackingAttributes]);
2630
- const handleSearchLocationInputChange = useCallback(function handleSearchLocationInputChange(value) {
2631
- dispatch({ type: ActionTypes.ChangeInputLocation, payload: value });
2632
- if (value.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale]) {
2633
- debouncedFetchCitiesByKeyword(value.trim());
2634
- }
2635
- else {
2636
- debouncedFetchCitiesByKeyword.cancel();
2637
- dispatch({ type: ActionTypes.DisplayInitialCities });
2638
- }
2639
- }, [debouncedFetchCitiesByKeyword, dispatch]);
2640
- useOutsideClick(inputLocationWrapperRef, () => {
2641
- dispatch({ type: ActionTypes.ClickOutsideInputLocation });
2642
- });
2643
- return (React__default.createElement(StyleSearchLocationWrapper, { ref: inputLocationWrapperRef },
2644
- React__default.createElement(Input$1.Wrapper, null,
2645
- React__default.createElement(Input$1, Object.assign({ size: isMobile ? 'md' : 'lg', placeholder: "Search location", value: state.searchLocationKeywords, onFocus: () => dispatch({ type: ActionTypes.FocusInputLocation }), onChange: (event) => {
2646
- handleSearchLocationInputChange(event.target.value);
2647
- } }, gaAttributes))),
2648
- state.focused === 'location' && (React__default.createElement(StyleResultWrapper, null,
2649
- React__default.createElement(StyledLocationItem, { key: "all-location", role: "button", tabIndex: 0, onClick: () => {
2650
- var _a;
2651
- if (onLocationClick) {
2652
- onLocationClick({
2653
- name: t('booking.searchBar.allLocations'),
2654
- id: ID_OPTION_ALL_LOCATION,
2655
- slug: (_a = LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.ALL,
2656
- });
2657
- }
2658
- } },
2659
- React__default.createElement(StyledPinIcon, { color: theme.colors.neutral400 }),
2660
- React__default.createElement(Text, { size: "md" }, t('booking.searchBar.allLocations'))),
2661
- state.cities.map((city) => (React__default.createElement(StyledLocationItem, { key: city.id, onClick: (evt) => {
2662
- evt.nativeEvent.stopImmediatePropagation();
2663
- if (onLocationClick) {
2664
- onLocationClick(city);
2665
- }
2666
- }, role: "button", tabIndex: 0, "aria-label": `Select ${city.name} as location`, isSelected: (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === city.id },
2667
- React__default.createElement(StyledPinIcon, { color: theme.colors.neutral400 }),
2668
- React__default.createElement(Text, { size: "md" }, city.name))))))));
2669
- };
2670
-
2671
- const StyleSpecialtiesWrapper = styled.div `
2672
- display: flex;
2673
- flex-wrap: wrap;
2674
- row-gap: 8px;
2675
- column-gap: 20px;
2676
- ${MediaQueries.mbDown} {
2677
- margin-top: 12px;
2678
- }
2679
- `;
2680
- const StyleSpecialtyItem = styled.div `
2681
- display: flex;
2682
- align-items: center;
2683
- border-radius: 8px;
2684
- border: 1px solid ${theme.colors.neutral100};
2685
- background: ${theme.colors.white};
2686
- padding: 8px 12px 8px 8px;
2687
- flex: 0 0 calc(33.3% - 13px);
2688
- gap: 12px;
2689
- cursor: pointer;
2690
-
2691
- &:hover {
2692
- background: ${theme.colors.blue50};
2693
- }
2694
-
2695
- ${MediaQueries.tdDown} {
2696
- flex: 0 0 calc(50% - 10px);
2697
- }
2698
-
2699
- ${MediaQueries.mbDown} {
2700
- flex: 0 0 100%;
2701
- border: none;
2702
- }
2703
-
2704
- .image-item {
2705
- display: flex;
2706
- align-items: center;
2707
- width: 40px;
2708
- height: 40px;
2709
-
2710
- img {
2711
- width: 100%;
2712
- object-fit: cover;
2713
- }
2714
- }
2715
-
2716
- .infor {
2717
- flex: 1;
2718
- .title {
2719
- color: ${theme.colors.gray800};
2720
- font-size: 14px;
2721
- font-style: normal;
2722
- font-weight: 400;
2723
- line-height: 22px;
2724
- }
2725
-
2726
- .description {
2727
- color: ${theme.colors.gray600};
2728
- font-size: 12px;
2729
- font-weight: 400;
2730
- line-height: 18px;
2731
- }
2732
- }
2733
- `;
2734
- const StyleDivider = styled(Divider) `
2735
- margin: 24px 0 !important;
2736
- `;
2737
- const StyleShowMore = styled.div `
2738
- display: flex;
2739
- justify-content: center;
2740
- margin-top: 24px;
2741
- .show-more {
2742
- border-radius: 4px;
2743
- border: 1px solid ${theme.colors.neutral200};
2744
- padding: 12px 16px;
2745
- cursor: pointer;
2746
- display: inline-block;
2747
- color: ${theme.colors.gray800};
2748
- font-size: 16px;
2749
- font-weight: 600;
2750
- line-height: 24px;
2751
-
2752
- ${MediaQueries.mbDown} {
2753
- width: 100%;
2754
- text-align: center;
2755
- }
2756
- }
2757
- `;
2758
-
2759
- const SearchResultSpecialties = ({ state, isMobile, specialties, isLoading, dispatch, }) => {
2760
- const { t, locale } = useTranslations();
2761
- const { selectedLocation } = state;
2762
- const slugs = useMemo(() => LOCALIZED_SLUGS[locale], [locale]);
2763
- const handleOnClick = (specialtySlug) => {
2764
- let url = '';
2765
- if (specialtySlug === SLUG_VACIN_ID) {
2766
- url = `/${selectedLocation.slug}/${slugs.HOSPITAL}/${CLIENT_KEY.GSK}/`;
2767
- dispatch({ type: ActionTypes.ClickOutsideInputSearchSpecialty });
2768
- }
2769
- else {
2770
- url = `/${selectedLocation.slug}/${slugs.DOCTOR}/${specialtySlug}`;
2771
- }
2772
- dispatch({ type: ActionTypes.NavigateTo, payload: url });
2773
- };
2774
- const handleShowMore = () => {
2775
- const url = `/${slugs.SPECIALTIES}`;
2776
- dispatch({ type: ActionTypes.NavigateTo, payload: url });
2777
- };
2778
- const showSeeMore = useMemo(() => {
2779
- return (specialties.length >= 9 ||
2780
- state.searchKeywords.trim().length <=
2781
- SEARCH_KEYWORD_MIN_LENGTH[state.locale]);
2782
- }, [state.searchKeywords, specialties]);
2783
- return (React__default.createElement(React__default.Fragment, null,
2784
- !isMobile && React__default.createElement(StyleDivider, { color: "#E4E8EC" }),
2785
- React__default.createElement(StyleSpecialtiesWrapper, null,
2786
- specialties.length > 0 && !isLoading && (React__default.createElement(React__default.Fragment, null, specialties.map((specialty, index) => {
2787
- if (index >= 9) {
2788
- return React__default.createElement(React__default.Fragment, null);
2789
- }
2790
- return (React__default.createElement(StyleSpecialtyItem, { key: specialty.id, onClick: () => handleOnClick(specialty.slug) },
2791
- React__default.createElement("div", { className: "image-item" },
2792
- React__default.createElement("img", { src: specialty.thumbnail, alt: specialty.name })),
2793
- React__default.createElement("div", { className: "infor" },
2794
- React__default.createElement("div", { className: "title" }, specialty.name))));
2795
- }))),
2796
- specialties.length === 0 && !isLoading && (React__default.createElement(Text, { size: "sm", color: theme.colors.gray400 }, t('booking.searchBar.noResults'))),
2797
- isLoading &&
2798
- Array(6)
2799
- .fill(undefined)
2800
- .map((_, i) => (React__default.createElement(StyleSpecialtyItem, { key: 'loading' + i },
2801
- React__default.createElement("div", { className: "image-item" },
2802
- React__default.createElement(Skeleton$1, { height: 40, animate: true })),
2803
- React__default.createElement("div", { className: "infor" },
2804
- React__default.createElement("div", { className: "title" },
2805
- React__default.createElement(Skeleton$1, { height: 20, radius: "sm", animate: true }))))))),
2806
- showSeeMore && (React__default.createElement(StyleShowMore, null,
2807
- React__default.createElement("div", { className: "show-more", onClick: handleShowMore }, t('home.seeAll'))))));
2808
- };
2809
-
2810
- const StyleSearchTagWrapper = styled.div `
2811
- display: flex;
2812
- gap: 5px;
2813
- margin-top: 16px;
2814
- flex-wrap: wrap;
2815
- `;
2816
- const StyleTagItem = styled.div `
2817
- color: ${theme.colors.gray600};
2818
- font-size: 14px;
2819
- font-weight: 600;
2820
- line-height: 22px;
2821
- padding: 4px 12px;
2822
- background: ${theme.colors.white};
2823
- border-radius: 32px;
2824
- cursor: pointer;
2825
- border: 1px solid ${theme.colors.white};
2826
- margin-bottom: 5px;
2827
- border-color: ${theme.colors.neutral100};
2828
- background: #f7f9fc;
2829
-
2830
- &.view-all {
2831
- border-radius: 32px;
2832
- border-color: ${theme.colors.blue50};
2833
- background: ${theme.colors.blue50};
2834
- color: ${theme.colors.blue600};
2835
-
2836
- &:hover {
2837
- border-color: ${theme.colors.blue50};
2838
- background: ${theme.colors.blue50};
2839
- color: ${theme.colors.blue600};
2840
- }
2841
- }
2842
-
2843
- &:hover {
2844
- border-color: ${theme.colors.neutral100};
2845
- background: #f7f9fc;
2846
- }
2847
- `;
2848
- const StyleTagLabel = styled.div `
2849
- color: ${theme.colors.gray600};
2850
- font-size: 14px;
2851
- font-weight: 600;
2852
- line-height: 22px;
2853
- padding: 4px 0;
2854
- background: ${theme.colors.white};
2855
- border-radius: 32px;
2856
- border: 1px solid ${theme.colors.white};
2857
- margin-bottom: 5px;
2858
- margin-right: 7px;
2859
- `;
2860
-
2861
- const SearchTag = ({ state, type, typeInformation, dispatch }) => {
2862
- const { t } = useTranslations();
2863
- const { selectedLocation } = state;
2864
- const typeSlug = useMemo(() => typeInformation[type].slug, [typeInformation, type]);
2865
- const handleViewAll = () => {
2866
- const url = `/${selectedLocation.slug}/${typeSlug}`;
2867
- if (url) {
2868
- dispatch({ type: ActionTypes.NavigateTo, payload: url });
2869
- }
2870
- };
2871
- const handleClickKeyword = (keyword) => {
2872
- if (keyword.url) {
2873
- window.location.href = keyword.url;
2874
- }
2875
- };
2876
- return (React__default.createElement(StyleSearchTagWrapper, null,
2877
- React__default.createElement(StyleTagLabel, null, t('booking.searchBar.popularKey')),
2878
- state.popularKeys.map((item) => {
2879
- return (React__default.createElement(StyleTagItem, { key: item.id, onClick: () => handleClickKeyword(item) }, item.keyword));
2880
- }),
2881
- React__default.createElement(StyleTagItem, { className: "view-all", onClick: handleViewAll }, t('booking.searchBar.viewAll'))));
2882
- };
2883
-
2884
- const StyledTabWrapper = styled.div `
2885
- background: rgba(255, 255, 255, 0.64);
2886
- backdrop-filter: blur(12px);
2887
- border-bottom: 1px solid ${theme.colors.neutral100};
2888
- `;
2889
- const StyleTabContainer = styled(Container) `
2890
- padding: 0 16px;
2891
- `;
2892
-
2893
- const itemTabs = () => {
2894
- const { t } = useTranslations();
2895
- return [
2896
- {
2897
- value: 'hospital',
2898
- label: t('booking.searchPopup.hospitals'),
2899
- },
2900
- {
2901
- value: 'doctor',
2902
- label: t('booking.searchPopup.doctors'),
2903
- },
2904
- {
2905
- value: 'service',
2906
- label: t('booking.searchPopup.services'),
2907
- },
2908
- {
2909
- value: 'specialty',
2910
- label: t('booking.searchPopup.specialties'),
2911
- },
2912
- ];
2913
- };
2914
- const TabSearch = ({ currentTab, hideTabBookingSearch = [], isMobile, setCurrentTab, }) => {
2915
- const stylesTabs = useMemo(() => {
2916
- return {
2917
- root: {
2918
- overflowY: isMobile ? 'hidden' : 'initial',
2919
- overflowX: isMobile ? 'auto' : 'initial',
2920
- },
2921
- tabsList: {
2922
- background: 'rgba(255, 255, 255, 0)',
2923
- borderBottom: 'none',
2924
- flexWrap: 'nowrap',
2925
- '.mantine-Tabs-tab': {
2926
- '&:last-child': {
2927
- '&:after': {
2928
- display: 'none',
2929
- },
2930
- },
2931
- },
2932
- },
2933
- tab: {
2934
- padding: isMobile ? '12px 16px 12px 16px' : '15px 40px 15px 40px',
2935
- borderTop: '2px solid transparent',
2936
- borderBottom: 'none',
2937
- margin: 0,
2938
- borderRadius: 0,
2939
- position: 'relative',
2940
- width: 'auto',
2941
- '&[data-active="true"]': {
2942
- borderColor: '#2d87f3',
2943
- backgroundColor: '#ffffff',
2944
- '&:after': {
2945
- display: 'none',
2946
- },
2947
- '&:before': {
2948
- content: '""',
2949
- width: '100%',
2950
- height: '1px',
2951
- position: 'absolute',
2952
- backgroundColor: '#ffffff',
2953
- bottom: '-1px',
2954
- },
2955
- },
2956
- '&:hover': {
2957
- borderColor: '#2d87f3',
2958
- backgroundColor: '#ffffff',
2959
- '&:before': {
2960
- content: '""',
2961
- width: '100%',
2962
- height: '1px',
2963
- position: 'absolute',
2964
- backgroundColor: '#ffffff',
2965
- bottom: '-1px',
2966
- },
2967
- },
2968
- '&:after': {
2969
- content: '""',
2970
- width: '1px',
2971
- height: '24px',
2972
- backgroundColor: '#E4E8EC',
2973
- position: 'absolute',
2974
- right: '-1px',
2975
- },
2976
- },
2977
- tabLabel: {
2978
- color: '#595959',
2979
- fontSize: isMobile ? '14px' : '16px',
2980
- fontWeight: 600,
2981
- lineHeight: isMobile ? '22px' : '24px',
2982
- },
2983
- };
2984
- }, [isMobile]);
2985
- const tabConfig = itemTabs();
2986
- const activeTabs = useMemo(() => {
2987
- return (tabConfig.filter((item) => !hideTabBookingSearch.includes(item.value)) ||
2988
- []);
2989
- }, [hideTabBookingSearch, tabConfig]);
2990
- return (React__default.createElement(StyledTabWrapper, { className: "booking-search-tab" },
2991
- React__default.createElement(StyleTabContainer, null,
2992
- React__default.createElement(Tabs, { value: currentTab, onTabChange: (tab) => {
2993
- setCurrentTab(tab);
2994
- }, styles: stylesTabs },
2995
- React__default.createElement(Tabs.List, null, activeTabs.map((tab) => {
2996
- return (React__default.createElement(Tabs.Tab, { value: tab.value, key: tab.value }, tab.label));
2997
- }))))));
2998
- };
2999
-
3000
- var TypePopularKeySearch;
3001
- (function (TypePopularKeySearch) {
3002
- TypePopularKeySearch["doctor"] = "doctor";
3003
- TypePopularKeySearch["service"] = "hospital_service";
3004
- TypePopularKeySearch["hospital"] = "hospital_branch";
3005
- })(TypePopularKeySearch || (TypePopularKeySearch = {}));
3006
-
3007
- function useSearchBarApi({ dispatch, careApiDomain, locale = 'vi-VN', client = '', }) {
3008
- const fetchCitiesApi = useCallback(function fetchCitiesApi(path, params = {}) {
3009
- const url = `${careApiDomain}${path}`;
3010
- dispatch({ type: ActionTypes.FetchCitiesStart });
3011
- return fetch(getApiPath(url, params, locale), { method: 'GET' })
3012
- .then((res) => res.json())
3013
- .then((data) => {
3014
- if (data._status !== 1 || !data._data) {
3015
- console.log('error loading cities', data);
3016
- return Promise.reject(data);
3017
- }
3018
- return data === null || data === void 0 ? void 0 : data._data;
3019
- })
3020
- .finally(() => dispatch({ type: ActionTypes.FetchCitiesFinish }));
3021
- }, [locale]);
3022
- const fetchCitiesByLocation = useCallback(function fetchCitiesByLocation({ coordinates }) {
3023
- let params = {};
3024
- const moreParams = {};
3025
- if (coordinates) {
3026
- params = {
3027
- lat: coordinates.lat,
3028
- lng: coordinates.lng,
3029
- };
3030
- }
3031
- if (locale === 'ms-MY') {
3032
- moreParams.noPaging = 1;
3033
- }
3034
- const requests = [
3035
- fetchCitiesApi(PATHS.GET_CITY_BY_IP, Object.assign(Object.assign(Object.assign({}, params), moreParams), { client: CLIENT_KEY.MSD === client ? '' : client })),
3036
- ];
3037
- if (locale === 'zh-TW') {
3038
- requests.push(fetchCitiesApi(PATHS.GET_CITIES_LIST, {
3039
- noPaging: 1,
3040
- client: CLIENT_KEY.MSD === client ? '' : client,
3041
- }));
3042
- }
3043
- return Promise.all(requests)
3044
- .then(([data1, data2]) => {
3045
- const data = Object.assign({}, data1);
3046
- if (data2) {
3047
- const citiesIds = data.cities.map((c) => c.id);
3048
- data.cities = data.cities.concat(data2.cities.filter((c) => !citiesIds.includes(c.id)));
3049
- }
3050
- dispatch({
3051
- type: ActionTypes.FetchCitiesByGeoIpComplete,
3052
- payload: data,
3053
- });
3054
- })
3055
- .catch((err) => console.error('error loading cities by location', err));
3056
- }, [locale, careApiDomain, dispatch]);
3057
- const fetchCitiesByKeyword = useCallback(function fetchCitiesByKeyword(keyword) {
3058
- return fetchCitiesApi(PATHS.GET_CITIES_LIST, {
3059
- keyword,
3060
- client,
3061
- })
3062
- .then((data) => {
3063
- dispatch({
3064
- type: ActionTypes.FetchCitiesByKeywordComplete,
3065
- payload: data.cities,
3066
- });
3067
- })
3068
- .catch((err) => console.error('error loading cities by keyword', err));
3069
- }, [locale, careApiDomain, dispatch]);
3070
- const fetchSearchResults = useCallback(function fetchSearchResults(searchKeywords, state, searchType, clientSlug, cacheResult) {
3071
- const url = searchType === 'specialty'
3072
- ? `${careApiDomain}${PATHS.GET_SEARCH_SPECIALTY}`
3073
- : `${careApiDomain}${PATHS.GET_SEARCH_V2}`;
3074
- dispatch({ type: ActionTypes.FetchSearchResultsStart });
3075
- const { selectedLocation, geoLocationCoordinates, selectedSpecialty } = state;
3076
- let cityId = '';
3077
- if (!selectedLocation) {
3078
- dispatch({ type: ActionTypes.FetchSearchResultsFinish });
3079
- return;
3080
- }
3081
- if (selectedLocation.id === ID_OPTION_ALL_LOCATION) {
3082
- cityId = '';
3083
- }
3084
- else {
3085
- cityId = selectedLocation.id;
3086
- }
3087
- const lat = (geoLocationCoordinates === null || geoLocationCoordinates === void 0 ? void 0 : geoLocationCoordinates.lat) || '';
3088
- const lng = (geoLocationCoordinates === null || geoLocationCoordinates === void 0 ? void 0 : geoLocationCoordinates.lng) || '';
3089
- const specialty_id = (selectedSpecialty === null || selectedSpecialty === void 0 ? void 0 : selectedSpecialty.id) > 0 ? selectedSpecialty === null || selectedSpecialty === void 0 ? void 0 : selectedSpecialty.id : '';
3090
- const keyword = searchKeywords.trim().length > SEARCH_KEYWORD_MIN_LENGTH[locale]
3091
- ? searchKeywords.trim()
3092
- : '';
3093
- return fetch(getApiPath(url, {
3094
- domain: careApiDomain,
3095
- searchType: searchType || 'global',
3096
- keyword: keyword,
3097
- city: cityId === ID_OPTION_CURRENT_LOCATION ? '' : cityId,
3098
- lat,
3099
- lng,
3100
- specialty_id,
3101
- client_slug: CLIENT_KEY.MSD === clientSlug ? '' : clientSlug,
3102
- msd: CLIENT_KEY.MSD === client ? 1 : '',
3103
- }, locale), {
3104
- method: 'GET',
3105
- headers: {
3106
- accept: 'version=2.0.0.0',
3107
- },
3108
- })
3109
- .then((res) => res.json())
3110
- .then((data) => {
3111
- if (data._status !== 1 || !data._data) {
3112
- return Promise.reject(data);
3113
- }
3114
- return data === null || data === void 0 ? void 0 : data._data;
3115
- })
3116
- .then((results) => {
3117
- let searchesResult = [];
3118
- if (searchType !== 'specialty') {
3119
- searchesResult = results.searches;
3120
- }
3121
- if (searchType === 'specialty') {
3122
- if (keyword) {
3123
- searchesResult = results.specialties;
3124
- }
3125
- else {
3126
- searchesResult = results.default;
3127
- }
3128
- }
3129
- dispatch({
3130
- type: ActionTypes.FetchSearchResultsComplete,
3131
- payload: {
3132
- key: searchType,
3133
- searches: searchesResult || [],
3134
- },
3135
- });
3136
- if (cacheResult) {
3137
- dispatch({
3138
- type: ActionTypes.UpdateInitialSearchResults,
3139
- payload: {
3140
- key: searchType,
3141
- searches: searchesResult || [],
3142
- },
3143
- });
3144
- }
3145
- })
3146
- .catch((error) => {
3147
- console.log('error loading search results', { url, error });
3148
- })
3149
- .finally(() => dispatch({ type: ActionTypes.FetchSearchResultsFinish }));
3150
- }, [locale, careApiDomain, dispatch]);
3151
- const fetchAllSpecialties = useCallback(function fetchSearchSpecialties() {
3152
- const url = `${careApiDomain}${PATHS.GET_SEARCH_SPECIALTY}`;
3153
- return fetch(getApiPath(url, {
3154
- domain: careApiDomain,
3155
- searchType: '',
3156
- msd: CLIENT_KEY.MSD === client ? 1 : '',
3157
- }, locale), {
3158
- method: 'GET',
3159
- headers: {
3160
- accept: 'version=2.0.0.0',
3161
- },
3162
- })
3163
- .then((res) => res.json())
3164
- .then((data) => {
3165
- if (data._status !== 1 || !data._data) {
3166
- return Promise.reject(data);
3167
- }
3168
- return data === null || data === void 0 ? void 0 : data._data;
3169
- })
3170
- .then((results) => {
3171
- dispatch({
3172
- type: ActionTypes.FetchAllSpecialties,
3173
- payload: results.specialties || [],
3174
- });
3175
- })
3176
- .catch((error) => {
3177
- console.log('error loading search results', { url, error });
3178
- });
3179
- }, [locale, careApiDomain, dispatch]);
3180
- const fetchPopularKeys = useCallback(function fetchPopularKeys(searchType) {
3181
- const url = `${careApiDomain}${PATHS.GET_SEARCH_POPULAR_KEY}`;
3182
- return fetch(getApiPath(url, {
3183
- domain: careApiDomain,
3184
- searchType: TypePopularKeySearch[searchType],
3185
- sort_by: 'display_order',
3186
- sort_order: 'asc',
3187
- }, locale))
3188
- .then((res) => res.json())
3189
- .then((data) => {
3190
- if (data._status !== 1 || !data._data) {
3191
- return Promise.reject(data);
3192
- }
3193
- return data === null || data === void 0 ? void 0 : data._data;
3194
- })
3195
- .then((results) => {
3196
- dispatch({
3197
- type: ActionTypes.FetchPopularKeys,
3198
- payload: results.popular_searches || [],
3199
- });
3200
- })
3201
- .catch((error) => {
3202
- console.log('error loading search results', { url, error });
3203
- });
3204
- }, [locale, careApiDomain, dispatch]);
3205
- return {
3206
- fetchCitiesByLocation,
3207
- fetchCitiesByKeyword,
3208
- fetchSearchResults,
3209
- fetchAllSpecialties,
3210
- fetchPopularKeys,
3211
- };
3212
- }
3213
-
3214
- const BookingSearchBarV2 = ({ isMobile, careApiDomain, geoLocationPermission: geoLocationPermissionFromProps, geoLocationCoordinates: geoLocationCoordinatesFromProps, initialSelectedCity: initialSelectedCityFromProps, initialSearchValue = '', initTypeSearch = 'hospital', initSpecialty, careFrontDomain = '/care', isDebug = false,
3215
- // askForGeolocationPermission = false,
3216
- gaTrackingSearchBar, gaTrackingLocationSearch, autoCompleteDisabled = false, inputSearchPlaceholder = '', hideTabBookingSearch = [], hideSpecialtySelection = false, hidePopularSearchKeys = false, clientSlug = '',
3217
- // isOptionAllLocation = false,
3218
- // hideResults = [],
3219
- // isNavResultItem = true,
3220
- routerPush, onGeoLocationPermissionChange,
3221
- // onSearch,
3222
- onChangeLocation, }) => {
3223
- const { locale, t } = useTranslations();
3224
- const wrapperRef = useRef(null);
3225
- const inputSearchSpecialtyWrapperRef = useRef(null);
3226
- const [currentTab, setCurrentTab] = useState(initTypeSearch);
3227
- const { geoLocationPermission: geoLocationPermissionFromHook, geoLocationCoordinates: geoLocationCoordinatesFromHook, } = useGeolocation();
3228
- const [state, dispatch] = useReducer(reducer, initialState, (s) => (Object.assign(Object.assign({}, s), { isDebug,
3229
- isMobile, geoLocationPermission: geoLocationPermissionFromProps ||
3230
- geoLocationPermissionFromHook ||
3231
- 'unset', geoLocationCoordinates: geoLocationCoordinatesFromProps ||
3232
- geoLocationCoordinatesFromHook ||
3233
- null, searchKeywords: initialSearchValue, initialSelectedCity: initialSelectedCityFromProps || null, selectedLocation: initialSelectedCityFromProps || s.selectedLocation || null, searchLocationKeywords: (initialSelectedCityFromProps === null || initialSelectedCityFromProps === void 0 ? void 0 : initialSelectedCityFromProps.name) || s.searchLocationKeywords, autoCompleteDisabled,
3234
- inputSearchPlaceholder,
3235
- locale })));
3236
- const { navigateTo, focusedSpecialty,
3237
- // isLoadingCities,
3238
- // cities,
3239
- searchKeywords, geoLocationPermission, selectedLocation, selectedSpecialty, initialSelectedCity,
3240
- // defaultCity,
3241
- searchResults, isLoadingSearchResults,
3242
- // isMobileModalOpened,
3243
- // inputSearchPlaceholder,
3244
- // allSpecialties,
3245
- } = state;
3246
- const { fetchCitiesByLocation, fetchCitiesByKeyword, fetchSearchResults, fetchAllSpecialties, fetchPopularKeys, } = useSearchBarApi({
3247
- dispatch,
3248
- locale,
3249
- careApiDomain,
3250
- client: clientSlug,
3251
- });
3252
- const slugs = useMemo(() => LOCALIZED_SLUGS[locale], [locale]);
3253
- const typeInformation = useMemo(() => {
3254
- return {
3255
- doctor: {
3256
- name: t('booking.searchPopup.doctors'),
3257
- icon: React__default.createElement(DoctorIcon, null),
3258
- slug: slugs.DOCTOR,
3259
- },
3260
- service: {
3261
- name: t('booking.searchPopup.services'),
3262
- icon: React__default.createElement(ServiceIcon, null),
3263
- slug: slugs.SERVICE,
3264
- },
3265
- hospital: {
3266
- name: t('booking.searchPopup.hospitals'),
3267
- icon: React__default.createElement(HospitalIcon, null),
3268
- slug: slugs.HOSPITAL,
3269
- },
3270
- specialty: {
3271
- name: t('booking.searchPopup.specialties'),
3272
- icon: React__default.createElement(SpecialtyIcon, null),
3273
- slug: slugs.SPECIALTIES,
3274
- },
3275
- };
3276
- }, [currentTab]);
3277
- const debouncedFetchCitiesByKeyword = useMemo(() => debounce(fetchCitiesByKeyword, 400), [fetchCitiesByKeyword]);
3278
- const debouncedFetchSearchResults = useMemo(() => debounce(fetchSearchResults, 400), [fetchSearchResults]);
3279
- const handleLocationClick = useCallback(function handleLocationClick(city) {
3280
- dispatch({ type: ActionTypes.SelectLocation, payload: city });
3281
- focusSearchInput();
3282
- if (onChangeLocation) {
3283
- onChangeLocation(city);
3284
- }
3285
- }, [t, dispatch]);
3286
- function focusSearchInput() {
3287
- var _a;
3288
- if (wrapperRef.current) {
3289
- (_a = wrapperRef.current
3290
- .querySelector('input[name="search-results"]')) === null || _a === void 0 ? void 0 : _a.focus();
3291
- }
3292
- }
3293
- function onClickSearchByKeyword() {
3294
- let url = '';
3295
- const { slug: typeSlug } = typeInformation[currentTab];
3296
- let moreParams = '';
3297
- const slugClientUrl = MAPPING_CLIENT_WITH_SLUG[locale][clientSlug];
3298
- if ((currentTab === 'doctor' || currentTab === 'hospital') &&
3299
- state.selectedSpecialty.id > 0) {
3300
- moreParams = `&specialtyId=${state.selectedSpecialty.id}`;
3301
- }
3302
- if (currentTab === 'specialty') {
3303
- url = `/${typeSlug}`;
3304
- }
3305
- else {
3306
- url = `/${selectedLocation.slug}/${typeSlug}`;
3307
- }
3308
- if (slugClientUrl) {
3309
- url += `/${slugClientUrl}`;
3310
- }
3311
- url += `?q=${searchKeywords}${moreParams}`;
3312
- if (url) {
3313
- dispatch({ type: ActionTypes.NavigateTo, payload: url });
3314
- }
3315
- }
3316
- useOutsideClick(inputSearchSpecialtyWrapperRef, () => {
3317
- dispatch({ type: ActionTypes.ClickOutsideInputSearchSpecialty });
3318
- });
3319
- useEffect(() => {
3320
- var _a;
3321
- if (geoLocationPermission !== 'denied' && !initialSelectedCity) {
3322
- dispatch({
3323
- type: ActionTypes.SelectLocation,
3324
- payload: {
3325
- name: t('booking.searchBar.allLocations'),
3326
- id: ID_OPTION_ALL_LOCATION,
3327
- slug: (_a = LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.ALL,
3328
- },
3329
- });
3330
- }
3331
- if (onGeoLocationPermissionChange) {
3332
- onGeoLocationPermissionChange(geoLocationPermission, state.geoLocationCoordinates);
3333
- }
3334
- if (isMobile && geoLocationPermission === 'granted' && selectedLocation) {
3335
- dispatch({ type: ActionTypes.FocusInputSearch });
3336
- }
3337
- fetchCitiesByLocation({ coordinates: state.geoLocationCoordinates });
3338
- }, [geoLocationPermission]);
3339
- useEffect(() => {
3340
- const defaultSpecialty = initSpecialty
3341
- ? initSpecialty
3342
- : {
3343
- name: t('booking.searchBar.allSpecialties'),
3344
- id: -1,
3345
- thumbnail: '',
3346
- total_doctor: 0,
3347
- slug: slugs.SPECIALTIES,
3348
- };
3349
- if (!state.selectedSpecialty) {
3350
- dispatch({
3351
- type: ActionTypes.SelectSpecialty,
3352
- payload: defaultSpecialty,
3353
- });
3354
- }
3355
- }, [initSpecialty, state.selectedSpecialty]);
3356
- useEffect(() => {
3357
- fetchAllSpecialties();
3358
- }, []);
3359
- useEffect(() => {
3360
- fetchPopularKeys(currentTab);
3361
- }, [currentTab]);
3362
- useEffect(() => {
3363
- if (navigateTo) {
3364
- if (routerPush) {
3365
- routerPush(navigateTo);
3366
- }
3367
- else {
3368
- window.location.href = `${careFrontDomain}${navigateTo}`;
3369
- }
3370
- }
3371
- }, [navigateTo]);
3372
- useEffect(() => {
3373
- fetchSearchResults(state.searchKeywords, state, currentTab, clientSlug, true);
3374
- }, [selectedLocation, selectedSpecialty, currentTab]);
3375
- return (React__default.createElement(StyledSearchBarWrapper, { ref: wrapperRef },
3376
- React__default.createElement(TabSearch, { currentTab: currentTab, setCurrentTab: setCurrentTab, isMobile: isMobile, hideTabBookingSearch: hideTabBookingSearch }),
3377
- React__default.createElement(StyleWrapperContainer, { className: "booking-search-container" },
3378
- React__default.createElement(StyleSearchInputContainer, null,
3379
- React__default.createElement(StyleSearchContent, { className: "booking-search-content" },
3380
- React__default.createElement("div", { ref: inputSearchSpecialtyWrapperRef },
3381
- React__default.createElement(Flex, { gap: "12px", justify: "space-between", align: "center", direction: isMobile ? 'column' : 'row', className: "flex-search-input" },
3382
- currentTab !== 'specialty' && (React__default.createElement(SearchLocation, { state: state, isMobile: isMobile, dispatch: dispatch, debouncedFetchCitiesByKeyword: debouncedFetchCitiesByKeyword, selectedLocation: selectedLocation, onLocationClick: handleLocationClick, trackingAttributes: gaTrackingLocationSearch })),
3383
- React__default.createElement(SearchInputs, { type: currentTab, isMobile: isMobile, state: state, dispatch: dispatch, debouncedFetchSearchResults: debouncedFetchSearchResults, initalSearchValue: initialSearchValue, focusSearchInput: focusSearchInput, onEnterSearch: onClickSearchByKeyword, typeInformation: typeInformation, trackingAttributes: gaTrackingSearchBar, isLoading: isLoadingSearchResults, hideSpecialtySelection: hideSpecialtySelection, clientSlug: clientSlug }),
3384
- React__default.createElement(Button, { size: isMobile ? 'md' : 'lg', color: "#2D87F3", fullWidth: isMobile, variant: "filled", onClick: onClickSearchByKeyword, styles: {
3385
- root: {
3386
- height: isMobile ? '40px' : '48px',
3387
- },
3388
- } }, t('booking.searchBar.searchButton'))),
3389
- !hidePopularSearchKeys &&
3390
- currentTab !== 'specialty' &&
3391
- state.popularKeys.length > 0 && (React__default.createElement(SearchTag, { type: currentTab, state: state, typeInformation: typeInformation, dispatch: dispatch })),
3392
- currentTab === 'specialty' && focusedSpecialty === 'search' && (React__default.createElement(SearchResultSpecialties, { state: state, isMobile: isMobile, dispatch: dispatch, specialties: (searchResults === null || searchResults === void 0 ? void 0 : searchResults.specialty) || [], isLoading: isLoadingSearchResults }))))))));
3393
- };
3394
-
3395
- const StyledTextDivider = styled.div `
3396
- background-color: var(--neutral50);
3397
- padding: 12px 0;
3398
- box-shadow: inset 0px 1px 0px #e4e8ec;
3399
-
3400
- > * {
3401
- display: grid;
3402
- grid-template-columns: 32px 1fr;
3403
- align-content: center;
3404
-
3405
- p {
3406
- font-weight: 600;
3407
- }
3408
- }
3409
-
3410
- .icon-wrapper {
3411
- display: flex;
3412
- align-items: center;
3413
- }
3414
- `;
3415
- const TextDivider = ({ children, icon, className, style }) => (React__default.createElement(StyledTextDivider, { style: style, className: className },
3416
- React__default.createElement(Container, null,
3417
- React__default.createElement("div", { className: "icon-wrapper" }, icon),
3418
- React__default.createElement(Text, { size: "c1", color: "var(--neutral800)" }, children))));
3419
-
3420
- var RedirectType;
3421
- (function (RedirectType) {
3422
- RedirectType[RedirectType["SPECIALTY"] = 1] = "SPECIALTY";
3423
- RedirectType[RedirectType["DOCTOR"] = 2] = "DOCTOR";
3424
- RedirectType[RedirectType["CLINIC"] = 3] = "CLINIC";
3425
- RedirectType[RedirectType["SERVICE"] = 4] = "SERVICE";
3426
- })(RedirectType || (RedirectType = {}));
3427
-
3428
- var types = /*#__PURE__*/Object.freeze({
3429
- __proto__: null,
3430
- get RedirectType () { return RedirectType; }
3431
- });
3432
-
3433
- export { BookingSearchBar as B, TextDivider as T, BookingSearchBarV2 as a, types as t };