@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,933 @@
|
|
|
1
|
+
import { theme } from 'src/misc/theme'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AutoCompleteAddressApi,
|
|
5
|
+
CategoryApi,
|
|
6
|
+
HelpfulUrlApi,
|
|
7
|
+
HotSearchKeywordApi,
|
|
8
|
+
NavigationApi,
|
|
9
|
+
FooterInfoApi,
|
|
10
|
+
PriceInfoApi,
|
|
11
|
+
BlogPostApi,
|
|
12
|
+
BannerApi,
|
|
13
|
+
BlogPostDataReviewedUserApi,
|
|
14
|
+
BrandApi,
|
|
15
|
+
HomePageApi,
|
|
16
|
+
ProductApi,
|
|
17
|
+
CategoryPageApi,
|
|
18
|
+
PaginationApi,
|
|
19
|
+
BrandPageApi,
|
|
20
|
+
ProductDetailPageApi,
|
|
21
|
+
ProductReviewApi,
|
|
22
|
+
PromotionApi,
|
|
23
|
+
AddressApi,
|
|
24
|
+
OrderApi,
|
|
25
|
+
ProvinceApi,
|
|
26
|
+
DistrictApi,
|
|
27
|
+
CommuneApi,
|
|
28
|
+
ProvinceListApi,
|
|
29
|
+
DistrictListApi,
|
|
30
|
+
CommuneListApi,
|
|
31
|
+
CustomAttributesApi,
|
|
32
|
+
StatisticApi,
|
|
33
|
+
CartItemApi,
|
|
34
|
+
CartAddressApi,
|
|
35
|
+
CartLoggedInCustomerApi,
|
|
36
|
+
CartApi,
|
|
37
|
+
CartTotalApi,
|
|
38
|
+
EstimatedShippingApi,
|
|
39
|
+
OrderConfirmationApi,
|
|
40
|
+
ProductPromotionApi,
|
|
41
|
+
CouponListApi,
|
|
42
|
+
CouponApi,
|
|
43
|
+
ShippingApi,
|
|
44
|
+
PaymentMethodsApi,
|
|
45
|
+
ShippingInformation,
|
|
46
|
+
} from './lib/apiTypes'
|
|
47
|
+
import {
|
|
48
|
+
Address,
|
|
49
|
+
AutoCompleteAddress,
|
|
50
|
+
Banner,
|
|
51
|
+
BlogPost,
|
|
52
|
+
BlogPostDataReviewedUser,
|
|
53
|
+
Brand,
|
|
54
|
+
BrandPage,
|
|
55
|
+
Category,
|
|
56
|
+
CategoryPage,
|
|
57
|
+
HelpfulUrl,
|
|
58
|
+
HomePage,
|
|
59
|
+
Navigation,
|
|
60
|
+
Pagination,
|
|
61
|
+
PopularSearchType,
|
|
62
|
+
PriceInfo,
|
|
63
|
+
Product,
|
|
64
|
+
ProductDetailPage,
|
|
65
|
+
ProductReview,
|
|
66
|
+
Promotion,
|
|
67
|
+
Order,
|
|
68
|
+
Province,
|
|
69
|
+
District,
|
|
70
|
+
Commune,
|
|
71
|
+
Statistic,
|
|
72
|
+
CartItem,
|
|
73
|
+
CartAddress,
|
|
74
|
+
EstimatedShipping,
|
|
75
|
+
CartLoggedInCustomer,
|
|
76
|
+
Cart,
|
|
77
|
+
CartTotal,
|
|
78
|
+
PaymentInformation,
|
|
79
|
+
OrderConfirmation,
|
|
80
|
+
ProductPromotion,
|
|
81
|
+
Coupon,
|
|
82
|
+
Shipping,
|
|
83
|
+
PaymentMethodInfo,
|
|
84
|
+
} from './lib/dataTypes'
|
|
85
|
+
import { isDefined } from './lib/utils'
|
|
86
|
+
|
|
87
|
+
export const dataFormatter = {
|
|
88
|
+
formatAutoCompleteAddress: (
|
|
89
|
+
address: AutoCompleteAddressApi,
|
|
90
|
+
): AutoCompleteAddress | null => {
|
|
91
|
+
if (!address || !address.place_id) return null
|
|
92
|
+
return {
|
|
93
|
+
placeId: address.place_id,
|
|
94
|
+
description: address.description || '',
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
formatPrice: (price: string | number, locale?: string) => {
|
|
98
|
+
const formattedPrice = typeof price === 'string' ? parseInt(price) : price
|
|
99
|
+
|
|
100
|
+
return new Intl.NumberFormat(locale || 'vi-VN').format(formattedPrice)
|
|
101
|
+
},
|
|
102
|
+
formatHotSearchKeyword: (data: HotSearchKeywordApi): PopularSearchType => {
|
|
103
|
+
return {
|
|
104
|
+
text: data?.name || '',
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
formatHelpfulUrl: (data: HelpfulUrlApi): HelpfulUrl => {
|
|
108
|
+
return {
|
|
109
|
+
name: data?.name || '',
|
|
110
|
+
featuredImage: data?.featured_image || '',
|
|
111
|
+
url: data?.url || '',
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
formatCategory: function (
|
|
115
|
+
data: CategoryApi,
|
|
116
|
+
parentId?: number,
|
|
117
|
+
parentFullSlug?: string,
|
|
118
|
+
): Category {
|
|
119
|
+
const currentFullSlug = parentFullSlug
|
|
120
|
+
? parentFullSlug + '/' + data.slug
|
|
121
|
+
: data.slug
|
|
122
|
+
const children =
|
|
123
|
+
data?.children?.map?.((childCategory) => {
|
|
124
|
+
return dataFormatter.formatCategory(
|
|
125
|
+
childCategory,
|
|
126
|
+
data.id,
|
|
127
|
+
currentFullSlug,
|
|
128
|
+
)
|
|
129
|
+
}) || []
|
|
130
|
+
return {
|
|
131
|
+
id: data?.id,
|
|
132
|
+
name: data?.name || '',
|
|
133
|
+
logo: data?.logo || '',
|
|
134
|
+
slug: data?.slug || '',
|
|
135
|
+
fullSlug: currentFullSlug || '',
|
|
136
|
+
children,
|
|
137
|
+
backgroundColor: data.color || theme.colors.teal50,
|
|
138
|
+
parentId: parentId || 0,
|
|
139
|
+
products:
|
|
140
|
+
(data.products?.map(dataFormatter.formatProduct) as Product[]) || [],
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
formatFooterInfo: (data: FooterInfoApi | undefined): FooterInfoApi => {
|
|
144
|
+
const branches: { flag: string; name: string; url: string }[] =
|
|
145
|
+
data?.branch?.branch?.map?.((branch) => {
|
|
146
|
+
return {
|
|
147
|
+
flag: branch.flag || '',
|
|
148
|
+
name: branch.name || '',
|
|
149
|
+
url: branch.url || '',
|
|
150
|
+
}
|
|
151
|
+
}) || []
|
|
152
|
+
|
|
153
|
+
const verified: {
|
|
154
|
+
image: string
|
|
155
|
+
url: string
|
|
156
|
+
}[] =
|
|
157
|
+
data?.general?.verified?.map?.((verifiedItem) => {
|
|
158
|
+
return {
|
|
159
|
+
image: verifiedItem.image || '',
|
|
160
|
+
url: verifiedItem.url || '',
|
|
161
|
+
}
|
|
162
|
+
}) || []
|
|
163
|
+
|
|
164
|
+
const menu: {
|
|
165
|
+
menu_title: string
|
|
166
|
+
items: {
|
|
167
|
+
title: string
|
|
168
|
+
url: string
|
|
169
|
+
}[]
|
|
170
|
+
}[] =
|
|
171
|
+
data?.menu?.map?.((menuItem) => {
|
|
172
|
+
return {
|
|
173
|
+
menu_title: menuItem.menu_title,
|
|
174
|
+
items: menuItem.items?.map?.((item) => {
|
|
175
|
+
return {
|
|
176
|
+
title: item.title,
|
|
177
|
+
url: item.url,
|
|
178
|
+
}
|
|
179
|
+
}),
|
|
180
|
+
}
|
|
181
|
+
}) || []
|
|
182
|
+
|
|
183
|
+
const socials: {
|
|
184
|
+
icon: string
|
|
185
|
+
name: string
|
|
186
|
+
url: string
|
|
187
|
+
}[] =
|
|
188
|
+
data?.social?.socials?.map?.((social) => {
|
|
189
|
+
return {
|
|
190
|
+
icon: social.icon || '',
|
|
191
|
+
name: social.name || '',
|
|
192
|
+
url: social.url || '',
|
|
193
|
+
}
|
|
194
|
+
}) || []
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
branch: {
|
|
198
|
+
title: data?.branch?.title || '',
|
|
199
|
+
branch: branches,
|
|
200
|
+
},
|
|
201
|
+
general: {
|
|
202
|
+
logo: data?.general?.logo ?? '',
|
|
203
|
+
content: data?.general?.content ?? '',
|
|
204
|
+
copyright: data?.general?.copyright ?? '',
|
|
205
|
+
verified,
|
|
206
|
+
},
|
|
207
|
+
menu,
|
|
208
|
+
social: {
|
|
209
|
+
title: data?.social?.title || '',
|
|
210
|
+
socials,
|
|
211
|
+
},
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
formatNavigation: function (
|
|
215
|
+
data: NavigationApi | null | undefined,
|
|
216
|
+
): Navigation {
|
|
217
|
+
return {
|
|
218
|
+
hotSearchKeywords:
|
|
219
|
+
data?.hot_search_keywords?.map?.(
|
|
220
|
+
dataFormatter.formatHotSearchKeyword,
|
|
221
|
+
) || [],
|
|
222
|
+
helpfulUrls:
|
|
223
|
+
data?.helpful_urls?.map?.(dataFormatter.formatHelpfulUrl) || [],
|
|
224
|
+
categories:
|
|
225
|
+
data?.categories?.map?.((category) =>
|
|
226
|
+
dataFormatter.formatCategory(category),
|
|
227
|
+
) || [],
|
|
228
|
+
footer: dataFormatter.formatFooterInfo(data?.footer),
|
|
229
|
+
storeId: data?.store_id || 0,
|
|
230
|
+
customerId: data?.customer_id || 0,
|
|
231
|
+
cartItemsQty:
|
|
232
|
+
typeof data?.cart_items_qty === 'number' ? data.cart_items_qty : null,
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
// === ECOM TYPES FORMAT ===
|
|
237
|
+
formatPriceInfo: (priceInfoApi?: PriceInfoApi): PriceInfo | null => {
|
|
238
|
+
if (!priceInfoApi) return null
|
|
239
|
+
return {
|
|
240
|
+
final: priceInfoApi.final || 0,
|
|
241
|
+
regular: priceInfoApi.regular || 0,
|
|
242
|
+
discountPercent: priceInfoApi.discount_percent || 0,
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
formatProduct: function (productApi?: ProductApi): Product | null {
|
|
246
|
+
if (!productApi) return null
|
|
247
|
+
const defaultPriceInfo = {
|
|
248
|
+
final: 0,
|
|
249
|
+
regular: 0,
|
|
250
|
+
discountPercent: 0,
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
id: productApi.id || 0,
|
|
254
|
+
price: productApi.price
|
|
255
|
+
? dataFormatter.formatPriceInfo(productApi.price) || defaultPriceInfo
|
|
256
|
+
: defaultPriceInfo,
|
|
257
|
+
thumbnail: productApi.thumbnail || '',
|
|
258
|
+
name: productApi.name || '',
|
|
259
|
+
averageRating: Number((productApi.average_rating || 0).toFixed(2)),
|
|
260
|
+
reviewsCount: productApi.reviews_count || 0,
|
|
261
|
+
tag: productApi.tag || null,
|
|
262
|
+
sku: productApi.sku || '',
|
|
263
|
+
slug: productApi.slug || '',
|
|
264
|
+
images: productApi.images || [],
|
|
265
|
+
tags: productApi.tags || [],
|
|
266
|
+
unit: productApi.unit || '',
|
|
267
|
+
brand: productApi.brand
|
|
268
|
+
? {
|
|
269
|
+
name: productApi.brand.name || '',
|
|
270
|
+
image: productApi.brand.image || '',
|
|
271
|
+
slug: productApi.brand.slug || '',
|
|
272
|
+
productsCount: productApi.brand.products_count || 0,
|
|
273
|
+
}
|
|
274
|
+
: null,
|
|
275
|
+
description: productApi.description || '',
|
|
276
|
+
productPromotions:
|
|
277
|
+
productApi.product_promotions
|
|
278
|
+
?.map?.(dataFormatter.formatProductPromotion)
|
|
279
|
+
.filter(isDefined) || [],
|
|
280
|
+
categories:
|
|
281
|
+
productApi.categories
|
|
282
|
+
?.map?.((c) => dataFormatter.formatCategory(c))
|
|
283
|
+
.filter(isDefined) || [],
|
|
284
|
+
isInStock: productApi?.is_in_stock || false,
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
formatBanner: (bannerApi?: BannerApi): Banner | null => {
|
|
288
|
+
if (!bannerApi) return null
|
|
289
|
+
return {
|
|
290
|
+
name: bannerApi.name || '',
|
|
291
|
+
url: bannerApi.url || '',
|
|
292
|
+
featuredImage: bannerApi.featured_image || '',
|
|
293
|
+
alt: bannerApi.image_alt,
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
formatBlogPost: (blogPostApi?: BlogPostApi): BlogPost | null => {
|
|
297
|
+
if (!blogPostApi) return null
|
|
298
|
+
return {
|
|
299
|
+
title: blogPostApi.title || '',
|
|
300
|
+
image: blogPostApi.image || '',
|
|
301
|
+
link: blogPostApi.link || '',
|
|
302
|
+
postData: blogPostApi.post_data
|
|
303
|
+
? {
|
|
304
|
+
reviewed: blogPostApi.post_data.reviewed
|
|
305
|
+
? {
|
|
306
|
+
author: dataFormatter.formatBlogPostDataReviewedUser(
|
|
307
|
+
blogPostApi.post_data.reviewed.author || undefined,
|
|
308
|
+
),
|
|
309
|
+
editor: dataFormatter.formatBlogPostDataReviewedUser(
|
|
310
|
+
blogPostApi.post_data.reviewed.editor || undefined,
|
|
311
|
+
),
|
|
312
|
+
expert: dataFormatter.formatBlogPostDataReviewedUser(
|
|
313
|
+
blogPostApi.post_data.reviewed.expert || undefined,
|
|
314
|
+
),
|
|
315
|
+
factCheck: dataFormatter.formatBlogPostDataReviewedUser(
|
|
316
|
+
blogPostApi.post_data.reviewed.fact_check || undefined,
|
|
317
|
+
),
|
|
318
|
+
isAuthor: Boolean(blogPostApi.post_data.reviewed.is_author),
|
|
319
|
+
}
|
|
320
|
+
: null,
|
|
321
|
+
categories: blogPostApi.post_data.categories
|
|
322
|
+
? blogPostApi.post_data.categories.map?.((item) => ({
|
|
323
|
+
termId: item.term_id || 0,
|
|
324
|
+
name: item.name || '',
|
|
325
|
+
permalink: item.permalink || '',
|
|
326
|
+
textColor: item.text_color || '',
|
|
327
|
+
}))
|
|
328
|
+
: [],
|
|
329
|
+
postDate: blogPostApi.post_data.post_date || '',
|
|
330
|
+
postModified: blogPostApi.post_data.post_modified || '',
|
|
331
|
+
modifiedTime: blogPostApi.post_data.modified_time || '',
|
|
332
|
+
}
|
|
333
|
+
: null,
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
formatBlogPostDataReviewedUser: (
|
|
337
|
+
blogPostDataReviewedUserApi?: BlogPostDataReviewedUserApi,
|
|
338
|
+
): BlogPostDataReviewedUser | null => {
|
|
339
|
+
if (!blogPostDataReviewedUserApi) return null
|
|
340
|
+
return {
|
|
341
|
+
id: blogPostDataReviewedUserApi.ID || 0,
|
|
342
|
+
userId: blogPostDataReviewedUserApi.user_id || 0,
|
|
343
|
+
formerRole: blogPostDataReviewedUserApi.former_role || '',
|
|
344
|
+
role: blogPostDataReviewedUserApi.role || '',
|
|
345
|
+
slug: blogPostDataReviewedUserApi.slug || '',
|
|
346
|
+
displayName: blogPostDataReviewedUserApi.display_name || '',
|
|
347
|
+
description: blogPostDataReviewedUserApi.description || '',
|
|
348
|
+
profileUrl: blogPostDataReviewedUserApi.profile_url || '',
|
|
349
|
+
avatar: blogPostDataReviewedUserApi.avatar || '',
|
|
350
|
+
avatarThumbnail: blogPostDataReviewedUserApi.avatar_thumbnail || '',
|
|
351
|
+
turnOffProfile: Boolean(blogPostDataReviewedUserApi.turn_off_profile),
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
formatBrand: function (brandApi?: BrandApi): Brand | null {
|
|
355
|
+
if (!brandApi) return null
|
|
356
|
+
return {
|
|
357
|
+
id: brandApi.id || 0,
|
|
358
|
+
image: brandApi.image || '',
|
|
359
|
+
position: brandApi.position || '',
|
|
360
|
+
isPopular: brandApi.is_popular || false,
|
|
361
|
+
summary: brandApi.summary || '',
|
|
362
|
+
name: brandApi.name || '',
|
|
363
|
+
slug: brandApi.slug || '',
|
|
364
|
+
description: brandApi.description || null,
|
|
365
|
+
banners:
|
|
366
|
+
brandApi.banners?.map?.(dataFormatter.formatBanner).filter(isDefined) ||
|
|
367
|
+
[],
|
|
368
|
+
bestsellerProducts:
|
|
369
|
+
brandApi.bestseller_products
|
|
370
|
+
?.map?.(dataFormatter.formatProduct)
|
|
371
|
+
.filter(isDefined) || [],
|
|
372
|
+
} as Brand
|
|
373
|
+
},
|
|
374
|
+
formatHomePage: (homePageApi?: HomePageApi): HomePage | null => {
|
|
375
|
+
if (!homePageApi) return null
|
|
376
|
+
return {
|
|
377
|
+
brands: homePageApi.brands
|
|
378
|
+
? homePageApi.brands.map?.(dataFormatter.formatBrand).filter(isDefined)
|
|
379
|
+
: [],
|
|
380
|
+
hotDeals: homePageApi.hot_deals
|
|
381
|
+
? homePageApi.hot_deals
|
|
382
|
+
.map?.(dataFormatter.formatProduct)
|
|
383
|
+
.filter(isDefined)
|
|
384
|
+
: [],
|
|
385
|
+
newProducts: homePageApi.new_products
|
|
386
|
+
? homePageApi.new_products
|
|
387
|
+
.map?.(dataFormatter.formatProduct)
|
|
388
|
+
.filter(isDefined)
|
|
389
|
+
: [],
|
|
390
|
+
slideBanners: homePageApi.slide_banners
|
|
391
|
+
? homePageApi.slide_banners
|
|
392
|
+
.map?.(dataFormatter.formatBanner)
|
|
393
|
+
.filter(isDefined)
|
|
394
|
+
: [],
|
|
395
|
+
subBanners: homePageApi.sub_banners
|
|
396
|
+
? homePageApi.sub_banners
|
|
397
|
+
.map?.(dataFormatter.formatBanner)
|
|
398
|
+
.filter(isDefined)
|
|
399
|
+
: [],
|
|
400
|
+
footerBanners: homePageApi.footer_banners
|
|
401
|
+
? homePageApi.footer_banners
|
|
402
|
+
.map?.(dataFormatter.formatBanner)
|
|
403
|
+
.filter(isDefined)
|
|
404
|
+
: [],
|
|
405
|
+
blogPosts: homePageApi.blog_posts
|
|
406
|
+
? homePageApi.blog_posts
|
|
407
|
+
.map?.(dataFormatter.formatBlogPost)
|
|
408
|
+
.filter(isDefined)
|
|
409
|
+
: [],
|
|
410
|
+
popularCategories: homePageApi.popular_categories
|
|
411
|
+
? homePageApi.popular_categories
|
|
412
|
+
.map?.((c) => dataFormatter.formatCategory(c))
|
|
413
|
+
.filter(isDefined)
|
|
414
|
+
: [],
|
|
415
|
+
suggestProducts: homePageApi.suggest_products
|
|
416
|
+
? homePageApi.suggest_products
|
|
417
|
+
.map?.((c) => dataFormatter.formatCategory(c))
|
|
418
|
+
.filter(isDefined)
|
|
419
|
+
: [],
|
|
420
|
+
promotions: homePageApi.promotions
|
|
421
|
+
? homePageApi.promotions
|
|
422
|
+
.map?.((c) => dataFormatter.formatPromotion(c))
|
|
423
|
+
.filter(isDefined)
|
|
424
|
+
: [],
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
formatCategoryPage: function (
|
|
428
|
+
categoryPageApi?: CategoryPageApi,
|
|
429
|
+
): CategoryPage | null {
|
|
430
|
+
if (!categoryPageApi) return null
|
|
431
|
+
return {
|
|
432
|
+
id: categoryPageApi.id || 0,
|
|
433
|
+
name: categoryPageApi.name || '',
|
|
434
|
+
slug: categoryPageApi.slug || '',
|
|
435
|
+
description: categoryPageApi.description || null,
|
|
436
|
+
banners:
|
|
437
|
+
categoryPageApi.banners
|
|
438
|
+
?.map?.(dataFormatter.formatBanner)
|
|
439
|
+
.filter(isDefined) || [],
|
|
440
|
+
bestsellerProducts:
|
|
441
|
+
categoryPageApi.bestseller_products
|
|
442
|
+
?.map?.(dataFormatter.formatProduct)
|
|
443
|
+
.filter(isDefined) || [],
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
formatBrandPage: function (brandPageApi?: BrandPageApi): BrandPage | null {
|
|
447
|
+
if (!brandPageApi) return null
|
|
448
|
+
return dataFormatter.formatBrand(brandPageApi)
|
|
449
|
+
},
|
|
450
|
+
formatPagination: (paginationApi?: PaginationApi): Pagination | null => {
|
|
451
|
+
if (!paginationApi) return null
|
|
452
|
+
return {
|
|
453
|
+
current: paginationApi.current || 0,
|
|
454
|
+
first: paginationApi.first || 0,
|
|
455
|
+
itemsPerPage: paginationApi.items_per_page || 0,
|
|
456
|
+
last: paginationApi.last || 0,
|
|
457
|
+
next: paginationApi.next || 0,
|
|
458
|
+
prev: paginationApi.prev || 0,
|
|
459
|
+
totalItems: paginationApi.total_items || 0,
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
formatProductDetailPage: function (
|
|
463
|
+
productDetailPageApi?: ProductDetailPageApi,
|
|
464
|
+
): ProductDetailPage | null {
|
|
465
|
+
if (!productDetailPageApi) return null
|
|
466
|
+
return {
|
|
467
|
+
...(dataFormatter.formatProduct(productDetailPageApi) as Product),
|
|
468
|
+
relatedProducts:
|
|
469
|
+
productDetailPageApi.related_products
|
|
470
|
+
?.map?.(dataFormatter.formatProduct)
|
|
471
|
+
.filter(isDefined) || [],
|
|
472
|
+
bestsellerProducts:
|
|
473
|
+
productDetailPageApi.bestseller_products
|
|
474
|
+
?.map?.(dataFormatter.formatProduct)
|
|
475
|
+
.filter(isDefined) || [],
|
|
476
|
+
viewedProducts:
|
|
477
|
+
productDetailPageApi.viewed_products
|
|
478
|
+
?.map?.(dataFormatter.formatProduct)
|
|
479
|
+
.filter(isDefined) || [],
|
|
480
|
+
promotions:
|
|
481
|
+
productDetailPageApi.promotions
|
|
482
|
+
?.map?.(dataFormatter.formatPromotion)
|
|
483
|
+
.filter(isDefined) || [],
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
formatProductReview: (
|
|
487
|
+
productReview?: ProductReviewApi,
|
|
488
|
+
): ProductReview | null => {
|
|
489
|
+
if (!productReview) return null
|
|
490
|
+
|
|
491
|
+
// TODO: avatar, images
|
|
492
|
+
return {
|
|
493
|
+
reviewId: productReview.review_id || '',
|
|
494
|
+
createdAt: productReview.created_at || '',
|
|
495
|
+
title: productReview.title || '',
|
|
496
|
+
detail: productReview.detail || '',
|
|
497
|
+
nickname: productReview.nick_name || '',
|
|
498
|
+
avatar: productReview.avatar || '',
|
|
499
|
+
ratingVotes:
|
|
500
|
+
productReview.rating_votes?.map?.((vote) => {
|
|
501
|
+
return {
|
|
502
|
+
ratingCode: vote.rating_code || '',
|
|
503
|
+
value: Number(vote.value) || 0,
|
|
504
|
+
percent: Number(vote.percent) || 0,
|
|
505
|
+
}
|
|
506
|
+
}) || [],
|
|
507
|
+
images: productReview.images || [],
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
formatProductPromotion: (
|
|
511
|
+
productPromotionApi?: ProductPromotionApi,
|
|
512
|
+
): ProductPromotion | null => {
|
|
513
|
+
if (!productPromotionApi) return null
|
|
514
|
+
|
|
515
|
+
return {
|
|
516
|
+
id: productPromotionApi.id || 0,
|
|
517
|
+
name: productPromotionApi.name || '',
|
|
518
|
+
thumbnail: productPromotionApi.thumbnail || '',
|
|
519
|
+
expirationDate: productPromotionApi.expiration_date || '',
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
formatPromotion: (promotionApi?: PromotionApi): Promotion | null => {
|
|
523
|
+
if (!promotionApi) return null
|
|
524
|
+
|
|
525
|
+
return {
|
|
526
|
+
id: promotionApi.id || 0,
|
|
527
|
+
name: promotionApi.name || '',
|
|
528
|
+
slug: promotionApi.slug || '',
|
|
529
|
+
thumbnail: promotionApi.thumbnail || '',
|
|
530
|
+
expiredDate: promotionApi.expired_date || '',
|
|
531
|
+
banners: promotionApi.banners || [],
|
|
532
|
+
points: 0,
|
|
533
|
+
description: promotionApi.description || '',
|
|
534
|
+
metaTitle: promotionApi.meta_title || '',
|
|
535
|
+
metaKeywords: promotionApi.meta_keywords || '',
|
|
536
|
+
metaDescription: promotionApi.meta_description || '',
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
formatCustomAttributes: (
|
|
540
|
+
customAttributesApi: CustomAttributesApi[],
|
|
541
|
+
type: string,
|
|
542
|
+
): string | '' => {
|
|
543
|
+
if (!customAttributesApi?.length) return ''
|
|
544
|
+
return (
|
|
545
|
+
customAttributesApi?.find(
|
|
546
|
+
(item: CustomAttributesApi) => item.attribute_code === type,
|
|
547
|
+
)?.value || ''
|
|
548
|
+
)
|
|
549
|
+
},
|
|
550
|
+
|
|
551
|
+
formatAddress: (addressApi?: AddressApi): Address | null => {
|
|
552
|
+
if (!addressApi) return null
|
|
553
|
+
return {
|
|
554
|
+
id: addressApi.id || 0,
|
|
555
|
+
fullName: addressApi.firstname || '',
|
|
556
|
+
telephone: addressApi.telephone || '',
|
|
557
|
+
province:
|
|
558
|
+
{
|
|
559
|
+
value: addressApi.region?.region_id,
|
|
560
|
+
label: addressApi.region?.region,
|
|
561
|
+
} || null,
|
|
562
|
+
district: {
|
|
563
|
+
value: dataFormatter.formatCustomAttributes(
|
|
564
|
+
addressApi.custom_attributes,
|
|
565
|
+
'district_id',
|
|
566
|
+
),
|
|
567
|
+
label: dataFormatter.formatCustomAttributes(
|
|
568
|
+
addressApi.custom_attributes,
|
|
569
|
+
'district',
|
|
570
|
+
),
|
|
571
|
+
},
|
|
572
|
+
commune: {
|
|
573
|
+
value: dataFormatter.formatCustomAttributes(
|
|
574
|
+
addressApi.custom_attributes,
|
|
575
|
+
'ward_id',
|
|
576
|
+
),
|
|
577
|
+
label: dataFormatter.formatCustomAttributes(
|
|
578
|
+
addressApi.custom_attributes,
|
|
579
|
+
'ward',
|
|
580
|
+
),
|
|
581
|
+
},
|
|
582
|
+
street: addressApi?.street?.length ? addressApi?.street[0] : '',
|
|
583
|
+
isDefault:
|
|
584
|
+
(addressApi.default_billing && addressApi.default_shipping) || false,
|
|
585
|
+
fullAddress: addressApi?.extension_attributes?.full_address || '',
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
|
|
589
|
+
formatProvince: (provinceApi?: ProvinceListApi): Province[] | [] => {
|
|
590
|
+
if (!provinceApi?.available_regions) return []
|
|
591
|
+
|
|
592
|
+
return provinceApi.available_regions.map((province: ProvinceApi) => ({
|
|
593
|
+
value: province.id || '',
|
|
594
|
+
label: province.name || '',
|
|
595
|
+
}))
|
|
596
|
+
},
|
|
597
|
+
|
|
598
|
+
formatDistrict: (districtApi?: DistrictListApi): District[] | [] => {
|
|
599
|
+
if (!districtApi?.districts) return []
|
|
600
|
+
|
|
601
|
+
return districtApi.districts.map((district: DistrictApi) => ({
|
|
602
|
+
value: district.id || '',
|
|
603
|
+
label: district.name || '',
|
|
604
|
+
}))
|
|
605
|
+
},
|
|
606
|
+
|
|
607
|
+
formatCommune: (communeApi?: CommuneListApi): Commune[] | [] => {
|
|
608
|
+
if (!communeApi?.communes) return []
|
|
609
|
+
|
|
610
|
+
return communeApi.communes.map((commune: CommuneApi) => ({
|
|
611
|
+
value: commune.id || '',
|
|
612
|
+
label: commune.name || '',
|
|
613
|
+
}))
|
|
614
|
+
},
|
|
615
|
+
|
|
616
|
+
formatOrder: (orderApi?: OrderApi): Order | null => {
|
|
617
|
+
if (!orderApi) return null
|
|
618
|
+
return {
|
|
619
|
+
orderNumber: orderApi?.order_number || '',
|
|
620
|
+
shippingData: orderApi?.shipping_data
|
|
621
|
+
? {
|
|
622
|
+
shippingMethod: orderApi.shipping_data.shipping_method || '',
|
|
623
|
+
shippingDescription:
|
|
624
|
+
orderApi.shipping_data.shipping_description || '',
|
|
625
|
+
shippingAddress: orderApi.shipping_data.shipping_address
|
|
626
|
+
? {
|
|
627
|
+
fullName:
|
|
628
|
+
orderApi.shipping_data.shipping_address.firstname || '',
|
|
629
|
+
fullAddress:
|
|
630
|
+
orderApi.shipping_data.shipping_address.full_address || '',
|
|
631
|
+
telephone:
|
|
632
|
+
orderApi.shipping_data.shipping_address.telephone || '',
|
|
633
|
+
}
|
|
634
|
+
: null,
|
|
635
|
+
storeAddress: null,
|
|
636
|
+
}
|
|
637
|
+
: null,
|
|
638
|
+
orderedDate: orderApi?.ordered_date || '',
|
|
639
|
+
status: orderApi?.status || null,
|
|
640
|
+
totals: orderApi?.totals
|
|
641
|
+
? {
|
|
642
|
+
subtotal: orderApi.totals.subtotal || 0,
|
|
643
|
+
shippingAmount: orderApi.totals.shipping_amount || 0,
|
|
644
|
+
discountAmount: orderApi.totals.discount_amount || 0,
|
|
645
|
+
grandTotal: orderApi.totals.grand_total || 0,
|
|
646
|
+
}
|
|
647
|
+
: null,
|
|
648
|
+
products:
|
|
649
|
+
orderApi?.products?.map?.((p) => ({
|
|
650
|
+
sku: p.sku || '',
|
|
651
|
+
name: p.name || '',
|
|
652
|
+
price: p.price || 0,
|
|
653
|
+
rowTotal: p.row_total || 0,
|
|
654
|
+
image: p.image || '',
|
|
655
|
+
qty: p.qty || 0,
|
|
656
|
+
})) || [],
|
|
657
|
+
|
|
658
|
+
paymentMethod: orderApi?.payment_method || '',
|
|
659
|
+
}
|
|
660
|
+
},
|
|
661
|
+
formatStatistic: (statistic?: StatisticApi[]): Statistic => {
|
|
662
|
+
if (!statistic) return {} as Statistic
|
|
663
|
+
return {
|
|
664
|
+
pending:
|
|
665
|
+
Number(
|
|
666
|
+
statistic?.find((stt: StatisticApi) => stt.status === 'pending')
|
|
667
|
+
?.amount,
|
|
668
|
+
) || 0,
|
|
669
|
+
processing:
|
|
670
|
+
Number(
|
|
671
|
+
statistic?.find((stt: StatisticApi) => stt.status === 'processing')
|
|
672
|
+
?.amount,
|
|
673
|
+
) || 0,
|
|
674
|
+
delivering:
|
|
675
|
+
Number(
|
|
676
|
+
statistic?.find((stt: StatisticApi) => stt.status === 'delivering')
|
|
677
|
+
?.amount,
|
|
678
|
+
) || 0,
|
|
679
|
+
complete:
|
|
680
|
+
Number(
|
|
681
|
+
statistic?.find((stt: StatisticApi) => stt.status === 'complete')
|
|
682
|
+
?.amount,
|
|
683
|
+
) || 0,
|
|
684
|
+
canceled:
|
|
685
|
+
Number(
|
|
686
|
+
statistic?.find((stt: StatisticApi) => stt.status === 'canceled')
|
|
687
|
+
?.amount,
|
|
688
|
+
) || 0,
|
|
689
|
+
} as Statistic
|
|
690
|
+
},
|
|
691
|
+
formatCartItem: (cartItemApi?: CartItemApi): CartItem | null => {
|
|
692
|
+
if (!cartItemApi) return null
|
|
693
|
+
return {
|
|
694
|
+
itemId: cartItemApi.item_id || 0,
|
|
695
|
+
sku: cartItemApi.sku || '',
|
|
696
|
+
qty: cartItemApi.qty || 0,
|
|
697
|
+
name: cartItemApi.name || '',
|
|
698
|
+
price: cartItemApi.price || 0,
|
|
699
|
+
basePrice: cartItemApi.extension_attributes?.base_price || 0,
|
|
700
|
+
productType: cartItemApi.product_type || '',
|
|
701
|
+
quoteId: cartItemApi.quote_id || '',
|
|
702
|
+
thumbnail: cartItemApi.extension_attributes?.thumbnail || '',
|
|
703
|
+
rowTotal: cartItemApi.extension_attributes?.row_total || 0,
|
|
704
|
+
promotions: (cartItemApi.extension_attributes?.promotions?.map?.(
|
|
705
|
+
dataFormatter.formatProductPromotion,
|
|
706
|
+
) || []) as ProductPromotion[],
|
|
707
|
+
isInStock: cartItemApi.extension_attributes?.is_in_stock || false,
|
|
708
|
+
urlProduct: cartItemApi.extension_attributes?.url_key || '',
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
formatCartAddress: (cartAddressApi?: CartAddressApi): CartAddress | null => {
|
|
712
|
+
if (!cartAddressApi) return null
|
|
713
|
+
return {
|
|
714
|
+
customerAddressId: cartAddressApi?.customer_address_id || 0,
|
|
715
|
+
id: cartAddressApi.id || 0,
|
|
716
|
+
region: cartAddressApi.region || '',
|
|
717
|
+
regionId: cartAddressApi.region_id || 0,
|
|
718
|
+
regionCode: cartAddressApi.region_code || '',
|
|
719
|
+
countryId: cartAddressApi.country_id || '',
|
|
720
|
+
street: cartAddressApi.street || [],
|
|
721
|
+
postcode: cartAddressApi.postcode || '',
|
|
722
|
+
city: cartAddressApi.city || '',
|
|
723
|
+
firstname: cartAddressApi.firstname || '',
|
|
724
|
+
lastname: cartAddressApi.lastname || '',
|
|
725
|
+
customerId: cartAddressApi.customer_id || 0,
|
|
726
|
+
email: cartAddressApi.email || '',
|
|
727
|
+
telephone: cartAddressApi.telephone || '',
|
|
728
|
+
sameAsBilling: cartAddressApi.same_as_billing || 0,
|
|
729
|
+
saveInAddressBook: cartAddressApi.save_in_address_book || 0,
|
|
730
|
+
fullAddress: cartAddressApi.extension_attributes?.full_address || '',
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
formatEstimatedShipping: (
|
|
734
|
+
estimatedShippingApi?: EstimatedShippingApi,
|
|
735
|
+
): EstimatedShipping | null => {
|
|
736
|
+
if (!estimatedShippingApi) return null
|
|
737
|
+
return {
|
|
738
|
+
carrierCode: estimatedShippingApi.carrier_code || '',
|
|
739
|
+
methodCode: estimatedShippingApi.method_code || '',
|
|
740
|
+
carrierTitle: estimatedShippingApi.carrier_title || '',
|
|
741
|
+
methodTitle: estimatedShippingApi.method_title || '',
|
|
742
|
+
amount: estimatedShippingApi.amount || 0,
|
|
743
|
+
baseAmount: estimatedShippingApi.base_amount || 0,
|
|
744
|
+
available: estimatedShippingApi.available || false,
|
|
745
|
+
errorMessage: estimatedShippingApi.error_message || '',
|
|
746
|
+
priceExclTax: estimatedShippingApi.price_excl_tax || 0,
|
|
747
|
+
priceInclTax: estimatedShippingApi.price_incl_tax || 0,
|
|
748
|
+
}
|
|
749
|
+
},
|
|
750
|
+
formatCartLoggedInCustomer: (
|
|
751
|
+
cartLoggedInCustomerApi?: Partial<CartLoggedInCustomerApi>,
|
|
752
|
+
): CartLoggedInCustomer | null => {
|
|
753
|
+
if (!cartLoggedInCustomerApi) return null
|
|
754
|
+
return {
|
|
755
|
+
email: cartLoggedInCustomerApi.email || '',
|
|
756
|
+
firstname: cartLoggedInCustomerApi.firstname || '',
|
|
757
|
+
lastname: cartLoggedInCustomerApi.lastname || '',
|
|
758
|
+
id: cartLoggedInCustomerApi.id || 0,
|
|
759
|
+
groupId: cartLoggedInCustomerApi.group_id || 0,
|
|
760
|
+
createdAt: cartLoggedInCustomerApi.created_at || '',
|
|
761
|
+
updatedAt: cartLoggedInCustomerApi.updated_at || '',
|
|
762
|
+
createdIn: cartLoggedInCustomerApi.created_in || '',
|
|
763
|
+
storeId: cartLoggedInCustomerApi.store_id || 0,
|
|
764
|
+
websiteId: cartLoggedInCustomerApi.website_id || 0,
|
|
765
|
+
addresses: (cartLoggedInCustomerApi.addresses?.map?.(
|
|
766
|
+
dataFormatter.formatCartAddress,
|
|
767
|
+
) || []) as CartAddress[],
|
|
768
|
+
disableAutoGroupChange:
|
|
769
|
+
cartLoggedInCustomerApi.disable_auto_group_change || 0,
|
|
770
|
+
isSubscribed:
|
|
771
|
+
cartLoggedInCustomerApi.extension_attributes?.is_subscribed || false,
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
formatCart: (cartApi?: CartApi): Cart | null => {
|
|
775
|
+
if (!cartApi) return null
|
|
776
|
+
return {
|
|
777
|
+
id: cartApi.id || 0,
|
|
778
|
+
createdAt: cartApi.created_at || '',
|
|
779
|
+
updatedAt: cartApi.updated_at || '',
|
|
780
|
+
isActive: cartApi.is_active || false,
|
|
781
|
+
isVirtual: cartApi.is_virtual || false,
|
|
782
|
+
items: (cartApi.items
|
|
783
|
+
?.map?.(dataFormatter.formatCartItem)
|
|
784
|
+
?.sort((a, b) => Number(b?.isInStock) - Number(a?.isInStock)) ||
|
|
785
|
+
[]) as CartItem[],
|
|
786
|
+
itemsCount: cartApi.items_count || 0,
|
|
787
|
+
itemsQty: cartApi.items_qty || 0,
|
|
788
|
+
customer: cartApi.customer
|
|
789
|
+
? dataFormatter.formatCartLoggedInCustomer(cartApi.customer)
|
|
790
|
+
: null,
|
|
791
|
+
billingAddress: cartApi.billing_address
|
|
792
|
+
? dataFormatter.formatCartAddress(cartApi.billing_address)
|
|
793
|
+
: null,
|
|
794
|
+
origOrderId: cartApi.orig_order_id || 0,
|
|
795
|
+
currency: {
|
|
796
|
+
globalCurrencyCode: cartApi.currency?.global_currency_code || '',
|
|
797
|
+
baseCurrencyCode: cartApi.currency?.base_currency_code || '',
|
|
798
|
+
storeCurrencyCode: cartApi.currency?.store_currency_code || '',
|
|
799
|
+
quoteCurrencyCode: cartApi.currency?.quote_currency_code || '',
|
|
800
|
+
storeToBaseRate: cartApi.currency?.store_to_base_rate || 0,
|
|
801
|
+
storeToQuoteRate: cartApi.currency?.store_to_quote_rate || 0,
|
|
802
|
+
baseToGlobalRate: cartApi.currency?.base_to_global_rate || 0,
|
|
803
|
+
baseToQuoteRate: cartApi.currency?.base_to_quote_rate || 0,
|
|
804
|
+
},
|
|
805
|
+
customerIsGuest: cartApi.customer_is_guest || false,
|
|
806
|
+
customerNoteNotify: cartApi.customer_note_notify || false,
|
|
807
|
+
customerTaxClassId: cartApi.customer_tax_class_id || 0,
|
|
808
|
+
storeId: cartApi.store_id || 0,
|
|
809
|
+
shippingAssignments:
|
|
810
|
+
cartApi.extension_attributes?.shipping_assignments?.map?.((s) => ({
|
|
811
|
+
shipping: {
|
|
812
|
+
address: s.shipping.address
|
|
813
|
+
? dataFormatter.formatCartAddress(s.shipping.address)
|
|
814
|
+
: null,
|
|
815
|
+
method: s.shipping?.method || '',
|
|
816
|
+
},
|
|
817
|
+
items: (s.items.map?.(dataFormatter.formatCartItem) ||
|
|
818
|
+
[]) as CartItem[],
|
|
819
|
+
})),
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
formatCartTotal: (cartTotalApi?: CartTotalApi): CartTotal | null => {
|
|
823
|
+
if (!cartTotalApi) return null
|
|
824
|
+
return {
|
|
825
|
+
grandTotal: cartTotalApi.grand_total || 0,
|
|
826
|
+
baseGrandTotal: cartTotalApi.base_grand_total || 0,
|
|
827
|
+
subtotal: cartTotalApi.subtotal || 0,
|
|
828
|
+
baseSubtotal: cartTotalApi.base_subtotal || 0,
|
|
829
|
+
discountAmount: cartTotalApi.discount_amount || 0,
|
|
830
|
+
baseDiscountAmount: cartTotalApi.base_discount_amount || 0,
|
|
831
|
+
subtotalWithDiscount: cartTotalApi.subtotal_with_discount || 0,
|
|
832
|
+
baseSubtotalWithDiscount: cartTotalApi.base_subtotal_with_discount || 0,
|
|
833
|
+
shippingAmount: cartTotalApi.shipping_amount || 0,
|
|
834
|
+
baseShippingAmount: cartTotalApi.base_shipping_amount || 0,
|
|
835
|
+
shippingDiscountAmount: cartTotalApi.shipping_discount_amount || 0,
|
|
836
|
+
baseShippingDiscountAmount:
|
|
837
|
+
cartTotalApi.base_shipping_discount_amount || 0,
|
|
838
|
+
taxAmount: cartTotalApi.tax_amount || 0,
|
|
839
|
+
baseTaxAmount: cartTotalApi.base_tax_amount || 0,
|
|
840
|
+
weeeTaxAppliedAmount: cartTotalApi.weee_tax_applied_amount || 0,
|
|
841
|
+
shippingTaxAmount: cartTotalApi.shipping_tax_amount || 0,
|
|
842
|
+
baseShippingTaxAmount: cartTotalApi.base_shipping_tax_amount || 0,
|
|
843
|
+
subtotalInclTax: cartTotalApi.subtotal_incl_tax || 0,
|
|
844
|
+
shippingInclTax: cartTotalApi.shipping_incl_tax || 0,
|
|
845
|
+
baseShippingInclTax: cartTotalApi.base_shipping_incl_tax || 0,
|
|
846
|
+
baseCurrencyCode: cartTotalApi.base_currency_code || '',
|
|
847
|
+
quoteCurrencyCode: cartTotalApi.quote_currency_code || '',
|
|
848
|
+
itemsQty: cartTotalApi.items_qty || 0,
|
|
849
|
+
coupon: {
|
|
850
|
+
couponCode: cartTotalApi.coupon_code || '',
|
|
851
|
+
couponDescription:
|
|
852
|
+
cartTotalApi?.extension_attributes?.coupon_description_text || '',
|
|
853
|
+
},
|
|
854
|
+
items:
|
|
855
|
+
cartTotalApi.items?.map?.((item) => ({
|
|
856
|
+
itemId: item.item_id || 0,
|
|
857
|
+
price: item.price || 0,
|
|
858
|
+
basePrice: item.base_price || 0,
|
|
859
|
+
qty: item.qty || 0,
|
|
860
|
+
rowTotal: item.row_total || 0,
|
|
861
|
+
baseRowTotal: item.base_row_total || 0,
|
|
862
|
+
rowTotalWithDiscount: item.row_total_with_discount || 0,
|
|
863
|
+
taxAmount: item.tax_amount || 0,
|
|
864
|
+
baseTaxAmount: item.base_tax_amount || 0,
|
|
865
|
+
taxPercent: item.tax_percent || 0,
|
|
866
|
+
discountAmount: item.discount_amount || 0,
|
|
867
|
+
baseDiscountAmount: item.base_discount_amount || 0,
|
|
868
|
+
discountPercent: item.discount_percent || 0,
|
|
869
|
+
priceInclTax: item.price_incl_tax || 0,
|
|
870
|
+
basePriceInclTax: item.base_price_incl_tax || 0,
|
|
871
|
+
rowTotalInclTax: item.row_total_incl_tax || 0,
|
|
872
|
+
baseRowTotalInclTax: item.base_row_total_incl_tax || 0,
|
|
873
|
+
options: item.options || '',
|
|
874
|
+
weeeTaxAppliedAmount: item.weee_tax_applied_amount || 0,
|
|
875
|
+
weeeTaxApplied: item.weee_tax_applied || 0,
|
|
876
|
+
name: item.name || '',
|
|
877
|
+
})) || [],
|
|
878
|
+
totalSegments: cartTotalApi.total_segments || [],
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
formatPaymentMethod: (
|
|
882
|
+
methods?: PaymentMethodsApi[],
|
|
883
|
+
): PaymentMethodInfo[] | null => {
|
|
884
|
+
if (!methods) return null
|
|
885
|
+
return methods?.map((method: PaymentMethodsApi) => ({
|
|
886
|
+
code: method?.payment_code || '',
|
|
887
|
+
title: method?.payment_title || '',
|
|
888
|
+
thumbnail: method?.payment_thumbnail || '',
|
|
889
|
+
}))
|
|
890
|
+
},
|
|
891
|
+
formatPaymentInformation: (
|
|
892
|
+
paymentInformationApi?: ShippingInformation,
|
|
893
|
+
): PaymentInformation | null => {
|
|
894
|
+
if (!paymentInformationApi) return null
|
|
895
|
+
return {
|
|
896
|
+
paymentMethods:
|
|
897
|
+
dataFormatter.formatPaymentMethod(
|
|
898
|
+
paymentInformationApi?.extension_attributes?.payment_detail_info,
|
|
899
|
+
) || [],
|
|
900
|
+
totals: dataFormatter.formatCartTotal(paymentInformationApi.totals),
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
formatOrderConfirmation: (
|
|
904
|
+
orderConfirmationApi?: OrderConfirmationApi,
|
|
905
|
+
): OrderConfirmation | null => {
|
|
906
|
+
if (!orderConfirmationApi) return null
|
|
907
|
+
return {
|
|
908
|
+
isSuccess: orderConfirmationApi.is_success || false,
|
|
909
|
+
orderInfo: dataFormatter.formatOrder(orderConfirmationApi.order_info),
|
|
910
|
+
}
|
|
911
|
+
},
|
|
912
|
+
formatCoupons: (couponListApi?: CouponListApi): Coupon[] | null => {
|
|
913
|
+
if (!couponListApi?.items?.length) return null
|
|
914
|
+
return couponListApi.items.map((couponApi: CouponApi) => ({
|
|
915
|
+
code: couponApi?.code || '',
|
|
916
|
+
name: couponApi?.name || '',
|
|
917
|
+
thumbnail: couponApi?.thumbnail || '',
|
|
918
|
+
description: couponApi?.expired_date || '',
|
|
919
|
+
}))
|
|
920
|
+
},
|
|
921
|
+
formatShippings: (shippingsApi?: ShippingApi[]): Shipping[] => {
|
|
922
|
+
if (!shippingsApi) return [] as Shipping[]
|
|
923
|
+
|
|
924
|
+
return shippingsApi.map((shippingApi: ShippingApi) => ({
|
|
925
|
+
carrierCode: shippingApi.carrier_code || '',
|
|
926
|
+
methodCode: shippingApi.method_code || '',
|
|
927
|
+
title: shippingApi.carrier_title || '',
|
|
928
|
+
description: shippingApi.method_title || '',
|
|
929
|
+
price: shippingApi?.base_amount || 0,
|
|
930
|
+
thumbnail: shippingApi?.extension_attributes?.thumbnail || '',
|
|
931
|
+
}))
|
|
932
|
+
},
|
|
933
|
+
}
|