@hhgtech/hhg-components 1.19.0-beta-5 → 1.19.0-beta-7
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/.eslintrc.json +53 -0
- package/package.json +5 -2
- package/src/assets/svg/Spotlight.svg +12 -0
- package/src/assets/svg/StarEmptyIcon.tsx +19 -0
- package/src/assets/svg/StarFullIcon.tsx +21 -0
- package/src/assets/svg/StarHalfIcon.tsx +35 -0
- package/src/assets/svg/arrowDoor.svg +9 -0
- package/src/assets/svg/calendar.svg +3 -0
- package/src/assets/svg/calendarArrowLeft.svg +3 -0
- package/src/assets/svg/calendarArrowRight.svg +3 -0
- package/src/assets/svg/check.svg +3 -0
- package/src/assets/svg/chevronDown.svg +3 -0
- package/src/assets/svg/chevronRight.svg +3 -0
- package/src/assets/svg/chevronRightActive.svg +3 -0
- package/src/assets/svg/chevronRightWhite.svg +3 -0
- package/src/assets/svg/chevronUpBlue.svg +3 -0
- package/src/assets/svg/closeLight.svg +4 -0
- package/src/assets/svg/closeWhite.svg +4 -0
- package/src/assets/svg/community.svg +1 -0
- package/src/assets/svg/discover.png +0 -0
- package/src/assets/svg/facebook.svg +4 -0
- package/src/assets/svg/hamburgerMenu.svg +5 -0
- package/src/assets/svg/hamburgerMenuNew.svg +1 -0
- package/src/assets/svg/hamburgerMenuNewWithSearch.svg +1 -0
- package/src/assets/svg/healthTools.png +0 -0
- package/src/assets/svg/helloCare-thumbnail.png +0 -0
- package/src/assets/svg/index.ts +63 -0
- package/src/assets/svg/info-light.svg +5 -0
- package/src/assets/svg/instagram.svg +1 -0
- package/src/assets/svg/linkedin.svg +1 -0
- package/src/assets/svg/lock.png +0 -0
- package/src/assets/svg/login.svg +1 -0
- package/src/assets/svg/sehat-badge.png +0 -0
- package/src/assets/svg/together.png +0 -0
- package/src/assets/svg/youtube.svg +4 -0
- package/src/assets/svg/zalo.png +0 -0
- package/src/cache/core.ts +52 -0
- package/src/cache/index.ts +1 -0
- package/src/care/api/paths.ts +11 -0
- package/src/care/api/utils.ts +32 -0
- package/src/care/components/atoms/icons/index.tsx +170 -0
- package/src/care/components/organisms/bookingSearchBar/constants.ts +9 -0
- package/src/care/components/organisms/bookingSearchBar/index.stories.tsx +127 -0
- package/src/care/components/organisms/bookingSearchBar/index.styled.ts +51 -0
- package/src/care/components/organisms/bookingSearchBar/index.test.tsx +556 -0
- package/src/care/components/organisms/bookingSearchBar/index.tsx +448 -0
- package/src/care/components/organisms/bookingSearchBar/locationResults/index.styled.ts +94 -0
- package/src/care/components/organisms/bookingSearchBar/locationResults/index.tsx +132 -0
- package/src/care/components/organisms/bookingSearchBar/locationResults/liSkeleton.tsx +52 -0
- package/src/care/components/organisms/bookingSearchBar/mobileFakeInput/index.tsx +68 -0
- package/src/care/components/organisms/bookingSearchBar/mobileTopbar/index.stories.tsx +22 -0
- package/src/care/components/organisms/bookingSearchBar/mobileTopbar/index.styled.ts +41 -0
- package/src/care/components/organisms/bookingSearchBar/mobileTopbar/index.tsx +48 -0
- package/src/care/components/organisms/bookingSearchBar/reducer.ts +293 -0
- package/src/care/components/organisms/bookingSearchBar/resultSection/icons.tsx +37 -0
- package/src/care/components/organisms/bookingSearchBar/resultSection/index.stories.tsx +155 -0
- package/src/care/components/organisms/bookingSearchBar/resultSection/index.styled.ts +89 -0
- package/src/care/components/organisms/bookingSearchBar/resultSection/index.tsx +234 -0
- package/src/care/components/organisms/bookingSearchBar/resultSectionItem/index.stories.tsx +55 -0
- package/src/care/components/organisms/bookingSearchBar/resultSectionItem/index.styled.ts +75 -0
- package/src/care/components/organisms/bookingSearchBar/resultSectionItem/index.tsx +86 -0
- package/src/care/components/organisms/bookingSearchBar/searchInputs/index.styled.ts +42 -0
- package/src/care/components/organisms/bookingSearchBar/searchInputs/index.tsx +219 -0
- package/src/care/components/organisms/bookingSearchBar/searchResults/index.stories.tsx +55 -0
- package/src/care/components/organisms/bookingSearchBar/searchResults/index.tsx +62 -0
- package/src/care/components/organisms/bookingSearchBar/searchResults/mockData.ts +169 -0
- package/src/care/components/organisms/bookingSearchBar/searchSubmitIcon/index.tsx +73 -0
- package/src/care/components/organisms/bookingSearchBar/types.ts +12 -0
- package/src/care/components/organisms/bookingSearchBar/useAnimatedPlaceholder.ts +86 -0
- package/src/care/components/organisms/bookingSearchBar/useSearchBarApi.ts +150 -0
- package/src/care/components/organisms/bookingSearchBar/utils/Typewriter.ts +437 -0
- package/src/care/index.ts +6 -0
- package/src/care/interfaces/constants.ts +75 -0
- package/src/care/interfaces/types.ts +258 -0
- package/src/components/atoms/alert/__snapshots__/index.test.tsx.snap +130 -0
- package/src/components/atoms/alert/index.stories.tsx +21 -0
- package/src/components/atoms/alert/index.styled.tsx +44 -0
- package/src/components/atoms/alert/index.test.tsx +28 -0
- package/src/components/atoms/alert/index.tsx +47 -0
- package/src/components/atoms/avatar/index.stories.tsx +49 -0
- package/src/components/atoms/avatar/index.styled.tsx +96 -0
- package/src/components/atoms/avatar/index.tsx +91 -0
- package/src/components/atoms/badge/__snapshots__/index.test.tsx.snap +61 -0
- package/src/components/atoms/badge/index.stories.tsx +71 -0
- package/src/components/atoms/badge/index.styled.tsx +138 -0
- package/src/components/atoms/badge/index.test.tsx +27 -0
- package/src/components/atoms/badge/index.tsx +45 -0
- package/src/components/atoms/borderHeading/index.stories.tsx +38 -0
- package/src/components/atoms/borderHeading/index.styled.tsx +50 -0
- package/src/components/atoms/borderHeading/index.tsx +39 -0
- package/src/components/atoms/button/__snapshots__/index.test.tsx.snap +57 -0
- package/src/components/atoms/button/index.stories.tsx +107 -0
- package/src/components/atoms/button/index.styled.tsx +335 -0
- package/src/components/atoms/button/index.test.tsx +25 -0
- package/src/components/atoms/button/index.tsx +207 -0
- package/src/components/atoms/checkbox/__snapshots__/index.test.tsx.snap +120 -0
- package/src/components/atoms/checkbox/index.stories.tsx +30 -0
- package/src/components/atoms/checkbox/index.styled.tsx +90 -0
- package/src/components/atoms/checkbox/index.test.tsx +31 -0
- package/src/components/atoms/checkbox/index.tsx +48 -0
- package/src/components/atoms/container/index.styled.tsx +16 -0
- package/src/components/atoms/container/index.tsx +21 -0
- package/src/components/atoms/displayWrapper/index.styled.tsx +19 -0
- package/src/components/atoms/displayWrapper/index.tsx +66 -0
- package/src/components/atoms/divider/__snapshots__/index.test.tsx.snap +14 -0
- package/src/components/atoms/divider/index.stories.tsx +19 -0
- package/src/components/atoms/divider/index.styled.tsx +10 -0
- package/src/components/atoms/divider/index.test.tsx +22 -0
- package/src/components/atoms/divider/index.tsx +34 -0
- package/src/components/atoms/fileDropdown/__snapshots__/index.test.tsx.snap +143 -0
- package/src/components/atoms/fileDropdown/index.stories.tsx +41 -0
- package/src/components/atoms/fileDropdown/index.styled.tsx +112 -0
- package/src/components/atoms/fileDropdown/index.test.tsx +46 -0
- package/src/components/atoms/fileDropdown/index.tsx +200 -0
- package/src/components/atoms/flag/__snapshots__/index.test.tsx.snap +59 -0
- package/src/components/atoms/flag/icons/cambodia.tsx +24 -0
- package/src/components/atoms/flag/icons/english.tsx +195 -0
- package/src/components/atoms/flag/icons/india.tsx +24 -0
- package/src/components/atoms/flag/icons/indonesia.tsx +55 -0
- package/src/components/atoms/flag/icons/malaysia.tsx +89 -0
- package/src/components/atoms/flag/icons/myanmar.tsx +105 -0
- package/src/components/atoms/flag/icons/philippines.tsx +24 -0
- package/src/components/atoms/flag/icons/taiwan.tsx +154 -0
- package/src/components/atoms/flag/icons/thailand.tsx +55 -0
- package/src/components/atoms/flag/icons/vietnam.tsx +57 -0
- package/src/components/atoms/flag/index.stories.tsx +30 -0
- package/src/components/atoms/flag/index.styled.tsx +18 -0
- package/src/components/atoms/flag/index.test.tsx +21 -0
- package/src/components/atoms/flag/index.tsx +150 -0
- package/src/components/atoms/grid/__snapshots__/index.test.tsx.snap +38 -0
- package/src/components/atoms/grid/index.stories.tsx +50 -0
- package/src/components/atoms/grid/index.styled.tsx +34 -0
- package/src/components/atoms/grid/index.test.tsx +26 -0
- package/src/components/atoms/grid/index.tsx +61 -0
- package/src/components/atoms/heading/__snapshots__/index.test.tsx.snap +38 -0
- package/src/components/atoms/heading/index.stories.tsx +27 -0
- package/src/components/atoms/heading/index.styled.tsx +108 -0
- package/src/components/atoms/heading/index.test.tsx +23 -0
- package/src/components/atoms/heading/index.tsx +59 -0
- package/src/components/atoms/icons/Ask.tsx +54 -0
- package/src/components/atoms/icons/BarChart.tsx +39 -0
- package/src/components/atoms/icons/Booking.tsx +37 -0
- package/src/components/atoms/icons/Bookmark.tsx +44 -0
- package/src/components/atoms/icons/Community.tsx +46 -0
- package/src/components/atoms/icons/EditSpecial.tsx +30 -0
- package/src/components/atoms/icons/Family.tsx +37 -0
- package/src/components/atoms/icons/Font.tsx +37 -0
- package/src/components/atoms/icons/Heart.tsx +37 -0
- package/src/components/atoms/icons/Home.tsx +54 -0
- package/src/components/atoms/icons/Like.tsx +49 -0
- package/src/components/atoms/icons/MyCommunity.tsx +37 -0
- package/src/components/atoms/icons/PlusSpecial.tsx +30 -0
- package/src/components/atoms/icons/Recalculate.tsx +37 -0
- package/src/components/atoms/icons/Scale.tsx +44 -0
- package/src/components/atoms/icons/Share.tsx +37 -0
- package/src/components/atoms/icons/Stethoscope.tsx +37 -0
- package/src/components/atoms/icons/index.stories.tsx +50 -0
- package/src/components/atoms/icons/index.ts +46 -0
- package/src/components/atoms/index.ts +33 -0
- package/src/components/atoms/input/__snapshots__/index.test.tsx.snap +137 -0
- package/src/components/atoms/input/delete.svg +3 -0
- package/src/components/atoms/input/index.stories.tsx +50 -0
- package/src/components/atoms/input/index.styled.tsx +124 -0
- package/src/components/atoms/input/index.test.tsx +23 -0
- package/src/components/atoms/input/index.tsx +140 -0
- package/src/components/atoms/label/__snapshots__/index.test.tsx.snap +21 -0
- package/src/components/atoms/label/index.stories.tsx +16 -0
- package/src/components/atoms/label/index.test.tsx +25 -0
- package/src/components/atoms/label/index.tsx +37 -0
- package/src/components/atoms/logo/__snapshots__/index.test.tsx.snap +99 -0
- package/src/components/atoms/logo/index.stories.tsx +84 -0
- package/src/components/atoms/logo/index.test.tsx +18 -0
- package/src/components/atoms/logo/index.tsx +1915 -0
- package/src/components/atoms/marryBabyText/index.styled.tsx +86 -0
- package/src/components/atoms/marryBabyText/index.tsx +57 -0
- package/src/components/atoms/pagination/__snapshots__/index.test.tsx.snap +185 -0
- package/src/components/atoms/pagination/index.stories.tsx +92 -0
- package/src/components/atoms/pagination/index.styled.tsx +73 -0
- package/src/components/atoms/pagination/index.test.tsx +26 -0
- package/src/components/atoms/pagination/index.tsx +286 -0
- package/src/components/atoms/progress/index.stories.tsx +55 -0
- package/src/components/atoms/progress/index.styled.tsx +30 -0
- package/src/components/atoms/progress/index.tsx +29 -0
- package/src/components/atoms/pureInput/__snapshots__/index.test.tsx.snap +135 -0
- package/src/components/atoms/pureInput/delete.svg +3 -0
- package/src/components/atoms/pureInput/index.stories.tsx +54 -0
- package/src/components/atoms/pureInput/index.styled.tsx +123 -0
- package/src/components/atoms/pureInput/index.test.tsx +29 -0
- package/src/components/atoms/pureInput/index.tsx +162 -0
- package/src/components/atoms/radio/__snapshots__/index.test.tsx.snap +163 -0
- package/src/components/atoms/radio/index.stories.tsx +48 -0
- package/src/components/atoms/radio/index.styled.tsx +133 -0
- package/src/components/atoms/radio/index.test.tsx +31 -0
- package/src/components/atoms/radio/index.tsx +66 -0
- package/src/components/atoms/rateStars/index.stories.tsx +71 -0
- package/src/components/atoms/rateStars/index.styled.tsx +17 -0
- package/src/components/atoms/rateStars/index.tsx +101 -0
- package/src/components/atoms/shadow/__snapshots__/index.test.tsx.snap +37 -0
- package/src/components/atoms/shadow/index.stories.tsx +55 -0
- package/src/components/atoms/shadow/index.styled.tsx +31 -0
- package/src/components/atoms/shadow/index.test.tsx +25 -0
- package/src/components/atoms/shadow/index.tsx +20 -0
- package/src/components/atoms/slider/__snapshots__/index.test.tsx.snap +172 -0
- package/src/components/atoms/slider/index.stories.tsx +22 -0
- package/src/components/atoms/slider/index.styled.tsx +68 -0
- package/src/components/atoms/slider/index.test.tsx +27 -0
- package/src/components/atoms/slider/index.tsx +140 -0
- package/src/components/atoms/tag/__snapshots__/index.test.tsx.snap +72 -0
- package/src/components/atoms/tag/index.stories.tsx +54 -0
- package/src/components/atoms/tag/index.styled.tsx +184 -0
- package/src/components/atoms/tag/index.test.tsx +23 -0
- package/src/components/atoms/tag/index.tsx +72 -0
- package/src/components/atoms/text/index.stories.tsx +24 -0
- package/src/components/atoms/text/index.styled.tsx +231 -0
- package/src/components/atoms/text/index.tsx +99 -0
- package/src/components/atoms/textArea/index.stories.tsx +30 -0
- package/src/components/atoms/textArea/index.tsx +86 -0
- package/src/components/atoms/textDivider/index.tsx +48 -0
- package/src/components/atoms/toggle/__snapshots__/index.test.tsx.snap +73 -0
- package/src/components/atoms/toggle/index.stories.tsx +38 -0
- package/src/components/atoms/toggle/index.styled.tsx +55 -0
- package/src/components/atoms/toggle/index.test.tsx +27 -0
- package/src/components/atoms/toggle/index.tsx +28 -0
- package/src/components/atoms/underlinedLink/index.stories.tsx +35 -0
- package/src/components/atoms/underlinedLink/index.styled.tsx +66 -0
- package/src/components/atoms/underlinedLink/index.text.tsx +23 -0
- package/src/components/atoms/underlinedLink/index.tsx +30 -0
- package/src/components/atoms/uploader/__snapshots__/index.test.tsx.snap +170 -0
- package/src/components/atoms/uploader/index.stories.tsx +128 -0
- package/src/components/atoms/uploader/index.styled.tsx +53 -0
- package/src/components/atoms/uploader/index.test.tsx +96 -0
- package/src/components/atoms/uploader/index.tsx +107 -0
- package/src/components/index.ts +3 -0
- package/src/components/molecules/ampNextPage/index.tsx +48 -0
- package/src/components/molecules/articleCard/bookmark.png +0 -0
- package/src/components/molecules/articleCard/bookmarked.png +0 -0
- package/src/components/molecules/articleCard/index.stories.tsx +222 -0
- package/src/components/molecules/articleCard/index.styled.tsx +391 -0
- package/src/components/molecules/articleCard/index.tsx +430 -0
- package/src/components/molecules/breadcrumbs/__snapshots__/index.test.tsx.snap +173 -0
- package/src/components/molecules/breadcrumbs/index.stories.tsx +79 -0
- package/src/components/molecules/breadcrumbs/index.styled.tsx +99 -0
- package/src/components/molecules/breadcrumbs/index.test.tsx +45 -0
- package/src/components/molecules/breadcrumbs/index.tsx +141 -0
- package/src/components/molecules/carousel/index.stories.tsx +40 -0
- package/src/components/molecules/carousel/index.styled.tsx +115 -0
- package/src/components/molecules/carousel/index.tsx +178 -0
- package/src/components/molecules/categoryCard/index.stories.tsx +19 -0
- package/src/components/molecules/categoryCard/index.styled.tsx +38 -0
- package/src/components/molecules/categoryCard/index.tsx +51 -0
- package/src/components/molecules/checkboxGroup/__snapshots__/index.test.tsx.snap +214 -0
- package/src/components/molecules/checkboxGroup/index.stories.tsx +118 -0
- package/src/components/molecules/checkboxGroup/index.styled.tsx +27 -0
- package/src/components/molecules/checkboxGroup/index.test.tsx +36 -0
- package/src/components/molecules/checkboxGroup/index.tsx +66 -0
- package/src/components/molecules/cookieAcceptConfirm/__snapshots__/index.test.tsx.snap +152 -0
- package/src/components/molecules/cookieAcceptConfirm/index.stories.tsx +23 -0
- package/src/components/molecules/cookieAcceptConfirm/index.styled.tsx +101 -0
- package/src/components/molecules/cookieAcceptConfirm/index.test.tsx +23 -0
- package/src/components/molecules/cookieAcceptConfirm/index.tsx +78 -0
- package/src/components/molecules/cookieAcceptConfirm/info.svg +3 -0
- package/src/components/molecules/datePicker/__snapshots__/index.test.tsx.snap +377 -0
- package/src/components/molecules/datePicker/index.stories.tsx +55 -0
- package/src/components/molecules/datePicker/index.styled.tsx +374 -0
- package/src/components/molecules/datePicker/index.test.tsx +46 -0
- package/src/components/molecules/datePicker/index.tsx +361 -0
- package/src/components/molecules/dateRangePicker/calendar/index.styled.ts +122 -0
- package/src/components/molecules/dateRangePicker/calendar/index.tsx +247 -0
- package/src/components/molecules/dateRangePicker/index.stories.tsx +45 -0
- package/src/components/molecules/dateRangePicker/index.styled.ts +36 -0
- package/src/components/molecules/dateRangePicker/index.tsx +103 -0
- package/src/components/molecules/dateRangePicker/types.ts +4 -0
- package/src/components/molecules/dateRangePicker/utils.ts +26 -0
- package/src/components/molecules/doctorInfo/index.stories.tsx +20 -0
- package/src/components/molecules/doctorInfo/index.tsx +54 -0
- package/src/components/molecules/dropdown/__snapshots__/index.test.tsx.snap +133 -0
- package/src/components/molecules/dropdown/index.stories.tsx +158 -0
- package/src/components/molecules/dropdown/index.styled.tsx +149 -0
- package/src/components/molecules/dropdown/index.test.tsx +45 -0
- package/src/components/molecules/dropdown/index.tsx +143 -0
- package/src/components/molecules/dropdownSearch/index.stories.tsx +66 -0
- package/src/components/molecules/dropdownSearch/index.styled.tsx +157 -0
- package/src/components/molecules/dropdownSearch/index.tsx +169 -0
- package/src/components/molecules/dropdownSearch/search.svg +4 -0
- package/src/components/molecules/floatButtonGroup/add-period.svg +9 -0
- package/src/components/molecules/floatButtonGroup/index.stories.tsx +72 -0
- package/src/components/molecules/floatButtonGroup/index.styled.tsx +310 -0
- package/src/components/molecules/floatButtonGroup/index.tsx +155 -0
- package/src/components/molecules/iconText/__snapshots__/index.test.tsx.snap +64 -0
- package/src/components/molecules/iconText/index.stories.tsx +22 -0
- package/src/components/molecules/iconText/index.styled.tsx +47 -0
- package/src/components/molecules/iconText/index.test.tsx +31 -0
- package/src/components/molecules/iconText/index.tsx +33 -0
- package/src/components/molecules/index.ts +39 -0
- package/src/components/molecules/languageSwitcher/index.stories.tsx +32 -0
- package/src/components/molecules/languageSwitcher/index.styled.tsx +23 -0
- package/src/components/molecules/languageSwitcher/index.tsx +68 -0
- package/src/components/molecules/languageSwitcher/tooltipSelection/index.styled.tsx +69 -0
- package/src/components/molecules/languageSwitcher/tooltipSelection/index.tsx +84 -0
- package/src/components/molecules/mobileBottomNavigation/MobileBottomNavigationIcon.tsx +51 -0
- package/src/components/molecules/mobileBottomNavigation/index.stories.tsx +173 -0
- package/src/components/molecules/mobileBottomNavigation/index.styled.tsx +150 -0
- package/src/components/molecules/mobileBottomNavigation/index.tsx +41 -0
- package/src/components/molecules/modal/__snapshots__/index.test.tsx.snap +3 -0
- package/src/components/molecules/modal/index.stories.tsx +139 -0
- package/src/components/molecules/modal/index.styled.tsx +146 -0
- package/src/components/molecules/modal/index.test.tsx +26 -0
- package/src/components/molecules/modal/index.tsx +147 -0
- package/src/components/molecules/popup/__snapshots__/index.test.tsx.snap +102 -0
- package/src/components/molecules/popup/index.stories.tsx +21 -0
- package/src/components/molecules/popup/index.styled.tsx +90 -0
- package/src/components/molecules/popup/index.test.tsx +26 -0
- package/src/components/molecules/popup/index.tsx +45 -0
- package/src/components/molecules/progressBar/__snapshots__/index.test.tsx.snap +167 -0
- package/src/components/molecules/progressBar/index.stories.tsx +72 -0
- package/src/components/molecules/progressBar/index.styled.tsx +182 -0
- package/src/components/molecules/progressBar/index.test.tsx +75 -0
- package/src/components/molecules/progressBar/index.tsx +245 -0
- package/src/components/molecules/radioGroup/__snapshots__/index.test.tsx.snap +290 -0
- package/src/components/molecules/radioGroup/index.stories.tsx +131 -0
- package/src/components/molecules/radioGroup/index.styled.tsx +75 -0
- package/src/components/molecules/radioGroup/index.test.tsx +33 -0
- package/src/components/molecules/radioGroup/index.tsx +80 -0
- package/src/components/molecules/scrollList/index.stories.tsx +113 -0
- package/src/components/molecules/scrollList/index.styled.tsx +140 -0
- package/src/components/molecules/scrollList/index.tsx +786 -0
- package/src/components/molecules/seoHead/index.tsx +382 -0
- package/src/components/molecules/sidemenu/__snapshots__/index.test.tsx.snap +273 -0
- package/src/components/molecules/sidemenu/index.stories.tsx +156 -0
- package/src/components/molecules/sidemenu/index.test.tsx +56 -0
- package/src/components/molecules/sidemenu/index.tsx +4 -0
- package/src/components/molecules/sidemenu/menuLink.tsx +78 -0
- package/src/components/molecules/sidemenu/sideHeader.tsx +85 -0
- package/src/components/molecules/sidemenu/sideMenu.tsx +39 -0
- package/src/components/molecules/sidemenu/test.tsx +94 -0
- package/src/components/molecules/sidemenu/userInfo.tsx +44 -0
- package/src/components/molecules/starsRatingBox/index.stories.tsx +121 -0
- package/src/components/molecules/starsRatingBox/index.styled.tsx +23 -0
- package/src/components/molecules/starsRatingBox/index.tsx +83 -0
- package/src/components/molecules/statisticCard/__snapshots__/index.test.tsx.snap +86 -0
- package/src/components/molecules/statisticCard/index.stories.tsx +40 -0
- package/src/components/molecules/statisticCard/index.styled.tsx +47 -0
- package/src/components/molecules/statisticCard/index.test.tsx +44 -0
- package/src/components/molecules/statisticCard/index.tsx +48 -0
- package/src/components/molecules/surveyQuestionCard/__snapshots__/index.test.tsx.snap +743 -0
- package/src/components/molecules/surveyQuestionCard/index.stories.tsx +115 -0
- package/src/components/molecules/surveyQuestionCard/index.styled.tsx +220 -0
- package/src/components/molecules/surveyQuestionCard/index.test.tsx +53 -0
- package/src/components/molecules/surveyQuestionCard/index.tsx +2 -0
- package/src/components/molecules/surveyQuestionCard/surveyQuestionCard.tsx +213 -0
- package/src/components/molecules/surveyQuestionCard/surveyQuestionContent.tsx +200 -0
- package/src/components/molecules/surveyQuestionCard/surveyRadio.tsx +69 -0
- package/src/components/molecules/surveyQuestionCard/surveyThankyouCard.tsx +129 -0
- package/src/components/molecules/table/__snapshots__/index.test.tsx.snap +56 -0
- package/src/components/molecules/table/index.stories.tsx +264 -0
- package/src/components/molecules/table/index.test.tsx +29 -0
- package/src/components/molecules/table/index.tsx +5 -0
- package/src/components/molecules/table/table.tsx +38 -0
- package/src/components/molecules/table/tableBody.tsx +46 -0
- package/src/components/molecules/table/tableCell.tsx +47 -0
- package/src/components/molecules/table/tableHead.tsx +46 -0
- package/src/components/molecules/table/tableRow.tsx +45 -0
- package/src/components/molecules/tabs/__snapshots__/index.test.tsx.snap +104 -0
- package/src/components/molecules/tabs/index.stories.tsx +45 -0
- package/src/components/molecules/tabs/index.styled.tsx +58 -0
- package/src/components/molecules/tabs/index.test.tsx +49 -0
- package/src/components/molecules/tabs/index.tsx +89 -0
- package/src/components/organisms/footer/discoverFooter/index.styled.tsx +286 -0
- package/src/components/organisms/footer/discoverFooter/index.tsx +448 -0
- package/src/components/organisms/footer/index.stories.tsx +207 -0
- package/src/components/organisms/footer/index.tsx +70 -0
- package/src/components/organisms/footer/maryBabyFooter/index.styled.tsx +502 -0
- package/src/components/organisms/footer/maryBabyFooter/index.tsx +393 -0
- package/src/components/organisms/index.ts +31 -0
- package/src/components/organisms/navigationBookingButton/index.styled.tsx +11 -0
- package/src/components/organisms/navigationBookingButton/index.tsx +53 -0
- package/src/components/organisms/navigationLayout/CustomFooter.tsx +154 -0
- package/src/components/organisms/navigationLayout/ampSideBar/index.styled.tsx +151 -0
- package/src/components/organisms/navigationLayout/ampSideBar/index.tsx +276 -0
- package/src/components/organisms/navigationLayout/assets/check.svg +3 -0
- package/src/components/organisms/navigationLayout/assets/chevronDown.svg +3 -0
- package/src/components/organisms/navigationLayout/assets/chevronRightWhite.svg +3 -0
- package/src/components/organisms/navigationLayout/assets/chevronUpBlue.svg +3 -0
- package/src/components/organisms/navigationLayout/assets/closeLight.svg +4 -0
- package/src/components/organisms/navigationLayout/assets/closeWhite.svg +4 -0
- package/src/components/organisms/navigationLayout/assets/hamburgerMenu.svg +5 -0
- package/src/components/organisms/navigationLayout/assets/index.js +19 -0
- package/src/components/organisms/navigationLayout/assets/info-light.svg +5 -0
- package/src/components/organisms/navigationLayout/constants.ts +958 -0
- package/src/components/organisms/navigationLayout/footer/index.styled.tsx +286 -0
- package/src/components/organisms/navigationLayout/footer/index.tsx +449 -0
- package/src/components/organisms/navigationLayout/index.stories.tsx +273 -0
- package/src/components/organisms/navigationLayout/index.styled.tsx +153 -0
- package/src/components/organisms/navigationLayout/index.tsx +1272 -0
- package/src/components/organisms/navigationLayout/languageWrapper.tsx +19 -0
- package/src/components/organisms/navigationLayout/languages/default.ts +63 -0
- package/src/components/organisms/navigationLayout/layout.tsx +406 -0
- package/src/components/organisms/navigationLayout/marryBabyText/index.styled.tsx +86 -0
- package/src/components/organisms/navigationLayout/marryBabyText/index.tsx +57 -0
- package/src/components/organisms/navigationLayout/maryBabyFooter/index.styled.tsx +502 -0
- package/src/components/organisms/navigationLayout/maryBabyFooter/index.tsx +383 -0
- package/src/components/organisms/navigationLayout/menuCareList/categorySkeleton.tsx +25 -0
- package/src/components/organisms/navigationLayout/menuCareList/index.styled.tsx +156 -0
- package/src/components/organisms/navigationLayout/menuCareList/index.tsx +266 -0
- package/src/components/organisms/navigationLayout/menuCategoriesList/categorySkeleton.tsx +25 -0
- package/src/components/organisms/navigationLayout/menuCategoriesList/helloSites.tsx +419 -0
- package/src/components/organisms/navigationLayout/menuCategoriesList/index.styled.tsx +196 -0
- package/src/components/organisms/navigationLayout/menuCategoriesList/index.tsx +92 -0
- package/src/components/organisms/navigationLayout/menuCategoriesList/marryBaby.styled.tsx +151 -0
- package/src/components/organisms/navigationLayout/menuCategoriesList/marryBaby.tsx +409 -0
- package/src/components/organisms/navigationLayout/menuCategoriesList/spotlightsList/index.styled.tsx +147 -0
- package/src/components/organisms/navigationLayout/menuCategoriesList/spotlightsList/index.tsx +141 -0
- package/src/components/organisms/navigationLayout/menuCategoriesList/spotlightsList/spotlightSkeleton.tsx +25 -0
- package/src/components/organisms/navigationLayout/menuCommunitiesList/categorySkeleton.tsx +25 -0
- package/src/components/organisms/navigationLayout/menuCommunitiesList/helloSites.tsx +309 -0
- package/src/components/organisms/navigationLayout/menuCommunitiesList/index.styled.tsx +162 -0
- package/src/components/organisms/navigationLayout/menuCommunitiesList/index.tsx +80 -0
- package/src/components/organisms/navigationLayout/menuCommunitiesList/marryBaby.styled.tsx +119 -0
- package/src/components/organisms/navigationLayout/menuCommunitiesList/marryBaby.tsx +181 -0
- package/src/components/organisms/navigationLayout/menuHealthToolsList/categorySkeleton.tsx +25 -0
- package/src/components/organisms/navigationLayout/menuHealthToolsList/helloSites.tsx +364 -0
- package/src/components/organisms/navigationLayout/menuHealthToolsList/index.styled.tsx +176 -0
- package/src/components/organisms/navigationLayout/menuHealthToolsList/index.tsx +83 -0
- package/src/components/organisms/navigationLayout/menuHealthToolsList/marryBaby.tsx +166 -0
- package/src/components/organisms/navigationLayout/menuHealthToolsList/marrybaby.styled.tsx +118 -0
- package/src/components/organisms/navigationLayout/menuSectionCard/cardSkeleton.tsx +32 -0
- package/src/components/organisms/navigationLayout/menuSectionCard/index.styled.tsx +46 -0
- package/src/components/organisms/navigationLayout/menuSectionCard/index.tsx +52 -0
- package/src/components/organisms/navigationLayout/menuServiceList/categoriesSubList.tsx +121 -0
- package/src/components/organisms/navigationLayout/menuServiceList/communitySubList.tsx +143 -0
- package/src/components/organisms/navigationLayout/menuServiceList/index.styled.tsx +460 -0
- package/src/components/organisms/navigationLayout/menuServiceList/index.tsx +746 -0
- package/src/components/organisms/navigationLayout/menuServiceList/marryBabyMobileMenuSection.tsx +239 -0
- package/src/components/organisms/navigationLayout/navigationBar/ArrowLeftPopupIcon.tsx +21 -0
- package/src/components/organisms/navigationLayout/navigationBar/ClosePopupIcon.tsx +20 -0
- package/src/components/organisms/navigationLayout/navigationBar/HamburgerIcon.tsx +43 -0
- package/src/components/organisms/navigationLayout/navigationBar/NavigationBar.types.ts +99 -0
- package/src/components/organisms/navigationLayout/navigationBar/NavigationBarMobile.tsx +503 -0
- package/src/components/organisms/navigationLayout/navigationBar/SearchIcon.tsx +22 -0
- package/src/components/organisms/navigationLayout/navigationBar/index.styled.tsx +540 -0
- package/src/components/organisms/navigationLayout/navigationBar/index.tsx +798 -0
- package/src/components/organisms/navigationLayout/navigationLogoutPopup/index.styled.tsx +87 -0
- package/src/components/organisms/navigationLayout/navigationLogoutPopup/index.tsx +95 -0
- package/src/components/organisms/navigationLayout/profilePopup/index.tsx +102 -0
- package/src/components/organisms/navigationLayout/profilePopupWrapper/index.styled.tsx +164 -0
- package/src/components/organisms/navigationLayout/profilePopupWrapper/index.tsx +58 -0
- package/src/components/organisms/navigationLayout/siteWide/index.styled.tsx +116 -0
- package/src/components/organisms/navigationLayout/siteWide/index.tsx +162 -0
- package/src/components/organisms/navigationLayout/sponsoredBy/index.styled.tsx +119 -0
- package/src/components/organisms/navigationLayout/sponsoredBy/index.tsx +254 -0
- package/src/components/organisms/navigationLayout/tooltipSelection/index.styled.tsx +66 -0
- package/src/components/organisms/navigationLayout/tooltipSelection/index.tsx +81 -0
- package/src/components/organisms/navigationLayout/types.ts +322 -0
- package/src/components/organisms/navigationLayout/utils.tsx +424 -0
- package/src/components/organisms/navigationLogoutPopup/index.stories.tsx +34 -0
- package/src/components/organisms/navigationLogoutPopup/index.styled.tsx +87 -0
- package/src/components/organisms/navigationLogoutPopup/index.tsx +78 -0
- package/src/components/organisms/navigationProfileButton/index.stories.tsx +51 -0
- package/src/components/organisms/navigationProfileButton/index.styled.tsx +254 -0
- package/src/components/organisms/navigationProfileButton/index.tsx +217 -0
- package/src/components/organisms/navigationProfileButton/popupWrapper.tsx +58 -0
- package/src/components/organisms/navigationProfileButton/profilePopup.tsx +97 -0
- package/src/components/organisms/navigationV2/components/atoms/ArrowLeftPopupIcon.tsx +21 -0
- package/src/components/organisms/navigationV2/components/atoms/ClosePopupIcon.tsx +21 -0
- package/src/components/organisms/navigationV2/components/atoms/HamburgerIcon.tsx +58 -0
- package/src/components/organisms/navigationV2/components/atoms/ItemNav/index.styled.tsx +63 -0
- package/src/components/organisms/navigationV2/components/atoms/ItemNav/index.tsx +71 -0
- package/src/components/organisms/navigationV2/components/atoms/PopupWrapper/btnClosePopup.tsx +30 -0
- package/src/components/organisms/navigationV2/components/atoms/PopupWrapper/index.styled.tsx +62 -0
- package/src/components/organisms/navigationV2/components/atoms/PopupWrapper/index.tsx +45 -0
- package/src/components/organisms/navigationV2/components/atoms/SearchIcon.tsx +22 -0
- package/src/components/organisms/navigationV2/components/atoms/searchInput/index.tsx +45 -0
- package/src/components/organisms/navigationV2/components/molecules/Categories/index.styled.tsx +74 -0
- package/src/components/organisms/navigationV2/components/molecules/Categories/index.tsx +115 -0
- package/src/components/organisms/navigationV2/components/molecules/Spotlights/index.styled.tsx +40 -0
- package/src/components/organisms/navigationV2/components/molecules/Spotlights/index.tsx +60 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCareList/Item/index.styled.tsx +155 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCareList/Item/index.tsx +103 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCareList/careSpotlights.tsx +40 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCareList/index.styled.tsx +29 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCareList/index.tsx +65 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCategoriesList/Item/index.styled.tsx +46 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCategoriesList/Item/index.tsx +50 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCategoriesList/categorySpotlights.tsx +59 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCategoriesList/index.styled.tsx +30 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCategoriesList/index.tsx +64 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCommunitiesList/Item/index.styled.tsx +89 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCommunitiesList/Item/index.tsx +91 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCommunitiesList/communitySpotlights.tsx +49 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCommunitiesList/index.styled.tsx +42 -0
- package/src/components/organisms/navigationV2/components/molecules/menuCommunitiesList/index.tsx +56 -0
- package/src/components/organisms/navigationV2/components/molecules/menuHealthToolsList/Item/index.styled.tsx +104 -0
- package/src/components/organisms/navigationV2/components/molecules/menuHealthToolsList/Item/index.tsx +99 -0
- package/src/components/organisms/navigationV2/components/molecules/menuHealthToolsList/index.styled.tsx +18 -0
- package/src/components/organisms/navigationV2/components/molecules/menuHealthToolsList/index.tsx +65 -0
- package/src/components/organisms/navigationV2/components/molecules/menuHealthToolsList/toolSpotlights.tsx +41 -0
- package/src/components/organisms/navigationV2/components/molecules/menuServiceList/index.styled.tsx +358 -0
- package/src/components/organisms/navigationV2/components/molecules/menuServiceList/index.tsx +88 -0
- package/src/components/organisms/navigationV2/components/molecules/navigationBar/hamburgerMenu.tsx +74 -0
- package/src/components/organisms/navigationV2/components/molecules/navigationBar/index.styled.tsx +214 -0
- package/src/components/organisms/navigationV2/components/molecules/navigationBar/index.tsx +283 -0
- package/src/components/organisms/navigationV2/components/molecules/navigationBar/navigationProfileButtonWithContext.tsx +50 -0
- package/src/components/organisms/navigationV2/components/molecules/spotlightNoData/index.styled.tsx +70 -0
- package/src/components/organisms/navigationV2/components/molecules/spotlightNoData/index.tsx +74 -0
- package/src/components/organisms/navigationV2/constants.ts +277 -0
- package/src/components/organisms/navigationV2/hooks/useHeaderHeight.tsx +84 -0
- package/src/components/organisms/navigationV2/hooks/useInsider.tsx +67 -0
- package/src/components/organisms/navigationV2/hooks/useNavConfig.tsx +99 -0
- package/src/components/organisms/navigationV2/hooks/useNavServices.tsx +73 -0
- package/src/components/organisms/navigationV2/index.stories.tsx +287 -0
- package/src/components/organisms/navigationV2/index.styled.tsx +30 -0
- package/src/components/organisms/navigationV2/index.tsx +320 -0
- package/src/components/organisms/navigationV2/navigationContext.tsx +38 -0
- package/src/components/organisms/navigationV2/types.ts +307 -0
- package/src/components/organisms/navigationV2/utils.tsx +400 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-chevronDown.svg +3 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-chevronRight.svg +3 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-eCom.svg +22 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-helpCircle.svg +3 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-logOut.svg +3 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-myBooking.svg +36 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-myCommunity.svg +19 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-myFamily.svg +15 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-myHealth.svg +13 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-mySaved.svg +3 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-rank-ambassador.svg +4 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-rank-doctor.svg +4 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-rank-expert.svg +4 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-rank-influencer.svg +4 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-rank-member.svg +8 -0
- package/src/components/organisms/userProfileNavigation/assets/helloSites/icon-settingsWheel.svg +3 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-arrowRight.svg +3 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-lock.svg +4 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-logOut.svg +4 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-myCommunity.svg +4 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-myHealth.svg +6 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-mySaved.svg +3 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-rank-ambassador.svg +40 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-rank-doctor.svg +40 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-rank-expert.svg +27 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-rank-influencer.svg +33 -0
- package/src/components/organisms/userProfileNavigation/assets/marryBaby/icon-rank-member.svg +33 -0
- package/src/components/organisms/userProfileNavigation/constants.ts +23 -0
- package/src/components/organisms/userProfileNavigation/index.stories.tsx +79 -0
- package/src/components/organisms/userProfileNavigation/index.styled.ts +60 -0
- package/src/components/organisms/userProfileNavigation/index.tsx +219 -0
- package/src/components/organisms/userProfileNavigation/navHeader/index.styled.ts +76 -0
- package/src/components/organisms/userProfileNavigation/navHeader/index.tsx +68 -0
- package/src/components/organisms/userProfileNavigation/navMenu/index.styled.ts +115 -0
- package/src/components/organisms/userProfileNavigation/navMenu/index.tsx +79 -0
- package/src/components/organisms/userProfileNavigation/navMenu/items.ts +38 -0
- package/src/components/organisms/userProfileNavigation/navigationCard/index.styled.ts +51 -0
- package/src/components/organisms/userProfileNavigation/navigationCard/index.tsx +96 -0
- package/src/components/organisms/userProfileNavigation/types.ts +35 -0
- package/src/components/organisms/userProfileNavigation/userStats/index.styled.ts +110 -0
- package/src/components/organisms/userProfileNavigation/userStats/index.tsx +78 -0
- package/src/core.ts +7 -0
- package/src/docs/releases/getReleases.js +56 -0
- package/src/docs/releases/index.stories.mdx +9 -0
- package/src/ecom/dataFormatter/index.ts +933 -0
- package/src/ecom/dataFormatter/lib/apiTypes.ts +623 -0
- package/src/ecom/dataFormatter/lib/dataTypes.ts +571 -0
- package/src/ecom/dataFormatter/lib/utils.ts +40 -0
- package/src/ecom/index.tsx +5 -0
- package/src/ecom/interfaces/constants.ts +1000 -0
- package/src/ecom/interfaces/types.ts +194 -0
- package/src/hooks/useCSSFocusPopupHelper.ts +32 -0
- package/src/hooks/useDragScroll.ts +55 -0
- package/src/hooks/useDropdownSearch.tsx +52 -0
- package/src/hooks/useFbDataLayer.tsx +49 -0
- package/src/hooks/useGeolocation.ts +86 -0
- package/src/hooks/useGetIsMobile.ts +20 -0
- package/src/hooks/useImagesPicker.ts +56 -0
- package/src/hooks/useIsInit.ts +9 -0
- package/src/hooks/useOutsideClick.ts +20 -0
- package/src/hooks/useScreenSize.ts +35 -0
- package/src/hooks/useScrollbarSize.ts +74 -0
- package/src/hooks/useTranslations.tsx +41 -0
- package/src/i18n/en-PH.json +235 -0
- package/src/i18n/hi-IN.json +235 -0
- package/src/i18n/id-ID.json +235 -0
- package/src/i18n/index.ts +3 -0
- package/src/i18n/km-KH.json +235 -0
- package/src/i18n/ms-MY.json +235 -0
- package/src/i18n/my-MM.json +235 -0
- package/src/i18n/th-TH.json +235 -0
- package/src/i18n/tl-PH.json +235 -0
- package/src/i18n/translations.ts +47 -0
- package/src/i18n/translationsContext.ts +12 -0
- package/src/i18n/translationsProvider.tsx +66 -0
- package/src/i18n/vi-VN.json +242 -0
- package/src/i18n/zh-TW.json +235 -0
- package/src/index.ts +12 -0
- package/src/interfaces/constants.ts +402 -0
- package/src/interfaces/types.ts +85 -0
- package/src/misc/cookieHelper.tsx +31 -0
- package/src/misc/lazyLoad.ts +7 -0
- package/src/misc/mockTheme.tsx +11 -0
- package/src/misc/number.ts +24 -0
- package/src/misc/routing.tsx +45 -0
- package/src/misc/theme.ts +186 -0
- package/src/misc/utils.ts +214 -0
- package/src/test/testTranslationProvider.tsx +14 -0
- package/src/together/api/dataTransform.ts +650 -0
- package/src/together/api/paths.ts +163 -0
- package/src/together/api/utils.ts +399 -0
- package/src/together/assets/images/avatar-default.png +0 -0
- package/src/together/assets/images/icon-whatsapp.png +0 -0
- package/src/together/assets/images/icon-zalo.png +0 -0
- package/src/together/assets/marrybaby/svg/comment.svg +4 -0
- package/src/together/assets/marrybaby/svg/commentSolid.svg +5 -0
- package/src/together/assets/marrybaby/svg/commentWhite.svg +4 -0
- package/src/together/assets/marrybaby/svg/copy.svg +1 -0
- package/src/together/assets/marrybaby/svg/facebook.svg +9 -0
- package/src/together/assets/marrybaby/svg/heart.svg +4 -0
- package/src/together/assets/marrybaby/svg/heartSolid.svg +4 -0
- package/src/together/assets/marrybaby/svg/linkedin.svg +6 -0
- package/src/together/assets/marrybaby/svg/loading.svg +15 -0
- package/src/together/assets/marrybaby/svg/messenger.svg +17 -0
- package/src/together/assets/marrybaby/svg/more.svg +6 -0
- package/src/together/assets/marrybaby/svg/moreSolid.svg +6 -0
- package/src/together/assets/marrybaby/svg/pin.svg +6 -0
- package/src/together/assets/marrybaby/svg/pinOrange.svg +6 -0
- package/src/together/assets/marrybaby/svg/share.svg +5 -0
- package/src/together/assets/marrybaby/svg/share2.svg +5 -0
- package/src/together/assets/marrybaby/svg/sortBy.svg +5 -0
- package/src/together/assets/marrybaby/svg/twitter.svg +4 -0
- package/src/together/assets/marrybaby/svg/zalo.png +0 -0
- package/src/together/assets/svg/bullet-point.svg +3 -0
- package/src/together/assets/svg/chevronRightActive.svg +3 -0
- package/src/together/assets/svg/close-circle-line.svg +5 -0
- package/src/together/assets/svg/closeLight copy.svg +4 -0
- package/src/together/assets/svg/closeLight.svg +4 -0
- package/src/together/assets/svg/delete.svg +13 -0
- package/src/together/assets/svg/icon-alert-circle-primary.svg +5 -0
- package/src/together/assets/svg/icon-alert-circle-warning.svg +5 -0
- package/src/together/assets/svg/icon-alert-circle.svg +5 -0
- package/src/together/assets/svg/icon-arrow-circle-upgrade.svg +3 -0
- package/src/together/assets/svg/icon-arrow-left.svg +4 -0
- package/src/together/assets/svg/icon-arrow-right-circle.svg +5 -0
- package/src/together/assets/svg/icon-bell-off.svg +7 -0
- package/src/together/assets/svg/icon-bell-on.svg +4 -0
- package/src/together/assets/svg/icon-bookmark-fill.svg +3 -0
- package/src/together/assets/svg/icon-bookmark.svg +3 -0
- package/src/together/assets/svg/icon-cancel.svg +13 -0
- package/src/together/assets/svg/icon-check-gray.svg +3 -0
- package/src/together/assets/svg/icon-check-pink.svg +3 -0
- package/src/together/assets/svg/icon-check-success.svg +4 -0
- package/src/together/assets/svg/icon-check.svg +4 -0
- package/src/together/assets/svg/icon-chevron-left-dark.svg +3 -0
- package/src/together/assets/svg/icon-chevron-right-dark.svg +3 -0
- package/src/together/assets/svg/icon-chevron-right-white.svg +3 -0
- package/src/together/assets/svg/icon-chevron-right.svg +3 -0
- package/src/together/assets/svg/icon-close-circle-line.svg +5 -0
- package/src/together/assets/svg/icon-close-circle.svg +5 -0
- package/src/together/assets/svg/icon-close.svg +4 -0
- package/src/together/assets/svg/icon-edit.svg +3 -0
- package/src/together/assets/svg/icon-enter.svg +4 -0
- package/src/together/assets/svg/icon-facebook.svg +3 -0
- package/src/together/assets/svg/icon-heart-empty.svg +3 -0
- package/src/together/assets/svg/icon-heart-fill-red.svg +3 -0
- package/src/together/assets/svg/icon-heart-fill.svg +3 -0
- package/src/together/assets/svg/icon-kebab.svg +5 -0
- package/src/together/assets/svg/icon-link.svg +4 -0
- package/src/together/assets/svg/icon-linkedin.svg +4 -0
- package/src/together/assets/svg/icon-pin-gray.svg +4 -0
- package/src/together/assets/svg/icon-pin-yellow.svg +4 -0
- package/src/together/assets/svg/icon-pin.svg +4 -0
- package/src/together/assets/svg/icon-reply-arrow.svg +3 -0
- package/src/together/assets/svg/icon-reply-circle-empty.svg +3 -0
- package/src/together/assets/svg/icon-reply-circle-fill.svg +3 -0
- package/src/together/assets/svg/icon-share-on-media.svg +7 -0
- package/src/together/assets/svg/icon-sort-arrow.svg +4 -0
- package/src/together/assets/svg/icon-tab-edit-2.svg +4 -0
- package/src/together/assets/svg/icon-tab-edit-primary.svg +4 -0
- package/src/together/assets/svg/icon-trash-bin.svg +6 -0
- package/src/together/assets/svg/icon-twitter.svg +4 -0
- package/src/together/assets/svg/loading.svg +7 -0
- package/src/together/assets/svg/reviewer-author.svg +12 -0
- package/src/together/assets/svg/reviewer-editor.svg +12 -0
- package/src/together/assets/svg/reviewer-expert.svg +5 -0
- package/src/together/assets/svg/reviewer-fact-check.svg +4 -0
- package/src/together/assets/svg/reviewer-medical.svg +4 -0
- package/src/together/components/atoms/cardLink/index.styled.tsx +64 -0
- package/src/together/components/atoms/cardLink/index.tsx +149 -0
- package/src/together/components/atoms/cardReactions/index.styled.tsx +96 -0
- package/src/together/components/atoms/cardReactions/index.tsx +221 -0
- package/src/together/components/atoms/index.tsx +8 -0
- package/src/together/components/atoms/labelSortPin/index.styled.tsx +78 -0
- package/src/together/components/atoms/labelSortPin/index.tsx +50 -0
- package/src/together/components/atoms/labelSortPin/labelPin.tsx +47 -0
- package/src/together/components/atoms/labelSortPin/labelSorting.tsx +127 -0
- package/src/together/components/atoms/loading/index.styled.tsx +42 -0
- package/src/together/components/atoms/loading/index.tsx +25 -0
- package/src/together/components/atoms/loading/loadingCard.tsx +38 -0
- package/src/together/components/atoms/tagTopic/index.styled.tsx +33 -0
- package/src/together/components/atoms/tagTopic/index.tsx +57 -0
- package/src/together/components/atoms/userAvatar/index.styled.tsx +39 -0
- package/src/together/components/atoms/userAvatar/index.tsx +62 -0
- package/src/together/components/molecules/cardAuthor/customMMLocale/formatDistance.ts +112 -0
- package/src/together/components/molecules/cardAuthor/customMMLocale/index.ts +16 -0
- package/src/together/components/molecules/cardAuthor/customMMLocale/types.ts +37 -0
- package/src/together/components/molecules/cardAuthor/index.styled.tsx +164 -0
- package/src/together/components/molecules/cardAuthor/index.tsx +314 -0
- package/src/together/components/molecules/createNewPostContent/index.stories.tsx +114 -0
- package/src/together/components/molecules/createNewPostContent/index.styled.tsx +73 -0
- package/src/together/components/molecules/createNewPostContent/index.tsx +351 -0
- package/src/together/components/molecules/createPostDescription/editor.tsx +915 -0
- package/src/together/components/molecules/createPostDescription/index.styled.tsx +328 -0
- package/src/together/components/molecules/createPostDescription/index.tsx +163 -0
- package/src/together/components/molecules/createPostTitle/index.styled.tsx +62 -0
- package/src/together/components/molecules/createPostTitle/index.tsx +133 -0
- package/src/together/components/molecules/index.tsx +18 -0
- package/src/together/components/molecules/inputCommentBar/index.styled.tsx +227 -0
- package/src/together/components/molecules/inputCommentBar/index.tsx +341 -0
- package/src/together/components/molecules/inputCommentBar/mainInputTriggerContext.tsx +26 -0
- package/src/together/components/molecules/popupDanger/index.styled.tsx +174 -0
- package/src/together/components/molecules/popupDanger/index.tsx +113 -0
- package/src/together/components/molecules/popupDoctor/index.styled.tsx +185 -0
- package/src/together/components/molecules/popupDoctor/index.tsx +271 -0
- package/src/together/components/molecules/popupExpert/index.styled.tsx +175 -0
- package/src/together/components/molecules/popupExpert/index.tsx +216 -0
- package/src/together/components/molecules/popupFrame/index.styled.tsx +76 -0
- package/src/together/components/molecules/popupFrame/index.tsx +43 -0
- package/src/together/components/molecules/popupFrame/popupShare.tsx +178 -0
- package/src/together/components/molecules/popupHospital/index.styled.tsx +173 -0
- package/src/together/components/molecules/popupHospital/index.tsx +249 -0
- package/src/together/components/molecules/postContent/index.styled.tsx +66 -0
- package/src/together/components/molecules/postContent/index.tsx +125 -0
- package/src/together/components/molecules/postImagePreview/imagePreviewPopup.tsx +73 -0
- package/src/together/components/molecules/postImagePreview/index.styled.tsx +154 -0
- package/src/together/components/molecules/postImagePreview/index.tsx +115 -0
- package/src/together/components/molecules/postImagePreview/postSingleImageViewPopup/index.styled.tsx +84 -0
- package/src/together/components/molecules/postImagePreview/postSingleImageViewPopup/index.tsx +83 -0
- package/src/together/components/molecules/shareBox/index.stories.tsx +36 -0
- package/src/together/components/molecules/shareBox/index.styled.tsx +141 -0
- package/src/together/components/molecules/shareBox/index.tsx +188 -0
- package/src/together/components/molecules/socialLinkPreview/index.styled.tsx +39 -0
- package/src/together/components/molecules/socialLinkPreview/index.tsx +206 -0
- package/src/together/components/molecules/submitReportForm/index.styled.tsx +34 -0
- package/src/together/components/molecules/submitReportForm/index.tsx +84 -0
- package/src/together/components/molecules/topicSelectList/index.stories.tsx +93 -0
- package/src/together/components/molecules/topicSelectList/index.styled.tsx +53 -0
- package/src/together/components/molecules/topicSelectList/index.tsx +186 -0
- package/src/together/components/organisms/cardPost/cardPostPopover.tsx +293 -0
- package/src/together/components/organisms/cardPost/index.stories.tsx +212 -0
- package/src/together/components/organisms/cardPost/index.styled.tsx +181 -0
- package/src/together/components/organisms/cardPost/index.tsx +458 -0
- package/src/together/components/organisms/cardReply/cardReplyPopover.tsx +122 -0
- package/src/together/components/organisms/cardReply/index.styled.tsx +199 -0
- package/src/together/components/organisms/cardReply/index.tsx +362 -0
- package/src/together/components/organisms/index.tsx +5 -0
- package/src/together/components/organisms/popoverMenu/index.styled.tsx +313 -0
- package/src/together/components/organisms/popoverMenu/index.tsx +102 -0
- package/src/together/components/organisms/popoverMenu/treePopoverMenu.tsx +156 -0
- package/src/together/hooks/useTogetherAuthRequiredAction.tsx +124 -0
- package/src/together/index.ts +12 -0
- package/src/together/interfaces/constants.ts +306 -0
- package/src/together/interfaces/types.ts +1418 -0
- package/src/together/togetherComponentGlobalContext.tsx +150 -0
- package/src/together/utils/apiActions/comment.tsx +168 -0
- package/src/together/utils/apiActions/community.ts +59 -0
- package/src/together/utils/apiActions/post.ts +234 -0
- package/src/together/utils/apiActions/topic.ts +40 -0
- package/src/together/utils/notification.ts +20 -0
- package/src/together/utils/post.ts +351 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React, { createContext, ReactNode, useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { LocaleType } from 'interfaces/types'
|
|
4
|
+
|
|
5
|
+
import { PATHS } from './api/paths'
|
|
6
|
+
import { callApiWithAuth, getApiPath } from './api/utils'
|
|
7
|
+
|
|
8
|
+
export type Role = 'user' | 'admin'
|
|
9
|
+
|
|
10
|
+
export type UserInfo = {
|
|
11
|
+
name?: string
|
|
12
|
+
url?: string
|
|
13
|
+
phone?: string
|
|
14
|
+
username?: string
|
|
15
|
+
avatar?: string
|
|
16
|
+
email?: string
|
|
17
|
+
phone_verified?: boolean
|
|
18
|
+
birthday?: string
|
|
19
|
+
gender?: number
|
|
20
|
+
id?: number
|
|
21
|
+
total_bookmark?: number
|
|
22
|
+
bookmarks?: Array<string | number>
|
|
23
|
+
postCount?: number
|
|
24
|
+
role?: Role
|
|
25
|
+
commentCount?: number
|
|
26
|
+
communities_interacted?: number
|
|
27
|
+
partnerId?: string
|
|
28
|
+
first_time_bookmark?: boolean
|
|
29
|
+
provider?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type PushNotificationPayloadType = {
|
|
33
|
+
message: string
|
|
34
|
+
type: 'success' | 'danger' | 'info' | 'warning'
|
|
35
|
+
title?: string
|
|
36
|
+
displayIcon?: string
|
|
37
|
+
}
|
|
38
|
+
export type TogetherComponentGlobalContextType = {
|
|
39
|
+
data: {
|
|
40
|
+
locale?: LocaleType
|
|
41
|
+
userInfo?: UserInfo
|
|
42
|
+
togetherUserId?: number
|
|
43
|
+
env?: {
|
|
44
|
+
isMarryBaby?: boolean
|
|
45
|
+
togetherBasePath?: string
|
|
46
|
+
publicSSO?: string
|
|
47
|
+
togetherBaseApiUrl?: string
|
|
48
|
+
subotApiUrl?: string
|
|
49
|
+
discoverBaseApiUrl?: string
|
|
50
|
+
careBaseApiUrl?: string
|
|
51
|
+
}
|
|
52
|
+
router?: {
|
|
53
|
+
asPath?: string
|
|
54
|
+
basePath?: string
|
|
55
|
+
query?: NodeJS.Dict<string | string[]>
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
action: {
|
|
59
|
+
pushNotifications?: (payload: PushNotificationPayloadType) => void
|
|
60
|
+
sanitizeFunction?: (h: string) => string
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export const DefaultComponentGlobalContextData: TogetherComponentGlobalContextType['data'] =
|
|
64
|
+
{
|
|
65
|
+
locale: 'vi-VN' as LocaleType,
|
|
66
|
+
env: {
|
|
67
|
+
isMarryBaby: false,
|
|
68
|
+
togetherBasePath: '/community',
|
|
69
|
+
},
|
|
70
|
+
router: {
|
|
71
|
+
basePath: '',
|
|
72
|
+
asPath: '/',
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const TogetherComponentGlobalContext =
|
|
77
|
+
createContext<TogetherComponentGlobalContextType>({
|
|
78
|
+
data: DefaultComponentGlobalContextData,
|
|
79
|
+
action: {
|
|
80
|
+
pushNotifications: (s) => s,
|
|
81
|
+
sanitizeFunction: (s) => s,
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
export let GlobalData: TogetherComponentGlobalContextType['data'] =
|
|
86
|
+
DefaultComponentGlobalContextData
|
|
87
|
+
|
|
88
|
+
export type Props = {
|
|
89
|
+
userInfo?: UserInfo
|
|
90
|
+
locale?: LocaleType
|
|
91
|
+
children?: ReactNode
|
|
92
|
+
translation?: { [key: string]: string }
|
|
93
|
+
router?: any
|
|
94
|
+
pushNotifications?: (payload: PushNotificationPayloadType) => void
|
|
95
|
+
sanitizeFunction?: (h: string) => string
|
|
96
|
+
env?: TogetherComponentGlobalContextType['data']['env']
|
|
97
|
+
}
|
|
98
|
+
export const TogetherComponentGlobalContextProvider = ({
|
|
99
|
+
locale = 'vi-VN',
|
|
100
|
+
children,
|
|
101
|
+
userInfo,
|
|
102
|
+
router,
|
|
103
|
+
env = {
|
|
104
|
+
isMarryBaby: false,
|
|
105
|
+
togetherBasePath: '/community',
|
|
106
|
+
},
|
|
107
|
+
sanitizeFunction = (s) => s,
|
|
108
|
+
pushNotifications = () => false,
|
|
109
|
+
}: Props) => {
|
|
110
|
+
const [togetherUserId, setTogetherUserId] = useState()
|
|
111
|
+
|
|
112
|
+
GlobalData = {
|
|
113
|
+
userInfo,
|
|
114
|
+
locale,
|
|
115
|
+
togetherUserId,
|
|
116
|
+
router,
|
|
117
|
+
env,
|
|
118
|
+
}
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (userInfo?.id) {
|
|
121
|
+
callApiWithAuth(
|
|
122
|
+
getApiPath(PATHS.PROFILE, {
|
|
123
|
+
_locale: locale,
|
|
124
|
+
}),
|
|
125
|
+
'GET',
|
|
126
|
+
).then((res) => {
|
|
127
|
+
setTogetherUserId(res?.data?.id)
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
}, [userInfo?.id])
|
|
131
|
+
return (
|
|
132
|
+
<TogetherComponentGlobalContext.Provider
|
|
133
|
+
value={{
|
|
134
|
+
data: {
|
|
135
|
+
userInfo,
|
|
136
|
+
locale,
|
|
137
|
+
togetherUserId,
|
|
138
|
+
router,
|
|
139
|
+
env,
|
|
140
|
+
},
|
|
141
|
+
action: {
|
|
142
|
+
pushNotifications,
|
|
143
|
+
sanitizeFunction,
|
|
144
|
+
},
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
{children}
|
|
148
|
+
</TogetherComponentGlobalContext.Provider>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { MAX_IMAGE_UPLOADS } from 'together/interfaces/constants'
|
|
2
|
+
|
|
3
|
+
import { PATHS } from '../../api/paths'
|
|
4
|
+
import { callApiWithAuth, getApiPath } from '../../api/utils'
|
|
5
|
+
import {
|
|
6
|
+
encodePostContent,
|
|
7
|
+
getMentionIdsFromString,
|
|
8
|
+
uploadAndGetSrc,
|
|
9
|
+
} from '../post'
|
|
10
|
+
|
|
11
|
+
export const BANNED_STATUS = ['SYSTEM_WITHHELD', 'PREMOD', 'REJECTED']
|
|
12
|
+
export const BANNED_MESSAGE_INTL_ID: { [key: string]: string } = {
|
|
13
|
+
SYSTEM_WITHHELD: 'notification.comment.systemWithheld',
|
|
14
|
+
PREMOD: 'notification.comment.premod',
|
|
15
|
+
REJECTED: 'notification.comment.rejected',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const getCommentFormBody = async ({
|
|
19
|
+
postId,
|
|
20
|
+
message,
|
|
21
|
+
photos,
|
|
22
|
+
link,
|
|
23
|
+
locale,
|
|
24
|
+
sanitizeFunction,
|
|
25
|
+
|
|
26
|
+
replyingUserId,
|
|
27
|
+
replyingUserName,
|
|
28
|
+
replyingId,
|
|
29
|
+
}: {
|
|
30
|
+
locale: string
|
|
31
|
+
postId: string
|
|
32
|
+
message: string
|
|
33
|
+
photos?: File[]
|
|
34
|
+
link?: string
|
|
35
|
+
sanitizeFunction?: (text: string) => string
|
|
36
|
+
|
|
37
|
+
replyingId?: string
|
|
38
|
+
replyingUserId?: string
|
|
39
|
+
replyingUserName?: string
|
|
40
|
+
}) => {
|
|
41
|
+
const formData = new FormData()
|
|
42
|
+
let submitText = encodePostContent(
|
|
43
|
+
message.replace(/(\ )+/g, ' '),
|
|
44
|
+
sanitizeFunction,
|
|
45
|
+
)
|
|
46
|
+
const mentionIds = getMentionIdsFromString(submitText)
|
|
47
|
+
if (photos && photos.length > 0) {
|
|
48
|
+
const imageSrcs = await Promise.all(
|
|
49
|
+
photos?.map((file) => uploadAndGetSrc(file, locale)),
|
|
50
|
+
)
|
|
51
|
+
imageSrcs
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.slice(0, MAX_IMAGE_UPLOADS)
|
|
54
|
+
.forEach((photo) => {
|
|
55
|
+
formData.append('images[]', photo)
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
if (link) formData.append('link', link)
|
|
59
|
+
mentionIds?.forEach((mentionId) => {
|
|
60
|
+
formData.append(`mention_ids[]`, mentionId)
|
|
61
|
+
})
|
|
62
|
+
formData.append('post_id', postId)
|
|
63
|
+
|
|
64
|
+
replyingId && formData.append('parent_id', replyingId)
|
|
65
|
+
if (replyingUserId) {
|
|
66
|
+
mentionIds.unshift(replyingUserId)
|
|
67
|
+
submitText = `[mention+id="${replyingUserId}"+name="${(
|
|
68
|
+
replyingUserName || ''
|
|
69
|
+
).replace('"', "'")}"]${submitText}`
|
|
70
|
+
formData.append('parent_user_id', String(replyingUserId))
|
|
71
|
+
}
|
|
72
|
+
formData.append('content', submitText)
|
|
73
|
+
formData.append('content', submitText)
|
|
74
|
+
|
|
75
|
+
return formData
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const submitComment = async (
|
|
79
|
+
formData: FormData,
|
|
80
|
+
locale: string,
|
|
81
|
+
): Promise<any | null> => {
|
|
82
|
+
return callApiWithAuth(
|
|
83
|
+
getApiPath(PATHS.COMMENT.CREATE, {
|
|
84
|
+
_locale: locale,
|
|
85
|
+
}),
|
|
86
|
+
'POST',
|
|
87
|
+
{
|
|
88
|
+
data: formData,
|
|
89
|
+
headers: {
|
|
90
|
+
'Content-Type': 'multipart/form-data',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type CommentBodyData = {
|
|
97
|
+
text: string
|
|
98
|
+
replyingTo?: string
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const decodeCommentBody = (s: string): CommentBodyData => {
|
|
102
|
+
try {
|
|
103
|
+
const authorRegex = s.match(/\[@([^\]]+)\]/)
|
|
104
|
+
const replyingTo = authorRegex
|
|
105
|
+
? authorRegex[0].replace('[@', '').replace(']', '')
|
|
106
|
+
: ''
|
|
107
|
+
const text = s.replace(/\[@([^\]]+)\]/, '')
|
|
108
|
+
return {
|
|
109
|
+
text: text.trim(),
|
|
110
|
+
replyingTo,
|
|
111
|
+
}
|
|
112
|
+
} catch (e) {}
|
|
113
|
+
return {
|
|
114
|
+
text: '',
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const submitReply = async (
|
|
119
|
+
formData: FormData,
|
|
120
|
+
locale: string,
|
|
121
|
+
): Promise<any | null> => {
|
|
122
|
+
return callApiWithAuth(
|
|
123
|
+
getApiPath(PATHS.COMMENT.REPLY, {
|
|
124
|
+
_locale: locale,
|
|
125
|
+
}),
|
|
126
|
+
'POST',
|
|
127
|
+
{
|
|
128
|
+
data: formData,
|
|
129
|
+
headers: {
|
|
130
|
+
'Content-Type': 'multipart/form-data',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const likeUnlikeComment = async ({
|
|
137
|
+
commentId,
|
|
138
|
+
setLike = false,
|
|
139
|
+
locale,
|
|
140
|
+
}: {
|
|
141
|
+
commentId: string
|
|
142
|
+
setLike?: boolean
|
|
143
|
+
locale: string
|
|
144
|
+
}) => {
|
|
145
|
+
return callApiWithAuth(
|
|
146
|
+
getApiPath(setLike ? PATHS.COMMENT.LIKE : PATHS.COMMENT.UNLIKE, {
|
|
147
|
+
_locale: locale,
|
|
148
|
+
id: commentId,
|
|
149
|
+
}),
|
|
150
|
+
'GET',
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const deleteComment = ({
|
|
155
|
+
id,
|
|
156
|
+
locale,
|
|
157
|
+
}: {
|
|
158
|
+
id: string
|
|
159
|
+
locale: string
|
|
160
|
+
}) => {
|
|
161
|
+
return callApiWithAuth(
|
|
162
|
+
getApiPath(PATHS.COMMENT.DELETE, {
|
|
163
|
+
_locale: locale,
|
|
164
|
+
id: id,
|
|
165
|
+
}),
|
|
166
|
+
'DELETE',
|
|
167
|
+
)
|
|
168
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { formatTopic } from '../../api/dataTransform'
|
|
2
|
+
import { PATHS } from '../../api/paths'
|
|
3
|
+
import { callApiWithAuth, getApiPath } from '../../api/utils'
|
|
4
|
+
import { TopicApi } from '../../interfaces/types'
|
|
5
|
+
import { joinLeaveTopic } from './topic'
|
|
6
|
+
|
|
7
|
+
export const joinLeaveCommunity = async ({
|
|
8
|
+
ids,
|
|
9
|
+
isJoin,
|
|
10
|
+
locale,
|
|
11
|
+
cookie,
|
|
12
|
+
}: {
|
|
13
|
+
ids: string[]
|
|
14
|
+
isJoin?: boolean
|
|
15
|
+
locale: string
|
|
16
|
+
cookie?: string
|
|
17
|
+
}) => {
|
|
18
|
+
if (!ids || ids.length === 0) return
|
|
19
|
+
const res = await callApiWithAuth(
|
|
20
|
+
getApiPath(isJoin ? PATHS.COMMUNITY.JOIN : PATHS.COMMUNITY.LEAVE, {
|
|
21
|
+
_locale: locale,
|
|
22
|
+
}),
|
|
23
|
+
'POST',
|
|
24
|
+
{
|
|
25
|
+
data: {
|
|
26
|
+
ids,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
cookie,
|
|
30
|
+
)
|
|
31
|
+
if (res?.status === 1) {
|
|
32
|
+
if (!isJoin) {
|
|
33
|
+
ids.forEach(async (id) => {
|
|
34
|
+
// if left then remove from all topic as well
|
|
35
|
+
const topicsRes = await callApiWithAuth(
|
|
36
|
+
getApiPath(PATHS.TOPIC.LIST, {
|
|
37
|
+
communityId: id,
|
|
38
|
+
_locale: locale,
|
|
39
|
+
}),
|
|
40
|
+
'GET',
|
|
41
|
+
{},
|
|
42
|
+
cookie,
|
|
43
|
+
)
|
|
44
|
+
if (topicsRes?.data?.topics?.length) {
|
|
45
|
+
const topics = (topicsRes.data.topics as TopicApi[]).map(formatTopic)
|
|
46
|
+
await joinLeaveTopic({
|
|
47
|
+
ids: topics
|
|
48
|
+
.filter((t) => t.joined && t.id)
|
|
49
|
+
.map((t) => String(t.id)),
|
|
50
|
+
isJoin: false,
|
|
51
|
+
locale,
|
|
52
|
+
cookie,
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return res
|
|
59
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { MAX_IMAGE_UPLOADS } from 'together/interfaces/constants'
|
|
2
|
+
|
|
3
|
+
import { PATHS } from '../../api/paths'
|
|
4
|
+
import { callApiWithAuth, getApiPath } from '../../api/utils'
|
|
5
|
+
import {
|
|
6
|
+
encodePostContent,
|
|
7
|
+
getMentionIdsFromString,
|
|
8
|
+
removeBannedWordWrapper,
|
|
9
|
+
uploadAndGetSrc,
|
|
10
|
+
} from '../post'
|
|
11
|
+
|
|
12
|
+
export const likeUnlikePost = async ({
|
|
13
|
+
id,
|
|
14
|
+
locale,
|
|
15
|
+
}: {
|
|
16
|
+
id: number | string
|
|
17
|
+
locale: string
|
|
18
|
+
}) => {
|
|
19
|
+
if (!id) return
|
|
20
|
+
const res = await callApiWithAuth(
|
|
21
|
+
getApiPath(PATHS.POST.LIKE, {
|
|
22
|
+
id,
|
|
23
|
+
_locale: locale,
|
|
24
|
+
}),
|
|
25
|
+
'GET',
|
|
26
|
+
)
|
|
27
|
+
return res
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const deletePost = async ({
|
|
31
|
+
id,
|
|
32
|
+
locale,
|
|
33
|
+
}: {
|
|
34
|
+
id: number | string
|
|
35
|
+
locale: string
|
|
36
|
+
}) => {
|
|
37
|
+
if (!id) return
|
|
38
|
+
const res = await callApiWithAuth(
|
|
39
|
+
getApiPath(PATHS.POST.DELETE, {
|
|
40
|
+
id,
|
|
41
|
+
_locale: locale,
|
|
42
|
+
}),
|
|
43
|
+
'DELETE',
|
|
44
|
+
)
|
|
45
|
+
return res
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const getPostFormData = async ({
|
|
49
|
+
title,
|
|
50
|
+
description,
|
|
51
|
+
communityId,
|
|
52
|
+
imageFiles,
|
|
53
|
+
previewUrl,
|
|
54
|
+
topicIds,
|
|
55
|
+
locale,
|
|
56
|
+
sanitizeFunction,
|
|
57
|
+
categoryCommunityId,
|
|
58
|
+
categoryTopicIds,
|
|
59
|
+
|
|
60
|
+
// admin only
|
|
61
|
+
introUrl,
|
|
62
|
+
bannerUrl,
|
|
63
|
+
scheduleTime,
|
|
64
|
+
}: {
|
|
65
|
+
title: string
|
|
66
|
+
description: string
|
|
67
|
+
communityId?: string
|
|
68
|
+
categoryCommunityId?: string
|
|
69
|
+
imageFiles?: (string | File)[]
|
|
70
|
+
previewUrl?: {
|
|
71
|
+
title?: string
|
|
72
|
+
description?: string
|
|
73
|
+
url?: string
|
|
74
|
+
image?: string
|
|
75
|
+
}
|
|
76
|
+
topicIds?: string[]
|
|
77
|
+
categoryTopicIds?: string[]
|
|
78
|
+
locale: string
|
|
79
|
+
sanitizeFunction?: (h: string) => string
|
|
80
|
+
// admin only
|
|
81
|
+
introUrl?: string
|
|
82
|
+
bannerUrl?: string | File
|
|
83
|
+
scheduleTime?: string
|
|
84
|
+
}) => {
|
|
85
|
+
const bodyFormData = new FormData()
|
|
86
|
+
const submitDescription = removeBannedWordWrapper(description)
|
|
87
|
+
const submitTitle = removeBannedWordWrapper(title)
|
|
88
|
+
const mentionIds = getMentionIdsFromString(submitDescription)
|
|
89
|
+
|
|
90
|
+
bodyFormData.append('title', submitTitle)
|
|
91
|
+
bodyFormData.append(
|
|
92
|
+
'description',
|
|
93
|
+
encodePostContent(submitDescription, sanitizeFunction),
|
|
94
|
+
)
|
|
95
|
+
if (categoryCommunityId) {
|
|
96
|
+
bodyFormData.append('category_community', String(categoryCommunityId))
|
|
97
|
+
} else if (communityId) {
|
|
98
|
+
bodyFormData.append('community_id', String(communityId))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
previewUrl?.title && bodyFormData.append('preview_title', previewUrl.title)
|
|
102
|
+
previewUrl?.description &&
|
|
103
|
+
bodyFormData.append('preview_description', previewUrl.description)
|
|
104
|
+
previewUrl?.url && bodyFormData.append('preview_link', previewUrl.url)
|
|
105
|
+
previewUrl?.image && bodyFormData.append('preview_image', previewUrl.image)
|
|
106
|
+
|
|
107
|
+
topicIds?.forEach((topicId) => {
|
|
108
|
+
bodyFormData.append('topics[]', String(topicId || ''))
|
|
109
|
+
})
|
|
110
|
+
categoryTopicIds?.forEach((topicId) => {
|
|
111
|
+
bodyFormData.append('category_topics[]', String(topicId || ''))
|
|
112
|
+
})
|
|
113
|
+
if (!!imageFiles?.length) {
|
|
114
|
+
const imageSrcs = await Promise.all(
|
|
115
|
+
imageFiles.map(
|
|
116
|
+
(file, index) =>
|
|
117
|
+
new Promise<string>((resolve) => {
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
resolve(uploadAndGetSrc(file, locale))
|
|
120
|
+
}, index * 2000)
|
|
121
|
+
}),
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
imageSrcs
|
|
125
|
+
?.filter(Boolean)
|
|
126
|
+
.slice(0, MAX_IMAGE_UPLOADS)
|
|
127
|
+
.forEach((imageFile, index) => {
|
|
128
|
+
bodyFormData.append(`images[${index}]`, imageFile)
|
|
129
|
+
})
|
|
130
|
+
} else {
|
|
131
|
+
bodyFormData.append(`images`, '')
|
|
132
|
+
}
|
|
133
|
+
mentionIds?.forEach((mentionId) => {
|
|
134
|
+
bodyFormData.append(`mention_ids[]`, mentionId)
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
// Admin only
|
|
138
|
+
bodyFormData.append('intro_url', introUrl || '')
|
|
139
|
+
bodyFormData.append('banner', bannerUrl || '')
|
|
140
|
+
if (scheduleTime) {
|
|
141
|
+
bodyFormData.append('post_type', 'scheduled')
|
|
142
|
+
bodyFormData.append('schedule_datetime', scheduleTime)
|
|
143
|
+
}
|
|
144
|
+
return bodyFormData
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const createPost = async ({
|
|
148
|
+
locale,
|
|
149
|
+
formData,
|
|
150
|
+
isArticleComment,
|
|
151
|
+
}: {
|
|
152
|
+
locale: string
|
|
153
|
+
formData: FormData
|
|
154
|
+
isArticleComment?: boolean
|
|
155
|
+
}) => {
|
|
156
|
+
const res = await callApiWithAuth(
|
|
157
|
+
getApiPath(
|
|
158
|
+
isArticleComment ? PATHS.POST.CREATE_ARTICLE_COMMENT : PATHS.POST.CREATE,
|
|
159
|
+
{
|
|
160
|
+
_locale: locale,
|
|
161
|
+
},
|
|
162
|
+
),
|
|
163
|
+
'POST',
|
|
164
|
+
{
|
|
165
|
+
data: formData,
|
|
166
|
+
headers: {
|
|
167
|
+
'Content-Type': 'multipart/form-data',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
)
|
|
171
|
+
return res
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export const editPost = async ({
|
|
175
|
+
id,
|
|
176
|
+
locale,
|
|
177
|
+
formData,
|
|
178
|
+
}: {
|
|
179
|
+
id: number | string
|
|
180
|
+
locale: string
|
|
181
|
+
formData: FormData
|
|
182
|
+
}) => {
|
|
183
|
+
const res = await callApiWithAuth(
|
|
184
|
+
getApiPath(PATHS.POST.UPDATE, {
|
|
185
|
+
id,
|
|
186
|
+
_locale: locale,
|
|
187
|
+
}),
|
|
188
|
+
'POST',
|
|
189
|
+
{
|
|
190
|
+
data: formData,
|
|
191
|
+
},
|
|
192
|
+
)
|
|
193
|
+
return res
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export const followUnfollowPost = ({
|
|
197
|
+
id,
|
|
198
|
+
locale,
|
|
199
|
+
}: {
|
|
200
|
+
id: number | string
|
|
201
|
+
locale: string
|
|
202
|
+
followValue?: boolean
|
|
203
|
+
}) => {
|
|
204
|
+
return callApiWithAuth(
|
|
205
|
+
getApiPath(PATHS.POST.FOLLOW, {
|
|
206
|
+
id,
|
|
207
|
+
_locale: locale,
|
|
208
|
+
}),
|
|
209
|
+
'GET',
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export const reportPost = ({
|
|
214
|
+
id,
|
|
215
|
+
reason,
|
|
216
|
+
locale,
|
|
217
|
+
}: {
|
|
218
|
+
id: number | string
|
|
219
|
+
reason: string
|
|
220
|
+
locale: string
|
|
221
|
+
}) => {
|
|
222
|
+
const formData = new FormData()
|
|
223
|
+
formData.append('reason', reason)
|
|
224
|
+
return callApiWithAuth(
|
|
225
|
+
getApiPath(PATHS.POST.REPORT, {
|
|
226
|
+
_locale: locale,
|
|
227
|
+
id,
|
|
228
|
+
}),
|
|
229
|
+
'POST',
|
|
230
|
+
{
|
|
231
|
+
data: formData,
|
|
232
|
+
},
|
|
233
|
+
)
|
|
234
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PATHS } from '../../api/paths'
|
|
2
|
+
import { callApiWithAuth, getApiPath } from '../../api/utils'
|
|
3
|
+
import { joinLeaveCommunity } from './community'
|
|
4
|
+
|
|
5
|
+
export const joinLeaveTopic = async ({
|
|
6
|
+
ids,
|
|
7
|
+
communityIds,
|
|
8
|
+
isJoin,
|
|
9
|
+
locale,
|
|
10
|
+
cookie,
|
|
11
|
+
}: {
|
|
12
|
+
ids: string[]
|
|
13
|
+
communityIds?: string[]
|
|
14
|
+
isJoin?: boolean
|
|
15
|
+
locale: string
|
|
16
|
+
cookie?: string
|
|
17
|
+
}): Promise<any> => {
|
|
18
|
+
if (!ids || ids.length === 0) return
|
|
19
|
+
if (isJoin && communityIds?.length) {
|
|
20
|
+
const communityJoinRes = await joinLeaveCommunity({
|
|
21
|
+
ids: communityIds,
|
|
22
|
+
isJoin: true,
|
|
23
|
+
locale,
|
|
24
|
+
cookie,
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
const res = await callApiWithAuth(
|
|
28
|
+
getApiPath(isJoin ? PATHS.TOPIC.JOIN : PATHS.TOPIC.LEAVE, {
|
|
29
|
+
_locale: locale,
|
|
30
|
+
}),
|
|
31
|
+
'POST',
|
|
32
|
+
{
|
|
33
|
+
data: {
|
|
34
|
+
ids,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
cookie,
|
|
38
|
+
)
|
|
39
|
+
return res
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PushNotificationPayloadType } from 'together/togetherComponentGlobalContext'
|
|
2
|
+
|
|
3
|
+
type TranslateFunction = (
|
|
4
|
+
k: string,
|
|
5
|
+
option?: {
|
|
6
|
+
[key: string]: any
|
|
7
|
+
},
|
|
8
|
+
) => any
|
|
9
|
+
|
|
10
|
+
export const getDefaultSuccessNoti = (t: TranslateFunction) =>
|
|
11
|
+
({
|
|
12
|
+
message: t('notification.success'),
|
|
13
|
+
type: 'success',
|
|
14
|
+
} as PushNotificationPayloadType)
|
|
15
|
+
|
|
16
|
+
export const getDefaultFailNoti = (t: TranslateFunction) =>
|
|
17
|
+
({
|
|
18
|
+
message: t('notification.failure'),
|
|
19
|
+
type: 'danger',
|
|
20
|
+
} as PushNotificationPayloadType)
|