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