@hhgtech/hhg-components 1.29.332 → 1.29.334-beta-1
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/README.md +2 -0
- package/build/{LastPeriod-f1221bad.js → LastPeriod-b829cab9.js} +1 -1
- package/build/{MobileBottomNavigationIcon-0770acc1.js → MobileBottomNavigationIcon-57554ccb.js} +3 -3
- package/build/{Spinner-7719819a.js → Spinner-4f558116.js} +1 -1
- package/build/{WhatsApp-d2628e6a.js → WhatsApp-af0830fe.js} +1 -1
- package/build/adapters.js +19 -19
- package/build/atoms.js +49 -46
- package/build/babyGrowth.js +83 -83
- package/build/cache.js +2 -2
- package/build/care/components/organisms/bookingSearchBar/mobileTopbar/index.styled.d.ts +1 -1
- package/build/care/components/organisms/bookingSearchBar/resultSection/index.styled.d.ts +1 -1
- package/build/care/components/organisms/bookingSearchBar/resultSectionItem/index.styled.d.ts +1 -1
- package/build/care.js +17 -17
- package/build/careBookingSearchBar.js +14 -14
- package/build/careBookingSearchBarV2.js +15 -15
- package/build/components/adapters/button/index.d.ts +3 -1
- package/build/components/atoms/drawerComponent/index.d.ts +8 -0
- package/build/components/atoms/drawerComponent/index.styled.d.ts +7 -0
- package/build/components/atoms/googleLocation/index.d.ts +7 -0
- package/build/components/atoms/index.d.ts +1 -0
- package/build/components/mantine/text/index.d.ts +1 -1
- package/build/components/mantine/theme/other.d.ts +1 -1
- package/build/components/mantine/theme/text.d.ts +1 -0
- package/build/components.js +134 -131
- package/build/{constants-38e0dd27.js → constants-bbcf29ec.js} +1 -1
- package/build/constants.js +3 -3
- package/build/constantsDomainLocales.js +1 -1
- package/build/constantsRiskScreener.js +2 -2
- package/build/constantsSite.js +2 -2
- package/build/{core-6554e5d3.js → core-ceaaff44.js} +1 -1
- package/build/{dataTransform-bb9d60c1.js → dataTransform-744c0776.js} +1 -1
- package/build/ecom.js +4 -4
- package/build/{editor-07b39f82.js → editor-64f2bf27.js} +12 -11
- package/build/embeddedHeathToolCards_babyGrowth.js +23 -23
- package/build/embeddedHeathToolCards_babyPoop.js +19 -19
- package/build/embeddedHeathToolCards_babyVaccine.js +22 -22
- package/build/embeddedHeathToolCards_bmi_bmi.js +25 -25
- package/build/embeddedHeathToolCards_bmrBmr.js +25 -25
- package/build/embeddedHeathToolCards_dueDate_dueDate.js +22 -22
- package/build/embeddedHeathToolCards_ovulation_ovulation.js +22 -22
- package/build/embeddedHeathToolCards_pwg_pwg.js +26 -26
- package/build/embeddedHeathToolCards_targetHeartRate.js +27 -27
- package/build/esm/{LastPeriod-3e7641e1.js → LastPeriod-fd5114dd.js} +1 -1
- package/build/esm/{MobileBottomNavigationIcon-77a6e5d1.js → MobileBottomNavigationIcon-4e0fbb01.js} +3 -3
- package/build/esm/{Spinner-4cc30c73.js → Spinner-912c6f34.js} +1 -1
- package/build/esm/{WhatsApp-ec0a8966.js → WhatsApp-f2d8fb5b.js} +1 -1
- package/build/esm/adapters.js +19 -19
- package/build/esm/atoms.js +48 -46
- package/build/esm/babyGrowth.js +83 -83
- package/build/esm/cache.js +2 -2
- package/build/esm/care/components/organisms/bookingSearchBar/mobileTopbar/index.styled.d.ts +1 -1
- package/build/esm/care/components/organisms/bookingSearchBar/resultSection/index.styled.d.ts +1 -1
- package/build/esm/care/components/organisms/bookingSearchBar/resultSectionItem/index.styled.d.ts +1 -1
- package/build/esm/care.js +17 -17
- package/build/esm/careBookingSearchBar.js +14 -14
- package/build/esm/careBookingSearchBarV2.js +15 -15
- package/build/esm/components/adapters/button/index.d.ts +3 -1
- package/build/esm/components/atoms/drawerComponent/index.d.ts +8 -0
- package/build/esm/components/atoms/drawerComponent/index.styled.d.ts +7 -0
- package/build/esm/components/atoms/googleLocation/index.d.ts +7 -0
- package/build/esm/components/atoms/index.d.ts +1 -0
- package/build/esm/components/mantine/text/index.d.ts +1 -1
- package/build/esm/components/mantine/theme/other.d.ts +1 -1
- package/build/esm/components/mantine/theme/text.d.ts +1 -0
- package/build/esm/components.js +92 -90
- package/build/esm/{constants-6f9893fd.js → constants-09521ace.js} +1 -1
- package/build/esm/constants.js +3 -3
- package/build/esm/constantsDomainLocales.js +1 -1
- package/build/esm/constantsRiskScreener.js +2 -2
- package/build/esm/constantsSite.js +2 -2
- package/build/esm/{core-ab886886.js → core-56dc0f05.js} +1 -1
- package/build/esm/{dataTransform-f75c268c.js → dataTransform-e01a7da8.js} +1 -1
- package/build/esm/ecom.js +4 -4
- package/build/esm/{editor-1449176b.js → editor-30eaf984.js} +12 -12
- package/build/esm/embeddedHeathToolCards_babyGrowth.js +23 -23
- package/build/esm/embeddedHeathToolCards_babyPoop.js +19 -19
- package/build/esm/embeddedHeathToolCards_babyVaccine.js +22 -22
- package/build/esm/embeddedHeathToolCards_bmi_bmi.js +25 -25
- package/build/esm/embeddedHeathToolCards_bmrBmr.js +25 -25
- package/build/esm/embeddedHeathToolCards_dueDate_dueDate.js +22 -22
- package/build/esm/embeddedHeathToolCards_ovulation_ovulation.js +22 -22
- package/build/esm/embeddedHeathToolCards_pwg_pwg.js +26 -26
- package/build/esm/embeddedHeathToolCards_targetHeartRate.js +27 -27
- package/build/esm/footer.js +21 -21
- package/build/esm/gAssets.js +2 -2
- package/build/esm/healthToolsCardWrapper.js +18 -18
- package/build/esm/healthToolsForm.js +33 -33
- package/build/esm/hooks/usePlacesAutocomplete.d.ts +2 -0
- package/build/esm/hooks.js +13 -13
- package/build/esm/i18n/translationKeys.d.ts +1 -1
- package/build/esm/i18n-values/en-PH.js +16 -1
- package/build/esm/i18n-values/hi-IN.js +16 -1
- package/build/esm/i18n-values/id-ID.js +16 -1
- package/build/esm/i18n-values/km-KH.js +20 -5
- package/build/esm/i18n-values/ms-MY.js +16 -1
- package/build/esm/i18n-values/my-MM.js +16 -1
- package/build/esm/i18n-values/th-TH.js +16 -1
- package/build/esm/i18n-values/tl-PH.js +15 -0
- package/build/esm/i18n-values/vi-VN.js +18 -3
- package/build/esm/i18n-values/vi-VN_MB.js +17 -2
- package/build/esm/i18n-values/zh-TW.js +16 -1
- package/build/esm/i18n.js +2 -2
- package/build/esm/i18nV2.js +2 -2
- package/build/esm/icons/ChatbotBg.d.ts +4 -0
- package/build/esm/icons/Search.d.ts +4 -0
- package/build/esm/icons/index.d.ts +5 -3
- package/build/esm/{index-9f09e594.js → index-01b0835c.js} +20 -20
- package/build/esm/{index-340baab5.js → index-02d06202.js} +1 -1
- package/build/esm/{index-551006c8.js → index-114de66f.js} +15 -15
- package/build/esm/{index-cf7a91f6.js → index-11d07def.js} +2 -2
- package/build/esm/{index-ffd06730.js → index-1b3d0fb7.js} +13 -13
- package/build/esm/{index-553c50fe.js → index-262b1416.js} +2 -2
- package/build/esm/{index-c66fecf7.js → index-26e9ffe8.js} +6 -6
- package/build/esm/{index-598e5fc5.js → index-2a882430.js} +24 -24
- package/build/esm/{index-b862cd16.js → index-2ae8c1c0.js} +14 -14
- package/build/esm/{index-1b8bee31.js → index-34400a59.js} +2 -2
- package/build/esm/{index-9d368a52.js → index-363f17cf.js} +21 -21
- package/build/esm/{index-38378d3d.js → index-36bec6bb.js} +3 -3
- package/build/esm/{index-8d9be31d.js → index-37fb0987.js} +13 -13
- package/build/esm/{index-85de8bc8.js → index-386e43b1.js} +13 -13
- package/build/esm/{index-36987931.js → index-3992c8d4.js} +17 -17
- package/build/esm/{index-f553164d.js → index-3a8b29b4.js} +3 -3
- package/build/esm/{index-c55fb0c7.js → index-3b662cf8.js} +5 -5
- package/build/esm/{index-e68cca13.js → index-3e4223fe.js} +10 -10
- package/build/esm/{index-d15a459d.js → index-44932361.js} +17 -17
- package/build/esm/{index-be936e72.js → index-4d6b5301.js} +2 -2
- package/build/esm/{index-123655ef.js → index-50127890.js} +2 -2
- package/build/esm/{index-2f65032f.js → index-5acd728d.js} +6 -6
- package/build/esm/{index-db7f7f08.js → index-60bcab63.js} +1 -1
- package/build/esm/{index-13293188.js → index-6245b66b.js} +2 -2
- package/build/esm/{index-815dc140.js → index-662db5b7.js} +24 -24
- package/build/esm/{index-2a338d3f.js → index-663f72f5.js} +3 -3
- package/build/esm/{index-1da6b8c4.js → index-6a7614d1.js} +7 -7
- package/build/esm/{index-e975529a.js → index-6c5a0c74.js} +2 -2
- package/build/esm/index-6cf33c17.js +4013 -0
- package/build/esm/{index-230adb31.js → index-6fa5ac76.js} +3 -3
- package/build/esm/{index-9c14c4af.js → index-7418a32c.js} +2 -2
- package/build/esm/index-77225364.js +96 -0
- package/build/esm/{index-d7ffec42.js → index-7908e4ff.js} +16 -16
- package/build/esm/{index-587dca1f.js → index-7ed54614.js} +30 -30
- package/build/esm/{index-0982a002.js → index-7fee70e4.js} +3 -3
- package/build/esm/{index-0668f85c.js → index-813b32e4.js} +17 -17
- package/build/esm/{index-737db3be.js → index-81772684.js} +2 -2
- package/build/esm/{index-452968eb.js → index-89269f7e.js} +2 -2
- package/build/esm/{index-9eafbe6c.js → index-8dccb669.js} +18 -18
- package/build/esm/{index-945d5a71.js → index-915183b3.js} +1 -1
- package/build/esm/{index-c4b63c56.js → index-98ef5263.js} +3 -3
- package/build/esm/{index-521c6a0c.js → index-993de4d6.js} +13 -13
- package/build/esm/{index-3330a1a5.js → index-99655cbc.js} +2 -2
- package/build/esm/{index-cbe8ec85.js → index-9ab041aa.js} +1 -1
- package/build/esm/{index-eff9f904.js → index-a38d2351.js} +16 -16
- package/build/esm/{index-1853a9de.js → index-bb193a95.js} +1 -1
- package/build/esm/{index-bd313745.js → index-bd17eb4a.js} +18 -24
- package/build/esm/{index-cb6671de.js → index-c2325b70.js} +32 -32
- package/build/esm/{index-b87a8b69.js → index-cb0a2c0d.js} +7 -7
- package/build/esm/{index-5a1e82b3.js → index-cff2c593.js} +5 -5
- package/build/esm/{index-e9816b31.js → index-d53bf495.js} +15 -15
- package/build/esm/{index-1e12ffe2.js → index-d57214b0.js} +23 -13
- package/build/esm/{index-7052c7b0.js → index-db606269.js} +1 -1
- package/build/esm/{index-8d9e3179.js → index-dcb2ecbc.js} +2 -2
- package/build/esm/{index-3e8b2ccd.js → index-df46e084.js} +3 -3
- package/build/esm/{index-b8ca6394.js → index-e1ef9807.js} +2 -2
- package/build/esm/{index-94c25537.js → index-e422ad02.js} +1 -1
- package/build/esm/{index-79909b08.js → index-e47632c4.js} +4 -4
- package/build/esm/{index-526f2b6c.js → index-e9bc7d35.js} +16 -16
- package/build/esm/{index-2910ca55.js → index-eca43394.js} +16 -16
- package/build/esm/{index-adff8c44.js → index-ef1106eb.js} +6 -6
- package/build/esm/{index-bc0971ee.js → index-f8daa1b0.js} +1 -1
- package/build/esm/index.css +1 -1
- package/build/esm/index.js +146 -117
- package/build/esm/{labelSorting-cfc7acbd.js → labelSorting-7f70ac1e.js} +4 -4
- package/build/esm/lead/components/context.d.ts +2 -0
- package/build/esm/lead/components/index.d.ts +4 -2
- package/build/esm/lead/index.d.ts +1 -1
- package/build/esm/lead/layouts/ emptyIcon.d.ts +6 -0
- package/build/esm/lead/layouts/lightbox/fields/textField/index.d.ts +13 -0
- package/build/esm/lead/layouts/lightbox/fields/textField/index.styled.d.ts +11 -0
- package/build/esm/lead/layouts/lightbox/index.d.ts +4 -2
- package/build/esm/lead/newLeadPopup.d.ts +4 -2
- package/build/esm/lead.css +1 -1
- package/build/esm/lead.js +753 -350
- package/build/esm/{logoIcon-024fd614.js → logoIcon-b2e3b6df.js} +2 -2
- package/build/esm/mantine.js +25 -25
- package/build/esm/misc.js +16 -16
- package/build/esm/miscGetDynamicHealthTool.js +4 -4
- package/build/esm/miscGetSocialList.js +8 -8
- package/build/esm/miscScreenSizeContext.js +1 -1
- package/build/esm/mobileBottomNavigation.js +5 -5
- package/build/esm/mobileBottomNavigationIcon.js +5 -5
- package/build/esm/molecules.js +69 -69
- package/build/esm/moleculesArticleCard.js +6 -6
- package/build/esm/moleculesArticleCardV2.js +16 -16
- package/build/esm/navigation.js +40 -40
- package/build/esm/navigationLogoutPopup.js +9 -9
- package/build/esm/navigationProfileButton.js +23 -23
- package/build/esm/onboardingV2.js +29 -29
- package/build/esm/organisms.js +44 -44
- package/build/esm/{other-f9bf3f6d.js → other-0db5dab2.js} +1 -0
- package/build/esm/{post-126f46d9.js → post-403e7563.js} +3 -3
- package/build/esm/profileNavigation.js +19 -19
- package/build/esm/progressBar.js +1 -1
- package/build/esm/pwg.js +22 -22
- package/build/esm/ssoV2/api/featureFlag.d.ts +1 -0
- package/build/esm/ssoV2/api/index.d.ts +1 -0
- package/build/esm/ssoV2/api/paths.d.ts +7 -0
- package/build/esm/ssoV2/api/whatsapp.d.ts +6 -0
- package/build/esm/ssoV2/screens/components/progressBar.d.ts +3 -1
- package/build/esm/ssoV2/screens/components/whatsapp.d.ts +5 -0
- package/build/esm/ssoV2/screens/first/firstBFlow.d.ts +12 -0
- package/build/esm/ssoV2/screens/first/policyContent.d.ts +8 -0
- package/build/esm/ssoV2/screens/otp.d.ts +1 -1
- package/build/esm/ssoV2/ssoStateManager/store.d.ts +9 -1
- package/build/esm/ssoV2/utils.d.ts +6 -0
- package/build/esm/ssoV2.js +580 -142
- package/build/esm/{store-937026d6.js → store-d1eca1fa.js} +114 -9
- package/build/esm/subot.js +33 -33
- package/build/esm/surveyOrPremiumBanner.js +31 -31
- package/build/esm/surveyQuestionCard.js +10 -10
- package/build/esm/{surveyThankyouCard-dddd60e0.js → surveyThankyouCard-1386cdb8.js} +5 -5
- package/build/esm/together/api/paths.d.ts +2 -0
- package/build/esm/together/api/utils.d.ts +3 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/cardPostCommunity/index.d.ts +7 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/cardPostCommunity/index.styled.d.ts +5 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/commonCommunity/index.d.ts +15 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/commonCommunity/index.styled.d.ts +13 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/index.d.ts +31 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/index.styled.d.ts +9 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/index.styles.d.ts +12 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/suggestedCommunity/index.d.ts +11 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostCommunity/suggestedCommunity/index.styled.d.ts +17 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostDescription/editor.d.ts +21 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostDescription/index.d.ts +21 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostDescription/index.styled.d.ts +9 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostPhotos/index.d.ts +7 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostTitle/index.d.ts +11 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/createPostTitle/index.styled.d.ts +12 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/index.d.ts +27 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/index.styled.d.ts +33 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/postPhotosReview/index.d.ts +10 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/postPhotosReview/index.styled.d.ts +5 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/postPhotosReview/index.styles.d.ts +12 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/topicSelectList/index.d.ts +16 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/topicSelectList/index.styled.d.ts +5 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/type.d.ts +4 -0
- package/build/esm/together/components/molecules/createNewPostContentV2/types.d.ts +14 -0
- package/build/esm/together/components/molecules/index.d.ts +1 -0
- package/build/esm/together/components/molecules/postImagePreview/index.d.ts +2 -1
- package/build/esm/together/togetherComponentGlobalContext.d.ts +1 -0
- package/build/esm/together.js +53 -53
- package/build/esm/togetherApiPaths.js +4 -2
- package/build/esm/togetherApiUtils.js +4 -4
- package/build/esm/togetherAtoms.js +30 -30
- package/build/esm/togetherComponentGlobalContext.js +4 -4
- package/build/esm/togetherMolecules.js +48 -48
- package/build/esm/togetherMoleculesCardAuthor.js +27 -27
- package/build/esm/togetherMoleculesPostImagePreview.js +11 -11
- package/build/esm/togetherMoleculesProfileDetail.js +37 -37
- package/build/esm/togetherOrganisms.js +47 -47
- package/build/esm/togetherRichTextEditor.js +17 -17
- package/build/esm/togetherShareBox.js +11 -26
- package/build/esm/{treePopoverMenu-6d3392c6.js → treePopoverMenu-f031a29b.js} +19 -19
- package/build/esm/{types-787fdf6c.js → types-2fc793a8.js} +2 -2
- package/build/esm/types.js +2 -2
- package/build/esm/{useCategory-a0fa12e8.js → useCategory-ad6a4d34.js} +5 -5
- package/build/esm/{useHealthToolCache-7cf19f32.js → useHealthToolCache-28a49075.js} +1 -1
- package/build/esm/{useMantineLocale-5fd08281.js → useMantineLocale-1c095a66.js} +6 -6
- package/build/esm/{usePlacesAutocomplete-c942413f.js → usePlacesAutocomplete-1e1bf12f.js} +2 -1
- package/build/esm/{useScreenSize-11bcbfcc.js → useScreenSize-3a80d6c1.js} +2 -2
- package/build/esm/useTogetherAuthRequiredAction.js +9 -9
- package/build/esm/{utils-af3e4870.js → utils-2c532973.js} +2 -2
- package/build/esm/{utils-8b70a691.js → utils-d0d4f26f.js} +2 -2
- package/build/esm/{utils-b417174f.js → utils-d3ab24c2.js} +13 -4
- package/build/esm/vaccination.js +21 -21
- package/build/footer.js +21 -21
- package/build/gAssets.js +2 -2
- package/build/healthToolsCardWrapper.js +18 -18
- package/build/healthToolsForm.js +33 -33
- package/build/hooks/usePlacesAutocomplete.d.ts +2 -0
- package/build/hooks.js +13 -13
- package/build/i18n/translationKeys.d.ts +1 -1
- package/build/i18n-values/en-PH.js +16 -1
- package/build/i18n-values/hi-IN.js +16 -1
- package/build/i18n-values/id-ID.js +16 -1
- package/build/i18n-values/km-KH.js +20 -5
- package/build/i18n-values/ms-MY.js +16 -1
- package/build/i18n-values/my-MM.js +16 -1
- package/build/i18n-values/th-TH.js +16 -1
- package/build/i18n-values/tl-PH.js +15 -0
- package/build/i18n-values/vi-VN.js +18 -3
- package/build/i18n-values/vi-VN_MB.js +17 -2
- package/build/i18n-values/zh-TW.js +16 -1
- package/build/i18n.js +1 -1
- package/build/i18nV2.js +1 -1
- package/build/icons/ChatbotBg.d.ts +4 -0
- package/build/icons/Search.d.ts +4 -0
- package/build/icons/index.d.ts +5 -3
- package/build/{index-eb99216b.js → index-0130a454.js} +2 -2
- package/build/{index-7ea932b9.js → index-0b1c5835.js} +17 -17
- package/build/{index-9ff1bb36.js → index-14ae8248.js} +3 -3
- package/build/{index-8c16bd1f.js → index-15a499ed.js} +2 -2
- package/build/{index-3432b1c6.js → index-162cf5ec.js} +13 -13
- package/build/{index-c297b1f0.js → index-168cb23c.js} +20 -20
- package/build/{index-d1c81e81.js → index-193192d9.js} +1 -1
- package/build/{index-4fc7edb3.js → index-1a1895dc.js} +6 -6
- package/build/{index-18f346d7.js → index-235ee6a4.js} +1 -1
- package/build/{index-4bf4104b.js → index-24744e1d.js} +2 -2
- package/build/{index-3ebe1824.js → index-24ad1f42.js} +13 -13
- package/build/{index-e82361de.js → index-24dc48d7.js} +3 -3
- package/build/{index-ecd3b645.js → index-29a53d3c.js} +2 -2
- package/build/{index-cf29a8cb.js → index-38aa9aae.js} +1 -1
- package/build/{index-beeded5c.js → index-393e9124.js} +2 -2
- package/build/{index-4f94ee57.js → index-396aca20.js} +3 -3
- package/build/{index-9c5bf014.js → index-3ec47f62.js} +1 -1
- package/build/{index-49c62b30.js → index-40a47778.js} +10 -10
- package/build/{index-b664e501.js → index-48ead17e.js} +3 -3
- package/build/{index-1f6f7242.js → index-4c063acd.js} +6 -6
- package/build/{index-7b9dff6f.js → index-50394ff2.js} +16 -16
- package/build/{index-3af36119.js → index-591ad0ca.js} +1 -1
- package/build/{index-ccb74872.js → index-5d8baaf6.js} +1 -1
- package/build/{index-81a129cd.js → index-5ddf7e2d.js} +1 -1
- package/build/{index-a9c442d7.js → index-62fbd1d0.js} +2 -2
- package/build/{index-68f35f42.js → index-6ea74eeb.js} +24 -24
- package/build/{index-b0471cfe.js → index-7017d901.js} +5 -5
- package/build/{index-559021c0.js → index-7ca5e861.js} +3 -3
- package/build/{index-7a0d23fd.js → index-7d255c7b.js} +7 -7
- package/build/{index-0ef028da.js → index-7d868903.js} +3 -3
- package/build/{index-37407423.js → index-7dc1bc92.js} +2 -2
- package/build/{index-532b1cd6.js → index-814045ef.js} +2 -2
- package/build/{index-192e338c.js → index-82632b4a.js} +17 -17
- package/build/{index-145fe27d.js → index-8976b33e.js} +18 -18
- package/build/{index-0b869059.js → index-8e25c967.js} +2 -2
- package/build/{index-0c875dfb.js → index-94a58e2b.js} +17 -17
- package/build/{index-01d1fcca.js → index-997d3769.js} +3 -3
- package/build/{index-68d28651.js → index-9a11ed37.js} +32 -32
- package/build/{index-a8e7297d.js → index-9e9a9169.js} +15 -15
- package/build/{index-b4169dcd.js → index-9fb3018a.js} +18 -24
- package/build/{index-b6555da2.js → index-a2924e1e.js} +6 -6
- package/build/{index-2cfe485f.js → index-a9722b58.js} +4 -4
- package/build/{index-4e3d0ce7.js → index-aa89a022.js} +13 -13
- package/build/{index-f194fe0a.js → index-b0c5d4ef.js} +16 -16
- package/build/{index-31e8674f.js → index-b3e0585e.js} +23 -12
- package/build/{index-7a077f5a.js → index-b3fb752f.js} +16 -16
- package/build/{index-af7ec0fa.js → index-b51c88e2.js} +14 -14
- package/build/{index-cd1c7203.js → index-b5cd6a21.js} +5 -5
- package/build/{index-a336f953.js → index-b6847418.js} +2 -2
- package/build/index-c10d9832.js +4047 -0
- package/build/{index-d8846871.js → index-c5376e9c.js} +16 -16
- package/build/index-d699cb98.js +103 -0
- package/build/{index-cf488262.js → index-dc3ef09a.js} +2 -2
- package/build/{index-d4ff6de4.js → index-e294968d.js} +1 -1
- package/build/{index-08ed5b29.js → index-e8ad0b71.js} +30 -30
- package/build/{index-7097786d.js → index-e8b1a161.js} +15 -15
- package/build/{index-0f12f189.js → index-ec184323.js} +21 -21
- package/build/{index-b35e6f64.js → index-ec9f092e.js} +24 -24
- package/build/{index-02ceb781.js → index-ef816e26.js} +7 -7
- package/build/{index-e55fc286.js → index-f5666a40.js} +2 -2
- package/build/{index-64199471.js → index-f888f598.js} +13 -13
- package/build/{index-e3c1a688.js → index-fd3183da.js} +2 -2
- package/build/index.css +1 -1
- package/build/index.js +211 -178
- package/build/{labelSorting-59b40f42.js → labelSorting-469fb53d.js} +4 -4
- package/build/lead/components/context.d.ts +2 -0
- package/build/lead/components/index.d.ts +4 -2
- package/build/lead/index.d.ts +1 -1
- package/build/lead/layouts/ emptyIcon.d.ts +6 -0
- package/build/lead/layouts/lightbox/fields/textField/index.d.ts +13 -0
- package/build/lead/layouts/lightbox/fields/textField/index.styled.d.ts +11 -0
- package/build/lead/layouts/lightbox/index.d.ts +4 -2
- package/build/lead/newLeadPopup.d.ts +4 -2
- package/build/lead.css +1 -1
- package/build/lead.js +753 -349
- package/build/{logoIcon-07538b4d.js → logoIcon-f8693e15.js} +2 -2
- package/build/mantine.js +22 -22
- package/build/misc.js +16 -16
- package/build/miscGetDynamicHealthTool.js +4 -4
- package/build/miscGetSocialList.js +8 -8
- package/build/miscScreenSizeContext.js +1 -1
- package/build/mobileBottomNavigation.js +5 -5
- package/build/mobileBottomNavigationIcon.js +5 -5
- package/build/molecules.js +69 -69
- package/build/moleculesArticleCard.js +6 -6
- package/build/moleculesArticleCardV2.js +16 -16
- package/build/navigation.js +40 -40
- package/build/navigationLogoutPopup.js +9 -9
- package/build/navigationProfileButton.js +23 -23
- package/build/onboardingV2.js +28 -28
- package/build/organisms.js +44 -44
- package/build/{other-8c01b366.js → other-50a0b3de.js} +1 -0
- package/build/{post-1e4e6b72.js → post-cd6c6c29.js} +2 -2
- package/build/profileNavigation.js +19 -19
- package/build/progressBar.js +1 -1
- package/build/pwg.js +22 -22
- package/build/ssoV2/api/featureFlag.d.ts +1 -0
- package/build/ssoV2/api/index.d.ts +1 -0
- package/build/ssoV2/api/paths.d.ts +7 -0
- package/build/ssoV2/api/whatsapp.d.ts +6 -0
- package/build/ssoV2/screens/components/progressBar.d.ts +3 -1
- package/build/ssoV2/screens/components/whatsapp.d.ts +5 -0
- package/build/ssoV2/screens/first/firstBFlow.d.ts +12 -0
- package/build/ssoV2/screens/first/policyContent.d.ts +8 -0
- package/build/ssoV2/screens/otp.d.ts +1 -1
- package/build/ssoV2/ssoStateManager/store.d.ts +9 -1
- package/build/ssoV2/utils.d.ts +6 -0
- package/build/ssoV2.js +591 -153
- package/build/{store-d0c4a5e4.js → store-a713b63a.js} +114 -8
- package/build/subot.js +32 -32
- package/build/surveyOrPremiumBanner.js +31 -31
- package/build/surveyQuestionCard.js +10 -10
- package/build/{surveyThankyouCard-93c2b9e1.js → surveyThankyouCard-80794b25.js} +5 -5
- package/build/together/api/paths.d.ts +2 -0
- package/build/together/api/utils.d.ts +3 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/cardPostCommunity/index.d.ts +7 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/cardPostCommunity/index.styled.d.ts +5 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/commonCommunity/index.d.ts +15 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/commonCommunity/index.styled.d.ts +13 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/index.d.ts +31 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/index.styled.d.ts +9 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/index.styles.d.ts +12 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/suggestedCommunity/index.d.ts +11 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostCommunity/suggestedCommunity/index.styled.d.ts +17 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostDescription/editor.d.ts +21 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostDescription/index.d.ts +21 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostDescription/index.styled.d.ts +9 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostPhotos/index.d.ts +7 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostTitle/index.d.ts +11 -0
- package/build/together/components/molecules/createNewPostContentV2/createPostTitle/index.styled.d.ts +12 -0
- package/build/together/components/molecules/createNewPostContentV2/index.d.ts +27 -0
- package/build/together/components/molecules/createNewPostContentV2/index.styled.d.ts +33 -0
- package/build/together/components/molecules/createNewPostContentV2/postPhotosReview/index.d.ts +10 -0
- package/build/together/components/molecules/createNewPostContentV2/postPhotosReview/index.styled.d.ts +5 -0
- package/build/together/components/molecules/createNewPostContentV2/postPhotosReview/index.styles.d.ts +12 -0
- package/build/together/components/molecules/createNewPostContentV2/topicSelectList/index.d.ts +16 -0
- package/build/together/components/molecules/createNewPostContentV2/topicSelectList/index.styled.d.ts +5 -0
- package/build/together/components/molecules/createNewPostContentV2/type.d.ts +4 -0
- package/build/together/components/molecules/createNewPostContentV2/types.d.ts +14 -0
- package/build/together/components/molecules/index.d.ts +1 -0
- package/build/together/components/molecules/postImagePreview/index.d.ts +2 -1
- package/build/together/togetherComponentGlobalContext.d.ts +1 -0
- package/build/together.js +54 -53
- package/build/togetherApiPaths.js +4 -2
- package/build/togetherApiUtils.js +5 -4
- package/build/togetherAtoms.js +30 -30
- package/build/togetherComponentGlobalContext.js +4 -4
- package/build/togetherMolecules.js +49 -48
- package/build/togetherMoleculesCardAuthor.js +27 -27
- package/build/togetherMoleculesPostImagePreview.js +11 -11
- package/build/togetherMoleculesProfileDetail.js +37 -37
- package/build/togetherOrganisms.js +47 -47
- package/build/togetherRichTextEditor.js +17 -17
- package/build/togetherShareBox.js +11 -26
- package/build/{treePopoverMenu-9c6f299f.js → treePopoverMenu-889d80ba.js} +19 -19
- package/build/{types-98e7c3a2.js → types-0c05791e.js} +2 -2
- package/build/types.js +2 -2
- package/build/{useCategory-7a1ab711.js → useCategory-55a423cc.js} +5 -5
- package/build/{useHealthToolCache-82b1911f.js → useHealthToolCache-84921b9b.js} +1 -1
- package/build/{useMantineLocale-d9ecaa5f.js → useMantineLocale-0cc2d977.js} +6 -6
- package/build/{usePlacesAutocomplete-67fa9759.js → usePlacesAutocomplete-07762c76.js} +2 -1
- package/build/{useScreenSize-b40e4305.js → useScreenSize-c85a7f01.js} +2 -2
- package/build/useTogetherAuthRequiredAction.js +9 -9
- package/build/{utils-4c1a6793.js → utils-44d3d6e7.js} +2 -2
- package/build/{utils-6761a983.js → utils-872abd64.js} +2 -2
- package/build/{utils-c69ec5e6.js → utils-c1ec3cc4.js} +13 -3
- package/build/vaccination.js +21 -21
- package/package.json +1 -1
- package/build/esm/index-c21e43f7.js +0 -1533
- package/build/index-1596c959.js +0 -1547
- /package/build/{BMI_BOYS.percentile.monthly-2f2f928d.js → BMI_BOYS.percentile.monthly-6337a2c7.js} +0 -0
- /package/build/{BMI_BOYS.percentile.weekly-7e24810c.js → BMI_BOYS.percentile.weekly-fa39b2e6.js} +0 -0
- /package/build/{BMI_BOYS.percentile.yearly-81f8dac9.js → BMI_BOYS.percentile.yearly-1eaf306b.js} +0 -0
- /package/build/{BMI_BOYS.zscore.monthly-a1363b20.js → BMI_BOYS.zscore.monthly-851088df.js} +0 -0
- /package/build/{BMI_BOYS.zscore.weekly-ba2583ff.js → BMI_BOYS.zscore.weekly-175cdc97.js} +0 -0
- /package/build/{BMI_BOYS.zscore.yearly-62c54183.js → BMI_BOYS.zscore.yearly-5937ecfa.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.monthly-98bfbad1.js → BMI_GIRLS.percentile.monthly-8073e552.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.weekly-036ea7b6.js → BMI_GIRLS.percentile.weekly-5c7a9b5f.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.yearly-23c106af.js → BMI_GIRLS.percentile.yearly-7462e3cf.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.monthly-b355926b.js → BMI_GIRLS.zscore.monthly-2e1abf01.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.weekly-7f660a6e.js → BMI_GIRLS.zscore.weekly-a27d90ae.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.yearly-dcd261ee.js → BMI_GIRLS.zscore.yearly-199d33bc.js} +0 -0
- /package/build/{ChevronDown-9d3d7b9c.js → ChevronDown-6646fd47.js} +0 -0
- /package/build/{Close-088d8ac5.js → Close-acfa8c86.js} +0 -0
- /package/build/{Google-25f7be94.js → Google-3e0ecf57.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-ffbc283d.js → HEAD CIRCUM_BOYS.percentile.monthly-c39e84b8.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-eb80ed27.js → HEAD CIRCUM_BOYS.percentile.weekly-17a9f67f.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-cfd524be.js → HEAD CIRCUM_BOYS.percentile.yearly-53db10b8.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-9c834e4c.js → HEAD CIRCUM_BOYS.zscore.monthly-9024b5f9.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-bf24e14d.js → HEAD CIRCUM_BOYS.zscore.weekly-93e16617.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-33244c0b.js → HEAD CIRCUM_BOYS.zscore.yearly-32adcfa6.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-2119f263.js → HEAD CIRCUM_GIRLS.percentile.monthly-4ee6667f.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-76f04daa.js → HEAD CIRCUM_GIRLS.percentile.weekly-ddf49204.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-80b14bf5.js → HEAD CIRCUM_GIRLS.percentile.yearly-6d6a8456.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-0dc71b80.js → HEAD CIRCUM_GIRLS.zscore.monthly-5de917f7.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-b179533a.js → HEAD CIRCUM_GIRLS.zscore.weekly-716eac35.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-6c2c43d7.js → HEAD CIRCUM_GIRLS.zscore.yearly-b6b319cb.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.monthly-fd53ff3a.js → HEIGHT_BOYS.percentile.monthly-0b9355cf.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.weekly-bea10e78.js → HEIGHT_BOYS.percentile.weekly-91f90514.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.yearly-d005441d.js → HEIGHT_BOYS.percentile.yearly-a6be39f1.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.monthly-d5871f7f.js → HEIGHT_BOYS.zscore.monthly-5c280bcc.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.weekly-c7a971d5.js → HEIGHT_BOYS.zscore.weekly-8892a3e2.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.yearly-e0daca1d.js → HEIGHT_BOYS.zscore.yearly-e22fdc89.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.monthly-16a28494.js → HEIGHT_GIRLS.percentile.monthly-203d80e4.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.weekly-f72c6498.js → HEIGHT_GIRLS.percentile.weekly-b70110c1.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.yearly-e639e06e.js → HEIGHT_GIRLS.percentile.yearly-4673ac32.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.monthly-49ee3f65.js → HEIGHT_GIRLS.zscore.monthly-04a15496.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.weekly-75b6db14.js → HEIGHT_GIRLS.zscore.weekly-f2a6e2f3.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.yearly-7f170e82.js → HEIGHT_GIRLS.zscore.yearly-146a83ba.js} +0 -0
- /package/build/{Locale-9d76089c.js → Locale-46500920.js} +0 -0
- /package/build/{Visible-f7357dea.js → Visible-b2ca2811.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.monthly-09c9209a.js → WEIGHT_BOYS.percentile.monthly-ce64c00f.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.weekly-13f6c1fa.js → WEIGHT_BOYS.percentile.weekly-d8b54060.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.yearly-cf517b5f.js → WEIGHT_BOYS.percentile.yearly-b1a691e5.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.monthly-3af2f51a.js → WEIGHT_BOYS.zscore.monthly-b8180ab3.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.weekly-ec101877.js → WEIGHT_BOYS.zscore.weekly-6efaa547.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.yearly-dd575af7.js → WEIGHT_BOYS.zscore.yearly-ff104f70.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.monthly-106e896d.js → WEIGHT_GIRLS.percentile.monthly-ffe5fb55.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.weekly-53154421.js → WEIGHT_GIRLS.percentile.weekly-7f9490d0.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.yearly-3e01a7ca.js → WEIGHT_GIRLS.percentile.yearly-99f26592.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.monthly-035a8445.js → WEIGHT_GIRLS.zscore.monthly-7ef27570.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.weekly-de0848cb.js → WEIGHT_GIRLS.zscore.weekly-4b489c3f.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.yearly-34e0310d.js → WEIGHT_GIRLS.zscore.yearly-25f8790b.js} +0 -0
- /package/build/{animation-b679f087.js → animation-ed541692.js} +0 -0
- /package/build/{constants-a9df2dc4.js → constants-3b2ad03d.js} +0 -0
- /package/build/{constants-c590c60e.js → constants-7fc2f0d3.js} +0 -0
- /package/build/{constants-1b37a00c.js → constants-eb2323ad.js} +0 -0
- /package/build/{dataTransform-946e1e43.js → dataTransform-ed9d25b3.js} +0 -0
- /package/build/{doctor-e7e731d5.js → doctor-45a98dfc.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.monthly-749f4ff1.js → BMI_BOYS.percentile.monthly-f2cf5eae.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.weekly-1b0d8d77.js → BMI_BOYS.percentile.weekly-0145a904.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.yearly-2d99a39a.js → BMI_BOYS.percentile.yearly-67c360ab.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.monthly-3aa69438.js → BMI_BOYS.zscore.monthly-4016078d.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.weekly-da93e931.js → BMI_BOYS.zscore.weekly-f40a0cf4.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.yearly-b0c89cae.js → BMI_BOYS.zscore.yearly-9784ed8c.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.monthly-92457f2e.js → BMI_GIRLS.percentile.monthly-bd8a858b.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.weekly-73b416b8.js → BMI_GIRLS.percentile.weekly-0629c8ac.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.yearly-02cd164f.js → BMI_GIRLS.percentile.yearly-31ec01f4.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.monthly-43e43cfd.js → BMI_GIRLS.zscore.monthly-3c941b8a.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.weekly-f4bfe5f4.js → BMI_GIRLS.zscore.weekly-67d9e952.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.yearly-6a2ad249.js → BMI_GIRLS.zscore.yearly-39bb1163.js} +0 -0
- /package/build/esm/{ChevronDown-b8d5b3a6.js → ChevronDown-0a237fe1.js} +0 -0
- /package/build/esm/{Close-29383bc8.js → Close-8ec53854.js} +0 -0
- /package/build/esm/{Google-8ccb1c86.js → Google-2abb6d1e.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-6dcfff5c.js → HEAD CIRCUM_BOYS.percentile.monthly-5af4c0cf.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-ba419b4a.js → HEAD CIRCUM_BOYS.percentile.weekly-8b55aea6.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-20a6e1d1.js → HEAD CIRCUM_BOYS.percentile.yearly-00c4cd86.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-8d4a3ac8.js → HEAD CIRCUM_BOYS.zscore.monthly-fa7f6d17.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-975f4471.js → HEAD CIRCUM_BOYS.zscore.weekly-412720ed.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-8ad8ad71.js → HEAD CIRCUM_BOYS.zscore.yearly-933cf312.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-71269cc3.js → HEAD CIRCUM_GIRLS.percentile.monthly-7dbd4c64.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-186275c1.js → HEAD CIRCUM_GIRLS.percentile.weekly-145fae5a.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-ce02adcd.js → HEAD CIRCUM_GIRLS.percentile.yearly-ed8721c1.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-ab37a6bd.js → HEAD CIRCUM_GIRLS.zscore.monthly-6270e769.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-1c138752.js → HEAD CIRCUM_GIRLS.zscore.weekly-68dfc85f.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-e9f86886.js → HEAD CIRCUM_GIRLS.zscore.yearly-bad5818a.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.monthly-34ed5c0d.js → HEIGHT_BOYS.percentile.monthly-409700e6.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.weekly-829700ee.js → HEIGHT_BOYS.percentile.weekly-a3239541.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.yearly-ec71a3fa.js → HEIGHT_BOYS.percentile.yearly-9b7c3292.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.monthly-8b4e2a97.js → HEIGHT_BOYS.zscore.monthly-384eb890.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.weekly-86b61e9a.js → HEIGHT_BOYS.zscore.weekly-f11a3f12.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.yearly-602fddbe.js → HEIGHT_BOYS.zscore.yearly-cf037809.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-d2ecb80e.js → HEIGHT_GIRLS.percentile.monthly-e6a77a33.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-a3f105d3.js → HEIGHT_GIRLS.percentile.weekly-dfd33b25.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-9f1734f2.js → HEIGHT_GIRLS.percentile.yearly-9c893db0.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-e44d78d7.js → HEIGHT_GIRLS.zscore.monthly-db8fff55.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-92a73070.js → HEIGHT_GIRLS.zscore.weekly-8698b559.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-9fbb071d.js → HEIGHT_GIRLS.zscore.yearly-a8818df0.js} +0 -0
- /package/build/esm/{Locale-22ec3908.js → Locale-00bfd7ae.js} +0 -0
- /package/build/esm/{Visible-bb919e6d.js → Visible-ea326bdf.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.monthly-0aa80f60.js → WEIGHT_BOYS.percentile.monthly-ed97a016.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.weekly-cd67b3db.js → WEIGHT_BOYS.percentile.weekly-52b2ba8f.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.yearly-c424241d.js → WEIGHT_BOYS.percentile.yearly-938fb5ab.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.monthly-699042b7.js → WEIGHT_BOYS.zscore.monthly-9cedf9fe.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.weekly-29afee99.js → WEIGHT_BOYS.zscore.weekly-5661c740.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.yearly-c611c753.js → WEIGHT_BOYS.zscore.yearly-553b054d.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-319b82bc.js → WEIGHT_GIRLS.percentile.monthly-db164c0b.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-17db85b6.js → WEIGHT_GIRLS.percentile.weekly-f6bf7418.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-95ad118d.js → WEIGHT_GIRLS.percentile.yearly-014f7957.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-f1d157a9.js → WEIGHT_GIRLS.zscore.monthly-fda7dd74.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-847a6e3b.js → WEIGHT_GIRLS.zscore.weekly-136807df.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-3a824923.js → WEIGHT_GIRLS.zscore.yearly-2e586fff.js} +0 -0
- /package/build/esm/{animation-9d4336ef.js → animation-07c05d28.js} +0 -0
- /package/build/esm/{constants-6b039ef7.js → constants-7afbacd8.js} +0 -0
- /package/build/esm/{constants-c3212847.js → constants-8fbe2670.js} +0 -0
- /package/build/esm/{constants-2e19be73.js → constants-dc697937.js} +0 -0
- /package/build/esm/{dataTransform-d0cf26c9.js → dataTransform-ecd54e69.js} +0 -0
- /package/build/esm/{doctor-3cc8fc7d.js → doctor-17090568.js} +0 -0
- /package/build/esm/{index-d247dffe.js → index-000e0e9e.js} +0 -0
- /package/build/esm/{index-f7ad233d.js → index-0942d379.js} +0 -0
- /package/build/esm/{index-87e4c6b1.js → index-1befcee7.js} +0 -0
- /package/build/esm/{index-acef2a62.js → index-2e55cfda.js} +0 -0
- /package/build/esm/{index-5182c746.js → index-5cec6573.js} +0 -0
- /package/build/esm/{index-6e29e7f0.js → index-a0303055.js} +0 -0
- /package/build/esm/{index-b199d103.js → index-a232379f.js} +0 -0
- /package/build/esm/{index-10cef35f.js → index-d0f53887.js} +0 -0
- /package/build/esm/{index-1a5534b7.js → index-fdc14c24.js} +0 -0
- /package/build/esm/{index.styles-4e255421.js → index.styles-d02c3a5a.js} +0 -0
- /package/build/esm/{localizeNumberFormat-d6346829.js → localizeNumberFormat-6de5a75e.js} +0 -0
- /package/build/esm/{normalizeLink-5406e34c.js → normalizeLink-43a86413.js} +0 -0
- /package/build/esm/{paths-e6e0ed3e.js → paths-035cff11.js} +0 -0
- /package/build/esm/{translationsContext-7f3cb10c.js → translationsContext-10772791.js} +0 -0
- /package/build/esm/{tslib.es6-8b49e916.js → tslib.es6-e23bfd26.js} +0 -0
- /package/build/esm/{types-207cd2ab.js → types-34201c73.js} +0 -0
- /package/build/esm/{useIsInit-73176efd.js → useIsInit-6477f3a4.js} +0 -0
- /package/build/esm/{useOutsideClick-cdf878ef.js → useOutsideClick-6c9cf98a.js} +0 -0
- /package/build/esm/{useScrollbarSize-e0da9043.js → useScrollbarSize-6473c2fd.js} +0 -0
- /package/build/esm/{useUniqueId-30da00de.js → useUniqueId-5817d5a2.js} +0 -0
- /package/build/esm/{utils-8921b115.js → utils-cdbd3de5.js} +0 -0
- /package/build/{index-972f0263.js → index-098fed08.js} +0 -0
- /package/build/{index-05dda990.js → index-0d70f22c.js} +0 -0
- /package/build/{index-12dcc550.js → index-0dc126e4.js} +0 -0
- /package/build/{index-3b7bc531.js → index-3231a973.js} +0 -0
- /package/build/{index-ac33274a.js → index-3ae84344.js} +0 -0
- /package/build/{index-db8e29db.js → index-71c3d68d.js} +0 -0
- /package/build/{index-9fc5a7e8.js → index-741c96d4.js} +0 -0
- /package/build/{index-a8aaf35d.js → index-7541c6b0.js} +0 -0
- /package/build/{index-b1eb912c.js → index-a19550a4.js} +0 -0
- /package/build/{index.styles-92031143.js → index.styles-4b68abeb.js} +0 -0
- /package/build/{localizeNumberFormat-064f9c12.js → localizeNumberFormat-59035008.js} +0 -0
- /package/build/{normalizeLink-79a136d4.js → normalizeLink-28829417.js} +0 -0
- /package/build/{paths-db1ac919.js → paths-4921d775.js} +0 -0
- /package/build/{translationsContext-4f392f72.js → translationsContext-eb09f732.js} +0 -0
- /package/build/{tslib.es6-39b96c18.js → tslib.es6-19c55cc8.js} +0 -0
- /package/build/{types-4efa0b4d.js → types-3cfdfed1.js} +0 -0
- /package/build/{useIsInit-b3f040cc.js → useIsInit-bee13c08.js} +0 -0
- /package/build/{useOutsideClick-4ab98215.js → useOutsideClick-f77588fe.js} +0 -0
- /package/build/{useScrollbarSize-ec9ed0a7.js → useScrollbarSize-12f1eea9.js} +0 -0
- /package/build/{useUniqueId-b9cbf69c.js → useUniqueId-98ff449d.js} +0 -0
- /package/build/{utils-2fec8698.js → utils-ca036bb9.js} +0 -0
|
@@ -0,0 +1,4013 @@
|
|
|
1
|
+
import { a as __awaiter, _ as __rest } from './tslib.es6-e23bfd26.js';
|
|
2
|
+
import React__default, { useState, useRef, useEffect, useCallback, useContext, useMemo } from 'react';
|
|
3
|
+
import { Info, Ask } from '@hhgtech/icons/other';
|
|
4
|
+
import { D as Dropdown } from './index-5cec6573.js';
|
|
5
|
+
import { u as useTranslations } from './index-e422ad02.js';
|
|
6
|
+
import innertext from 'innertext';
|
|
7
|
+
import { theme } from './miscTheme.js';
|
|
8
|
+
import { I as Input$1 } from './index-2ae8c1c0.js';
|
|
9
|
+
import { useMantineTheme, Switch, Popover } from '@mantine/core';
|
|
10
|
+
import '@mantine/dates';
|
|
11
|
+
import './index-81772684.js';
|
|
12
|
+
import './index-02d06202.js';
|
|
13
|
+
import './index-000e0e9e.js';
|
|
14
|
+
import './useMantineLocale-1c095a66.js';
|
|
15
|
+
import { T as Text } from './index-262b1416.js';
|
|
16
|
+
import { B as Button } from './index-11d07def.js';
|
|
17
|
+
import './index.styles-d02c3a5a.js';
|
|
18
|
+
import '@mantine/hooks';
|
|
19
|
+
import { M as MediaQueries } from './utils-cdbd3de5.js';
|
|
20
|
+
import './other-0db5dab2.js';
|
|
21
|
+
import './index-df46e084.js';
|
|
22
|
+
import { u as useImagePicker, a as PopupFrame, d as IconCloseCircle, g as getDefaultFailNoti, e as getPostFormData, f as editPost, h as createPost } from './index-bd17eb4a.js';
|
|
23
|
+
import { T as TogetherComponentGlobalContext, c as callApi, d as getApiPath, p as getCurrentHref, b as callApiWithAuth, q as callApiWithAdminAuth, k as getCurrentBaseUrl, r as getChatbotAiApiPath } from './utils-d3ab24c2.js';
|
|
24
|
+
import styled from '@emotion/styled';
|
|
25
|
+
import { b as formatPost, c as formatTopic } from './dataTransform-e01a7da8.js';
|
|
26
|
+
import { M as MAX_IMAGE_UPLOADS, B as BEARER_TOKEN_COOKIE } from './constants-dc697937.js';
|
|
27
|
+
import { h as highlightBadWords, f as fixMalformedMention, r as removeFontFormat, a as removeEdittedBannedWord, w as wrapAnchorAroundUrls, g as getUrlsFromEditorString, A as ALLOW_DOMAIN_URL, e as escapeRegExp, d as decodeMention, b as decodePostUrl, c as reformatUrl, i as getMentionIdsFromString, L as LIMIT_MENTION } from './post-403e7563.js';
|
|
28
|
+
import { C as CardAuthor, L as Loading$1 } from './index-d53bf495.js';
|
|
29
|
+
import { S as StyledCreatePostDescription$1, R as RichTextEditor$1, I as IconLink } from './editor-30eaf984.js';
|
|
30
|
+
import { I as Input } from './index-99655cbc.js';
|
|
31
|
+
import debounce from 'lodash/debounce';
|
|
32
|
+
import ContentEditable from 'react-contenteditable';
|
|
33
|
+
import { PATHS, ADMIN_PATHS } from './togetherApiPaths.js';
|
|
34
|
+
import { L as Loading } from './index-7418a32c.js';
|
|
35
|
+
import { C as CardLink } from './index-cff2c593.js';
|
|
36
|
+
import { B as BtnChoice } from './index-915183b3.js';
|
|
37
|
+
import { L as LOCALE } from './Locale-00bfd7ae.js';
|
|
38
|
+
import * as ReactDOM from 'react-dom';
|
|
39
|
+
import { b as IconArrowLeft } from './index-d57214b0.js';
|
|
40
|
+
import { B as Button$1 } from './index-34400a59.js';
|
|
41
|
+
import { getCookie } from './miscCookieHelper.js';
|
|
42
|
+
import { a as useUniqueId } from './useUniqueId-5817d5a2.js';
|
|
43
|
+
import { U as UserAvatar } from './index-dcb2ecbc.js';
|
|
44
|
+
import { P as PopoverMenu } from './index-4d6b5301.js';
|
|
45
|
+
import { Close, Check } from '@hhgtech/icons/core';
|
|
46
|
+
|
|
47
|
+
const StyledCreateNewPost$1 = styled.div `
|
|
48
|
+
position: relative;
|
|
49
|
+
display: flex;
|
|
50
|
+
height: 100%;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
padding: 16px 24px;
|
|
53
|
+
|
|
54
|
+
${MediaQueries.mbDown} {
|
|
55
|
+
padding: 16px 16px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.input-group-container {
|
|
59
|
+
flex: 1;
|
|
60
|
+
padding-right: 2px;
|
|
61
|
+
padding-left: 2px;
|
|
62
|
+
margin-bottom: 24px;
|
|
63
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
64
|
+
overflow-y: auto;
|
|
65
|
+
scrollbar-width: none; /* Firefox */
|
|
66
|
+
&::-webkit-scrollbar {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.input-group {
|
|
72
|
+
:not(:last-child) {
|
|
73
|
+
margin-bottom: 0.6rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
input:focus,
|
|
77
|
+
textarea:focus,
|
|
78
|
+
[contenteditable='true'] {
|
|
79
|
+
outline: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
label {
|
|
83
|
+
margin-bottom: 5px;
|
|
84
|
+
color: ${theme.colors.gray600};
|
|
85
|
+
/* font-family: 'Open Sans', sans-serif; */
|
|
86
|
+
font-size: 13px;
|
|
87
|
+
font-weight: bold;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.input-group-label {
|
|
91
|
+
margin-bottom: 5px;
|
|
92
|
+
color: ${theme.colors.gray600};
|
|
93
|
+
/* font-family: 'Open Sans', sans-serif; */
|
|
94
|
+
font-size: 13px;
|
|
95
|
+
font-weight: bold;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.input-notification {
|
|
99
|
+
display: flex;
|
|
100
|
+
|
|
101
|
+
& > img {
|
|
102
|
+
width: 16px;
|
|
103
|
+
height: 16px;
|
|
104
|
+
margin-top: 1.5px;
|
|
105
|
+
margin-right: 8px;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.tag-list {
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.warning {
|
|
114
|
+
margin-top: 16px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.submit-btn {
|
|
118
|
+
width: 100%;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.switch-label {
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.swich-input-group {
|
|
127
|
+
padding: 12px 16px;
|
|
128
|
+
border-radius: 8px;
|
|
129
|
+
background: ${theme.colors.neutral50};
|
|
130
|
+
|
|
131
|
+
&.askdoctor-switch {
|
|
132
|
+
background: ${theme.colors.primary50};
|
|
133
|
+
&.mb-color {
|
|
134
|
+
background: ${theme.mbColors.tonePink};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.mantine-Switch-labelWrapper {
|
|
139
|
+
flex-grow: 1;
|
|
140
|
+
}
|
|
141
|
+
.mantine-Checkbox-body {
|
|
142
|
+
display: flex;
|
|
143
|
+
width: 100%;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: space-between;
|
|
146
|
+
}
|
|
147
|
+
.mantine-Switch-track {
|
|
148
|
+
margin-bottom: 0;
|
|
149
|
+
}
|
|
150
|
+
.label-txt {
|
|
151
|
+
font-weight: normal;
|
|
152
|
+
font-size: 14px;
|
|
153
|
+
color: ${theme.colors.gray800};
|
|
154
|
+
margin-left: 10px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
const StyledIsQuestion$1 = styled.div `
|
|
159
|
+
display: flex;
|
|
160
|
+
width: 100%;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: space-between;
|
|
163
|
+
padding: 8px 12px;
|
|
164
|
+
border-radius: 0 0 8px 8px;
|
|
165
|
+
background: ${theme.colors.neutral50};
|
|
166
|
+
border: 1px solid ${theme.colors.gray200};
|
|
167
|
+
gap: 12px;
|
|
168
|
+
|
|
169
|
+
&.has-error {
|
|
170
|
+
border: 1px solid ${theme.colors.red600};
|
|
171
|
+
}
|
|
172
|
+
&.error-description {
|
|
173
|
+
border: 1px solid ${theme.colors.red600};
|
|
174
|
+
border-top: none;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&[data-is-marry-baby='true'] {
|
|
178
|
+
background: ${theme.mbColors.tonePink};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.switch-label {
|
|
182
|
+
display: flex;
|
|
183
|
+
gap: 4px;
|
|
184
|
+
align-items: flex-start;
|
|
185
|
+
|
|
186
|
+
svg {
|
|
187
|
+
margin-top: 2px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.wrapper-text {
|
|
191
|
+
.label-txt {
|
|
192
|
+
color: ${theme.colors.gray800};
|
|
193
|
+
font-size: 14px;
|
|
194
|
+
font-weight: 600;
|
|
195
|
+
line-height: 22px;
|
|
196
|
+
}
|
|
197
|
+
.description-txt {
|
|
198
|
+
color: ${theme.colors.gray700};
|
|
199
|
+
font-size: 12px;
|
|
200
|
+
font-weight: 400;
|
|
201
|
+
line-height: 18px;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
button {
|
|
207
|
+
height: 40px;
|
|
208
|
+
&:hover,
|
|
209
|
+
&.primary {
|
|
210
|
+
border-radius: 16px;
|
|
211
|
+
border: 1px solid ${theme.colors.blue100};
|
|
212
|
+
background: ${theme.colors.blue50};
|
|
213
|
+
color: ${theme.colors.primaryBase};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
`;
|
|
217
|
+
const StyledError$1 = styled.div `
|
|
218
|
+
margin-bottom: 12px;
|
|
219
|
+
color: ${theme.colors.red700};
|
|
220
|
+
svg {
|
|
221
|
+
margin-right: 5px;
|
|
222
|
+
}
|
|
223
|
+
svg,
|
|
224
|
+
span {
|
|
225
|
+
vertical-align: middle;
|
|
226
|
+
}
|
|
227
|
+
`;
|
|
228
|
+
const StyledFormGroupInner$1 = styled.div `
|
|
229
|
+
.swich-input-group {
|
|
230
|
+
padding: 12px 16px;
|
|
231
|
+
border-radius: 8px;
|
|
232
|
+
background: ${theme.colors.neutral50};
|
|
233
|
+
|
|
234
|
+
&.askdoctor-switch {
|
|
235
|
+
background: ${theme.colors.blue50};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.switch-label {
|
|
239
|
+
display: flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
}
|
|
242
|
+
.mantine-Switch-labelWrapper {
|
|
243
|
+
flex-grow: 1;
|
|
244
|
+
}
|
|
245
|
+
.mantine-Checkbox-body {
|
|
246
|
+
display: flex;
|
|
247
|
+
width: 100%;
|
|
248
|
+
align-items: center;
|
|
249
|
+
justify-content: space-between;
|
|
250
|
+
}
|
|
251
|
+
.mantine-Switch-track {
|
|
252
|
+
margin-bottom: 0;
|
|
253
|
+
}
|
|
254
|
+
.label-txt {
|
|
255
|
+
font-weight: normal;
|
|
256
|
+
font-size: 14px;
|
|
257
|
+
color: ${theme.colors.gray800};
|
|
258
|
+
margin-left: 14px;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
`;
|
|
262
|
+
const StylePostAction$1 = styled.div `
|
|
263
|
+
display: flex;
|
|
264
|
+
gap: 12px;
|
|
265
|
+
.avatar {
|
|
266
|
+
width: 40px;
|
|
267
|
+
height: 40px;
|
|
268
|
+
border-radius: 100%;
|
|
269
|
+
|
|
270
|
+
img {
|
|
271
|
+
border-radius: 100%;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.author-avatar {
|
|
275
|
+
.col-left {
|
|
276
|
+
display: none;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.post-action-form {
|
|
282
|
+
display: flex;
|
|
283
|
+
flex-direction: column;
|
|
284
|
+
gap: 4px;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.post-action-by {
|
|
288
|
+
color: ${theme.colors.gray800};
|
|
289
|
+
font-size: 16px;
|
|
290
|
+
font-weight: 600;
|
|
291
|
+
line-height: 24px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.post-action-result {
|
|
295
|
+
display: flex;
|
|
296
|
+
position: relative;
|
|
297
|
+
&:after {
|
|
298
|
+
content: '';
|
|
299
|
+
display: inline-block;
|
|
300
|
+
width: 5px;
|
|
301
|
+
height: 5px;
|
|
302
|
+
background-color: ${theme.colors.error};
|
|
303
|
+
border-radius: 100%;
|
|
304
|
+
position: absolute;
|
|
305
|
+
right: 7px;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.dropdown-post-action {
|
|
310
|
+
background: ${theme.colors.white} !important;
|
|
311
|
+
border-radius: 2px;
|
|
312
|
+
border: 1px solid ${theme.colors.neutral200} !important;
|
|
313
|
+
|
|
314
|
+
> div {
|
|
315
|
+
padding: 3px 8px;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
span {
|
|
319
|
+
flex: 1;
|
|
320
|
+
color: ${theme.colors.gray600};
|
|
321
|
+
font-size: 12px;
|
|
322
|
+
font-weight: 600;
|
|
323
|
+
line-height: 18px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
ul {
|
|
327
|
+
width: 130px;
|
|
328
|
+
li {
|
|
329
|
+
img {
|
|
330
|
+
flex: 0 0 16px;
|
|
331
|
+
width: 16px;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
`;
|
|
337
|
+
const StyleSessionRow$1 = styled.div `
|
|
338
|
+
display: inline-flex;
|
|
339
|
+
gap: 8px;
|
|
340
|
+
align-items: center;
|
|
341
|
+
cursor: pointer;
|
|
342
|
+
|
|
343
|
+
.session-title {
|
|
344
|
+
color: ${theme.colors.gray700};
|
|
345
|
+
font-size: 14px;
|
|
346
|
+
font-weight: 400;
|
|
347
|
+
line-height: 22px;
|
|
348
|
+
flex: 1;
|
|
349
|
+
}
|
|
350
|
+
`;
|
|
351
|
+
|
|
352
|
+
var img$7 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3e%3cpath d='M8.78785 10.7863H7.21084C5.77572 10.237 4.20739 10.237 2.77223 10.7863H1.55404V11.6457H2.41467V11.6537C2.41802 13.0707 3.57408 14.2238 4.99111 14.2238C6.4069 14.2238 7.56293 13.072 7.56797 11.6566L7.56803 11.6457H8.4303V11.6537C8.43365 13.0707 9.58971 14.2238 11.0067 14.2238C12.4225 14.2238 13.5786 13.072 13.5836 11.6566L13.5837 11.6457H14.4447V10.7863H13.2265C11.7913 10.237 10.223 10.237 8.78785 10.7863Z' fill='%238C8C8C'/%3e%3cpath d='M0.666016 6.48926V6.91895C0.666016 8.10354 1.62986 9.06738 2.81445 9.06738H13.1842C14.3688 9.06738 15.3327 8.10354 15.3327 6.91895V6.48926H0.666016Z' fill='%238C8C8C'/%3e%3cpath d='M12.36 3.18227C11.9916 2.07614 10.961 1.33301 9.7953 1.33301C9.13524 1.33301 8.48902 1.58185 7.99935 2.01991C7.50965 1.58185 6.86346 1.33301 6.2034 1.33301C5.03772 1.33301 4.00712 2.07614 3.63871 3.18184L2.8207 5.62988H13.1779L12.36 3.18227Z' fill='%238C8C8C'/%3e%3c/svg%3e";
|
|
353
|
+
var IconAnonymous = img$7;
|
|
354
|
+
|
|
355
|
+
var img$6 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3e%3cpath d='M8.00045 14.3336C7.12449 14.3336 6.30114 14.1674 5.53038 13.835C4.75962 13.5025 4.08916 13.0513 3.51902 12.4815C2.94886 11.9116 2.49749 11.2414 2.1649 10.471C1.83231 9.70056 1.66602 8.87738 1.66602 8.00143C1.66602 7.12547 1.83224 6.30211 2.16468 5.53136C2.49713 4.76059 2.94829 4.09014 3.51818 3.51999C4.08808 2.94984 4.75824 2.49847 5.52867 2.16588C6.29908 1.83329 7.12226 1.66699 7.99822 1.66699C8.87417 1.66699 9.69753 1.83322 10.4683 2.16566C11.239 2.4981 11.9095 2.94927 12.4796 3.51916C13.0498 4.08906 13.5012 4.75922 13.8338 5.52964C14.1664 6.30005 14.3327 7.12324 14.3327 7.99919C14.3327 8.87515 14.1664 9.6985 13.834 10.4693C13.5015 11.24 13.0504 11.9105 12.4805 12.4806C11.9106 13.0508 11.2404 13.5022 10.47 13.8347C9.69959 14.1673 8.8764 14.3336 8.00045 14.3336ZM7.99933 13.3336C9.48822 13.3336 10.7493 12.817 11.7827 11.7836C12.816 10.7503 13.3327 9.4892 13.3327 8.00031C13.3327 7.92253 13.331 7.84304 13.3275 7.76184C13.3241 7.68065 13.3203 7.608 13.316 7.54389C13.2733 7.85329 13.1393 8.10928 12.9141 8.31184C12.6889 8.51441 12.4181 8.61569 12.1019 8.61569H10.5891C10.2506 8.61569 9.96087 8.49527 9.71985 8.25441C9.47883 8.01357 9.35832 7.72403 9.35832 7.38581V6.77088H6.89678V5.54099C6.89678 5.20277 7.01729 4.91272 7.25832 4.67084C7.49935 4.42896 7.78909 4.30803 8.12755 4.30803H8.74293V4.05159C8.74293 3.76185 8.83054 3.52189 9.00575 3.33173C9.18097 3.14155 9.39209 3.00885 9.6391 2.93364C9.37841 2.84818 9.11262 2.78236 8.84173 2.73621C8.57084 2.69005 8.29004 2.66698 7.99933 2.66698C6.51044 2.66698 5.24933 3.18364 4.216 4.21698C3.18267 5.25031 2.666 6.51142 2.666 8.00031V8.09648C2.666 8.12639 2.66814 8.15844 2.67242 8.19263H5.83265C6.5147 8.19263 7.09547 8.43237 7.57495 8.91186C8.05444 9.39134 8.29418 9.97114 8.29418 10.6513V11.2695H6.44803V13.0965C6.6959 13.1734 6.94847 13.2321 7.20573 13.2727C7.463 13.3133 7.72753 13.3336 7.99933 13.3336Z' fill='%238C8C8C'/%3e%3c/svg%3e";
|
|
356
|
+
var IconPublic = img$6;
|
|
357
|
+
|
|
358
|
+
styled.div `
|
|
359
|
+
background-color: white;
|
|
360
|
+
z-index: 1000;
|
|
361
|
+
top: 0;
|
|
362
|
+
left: 0;
|
|
363
|
+
height: 100%;
|
|
364
|
+
position: absolute;
|
|
365
|
+
width: 100%;
|
|
366
|
+
|
|
367
|
+
.drawer-header {
|
|
368
|
+
display: flex;
|
|
369
|
+
gap: 12px;
|
|
370
|
+
align-items: center;
|
|
371
|
+
padding: 12px 16px;
|
|
372
|
+
border-bottom: 1px solid ${theme.colors.gray200};
|
|
373
|
+
|
|
374
|
+
.input-group-label {
|
|
375
|
+
flex: 1;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
img {
|
|
379
|
+
cursor: pointer;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
p {
|
|
383
|
+
flex: 1;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.drawer-content {
|
|
388
|
+
padding: 16px;
|
|
389
|
+
display: flex;
|
|
390
|
+
flex-direction: column;
|
|
391
|
+
gap: 16px;
|
|
392
|
+
overflow-y: auto;
|
|
393
|
+
height: calc(100% - 49px);
|
|
394
|
+
|
|
395
|
+
.input-field-label {
|
|
396
|
+
margin-bottom: 8px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
&.drawer-content-full-screen {
|
|
400
|
+
max-width: 680px;
|
|
401
|
+
margin: 0 auto;
|
|
402
|
+
padding: 16px 24px;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
`;
|
|
406
|
+
const StyleCommunityReivew = styled.div `
|
|
407
|
+
display: flex;
|
|
408
|
+
flex-direction: column;
|
|
409
|
+
gap: 8px;
|
|
410
|
+
margin-top: 8px;
|
|
411
|
+
|
|
412
|
+
.topic-review {
|
|
413
|
+
display: flex;
|
|
414
|
+
gap: 4px;
|
|
415
|
+
flex-wrap: wrap;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.community-review {
|
|
419
|
+
.tag-item {
|
|
420
|
+
background-color: ${theme.colors.neutral50};
|
|
421
|
+
|
|
422
|
+
img {
|
|
423
|
+
border-radius: 50%;
|
|
424
|
+
margin-right: 8px;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
`;
|
|
429
|
+
|
|
430
|
+
var img$5 = "data:image/svg+xml,%3csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.86019 13.3957C4.98735 13.5229 5.14492 13.5865 5.33291 13.5865H13.3233L15.9771 16.2403V5.91343C15.9771 5.72546 15.9135 5.56789 15.7864 5.44072C15.6592 5.31356 15.5016 5.24998 15.3136 5.24998H14.1887V12.036L13.9507 11.798H4.66944V12.923C4.66944 13.111 4.73302 13.2686 4.86019 13.3957ZM2.01562 3.28847V12.9519L4.66944 10.298H12.0252C12.2132 10.298 12.3708 10.2345 12.4979 10.1073C12.6251 9.98014 12.6887 9.82257 12.6887 9.63459V3.28847C12.6887 3.10048 12.6251 2.94291 12.4979 2.81574C12.3708 2.68858 12.2132 2.625 12.0252 2.625H2.67909C2.49111 2.625 2.33353 2.68858 2.20637 2.81574C2.07921 2.94291 2.01562 3.10048 2.01562 3.28847Z' fill='%232D87F3'/%3e%3c/svg%3e";
|
|
431
|
+
var IconCommunity = img$5;
|
|
432
|
+
|
|
433
|
+
const PostCommunityReview = ({ selectedTopics, currentCommunity }) => {
|
|
434
|
+
return (React__default.createElement(StyleCommunityReivew, null,
|
|
435
|
+
React__default.createElement("div", { className: "community-review" },
|
|
436
|
+
React__default.createElement(Button, { skipHover: true, size: "md", radius: "xl", className: "tag-item", variant: "tertiary" },
|
|
437
|
+
React__default.createElement(Text, { size: "p4", as: "span", color: "inherit" }, currentCommunity.name))),
|
|
438
|
+
React__default.createElement("div", { className: "topic-review", style: { display: 'none' } }, selectedTopics.map((topic) => {
|
|
439
|
+
return (React__default.createElement(Button, { skipHover: true, size: "sm", radius: "xl", className: "tag-item", key: topic.id, variant: "tertiary" },
|
|
440
|
+
React__default.createElement(Text, { size: "p4", as: "span", color: "inherit" }, topic.name)));
|
|
441
|
+
}))));
|
|
442
|
+
};
|
|
443
|
+
const CreatePostCommunity$1 = ({ communitiesList, currentCommunity, selectedTopics, forceTopics, communityValue,
|
|
444
|
+
// error,
|
|
445
|
+
isFullscreen, isInEditMode, setSelectedTopics, setCommunityValue, removeKeyError, }) => {
|
|
446
|
+
const { t } = useTranslations();
|
|
447
|
+
const props = {
|
|
448
|
+
communitiesList,
|
|
449
|
+
currentCommunity,
|
|
450
|
+
selectedTopics,
|
|
451
|
+
communityValue,
|
|
452
|
+
isFullscreen,
|
|
453
|
+
isInEditMode,
|
|
454
|
+
forceTopics,
|
|
455
|
+
setSelectedTopics,
|
|
456
|
+
setCommunityValue,
|
|
457
|
+
removeKeyError,
|
|
458
|
+
};
|
|
459
|
+
console.log(props);
|
|
460
|
+
return (React__default.createElement("div", { className: "input-group" },
|
|
461
|
+
React__default.createElement(StyleSessionRow$1, null,
|
|
462
|
+
React__default.createElement("img", { alt: "anonymous-icon", src: IconCommunity, style: {
|
|
463
|
+
width: '18px',
|
|
464
|
+
height: '18px',
|
|
465
|
+
objectFit: 'contain',
|
|
466
|
+
marginLeft: 'auto',
|
|
467
|
+
} }),
|
|
468
|
+
React__default.createElement("div", { className: "session-title" }, t('createPost.communityAndTopic'))),
|
|
469
|
+
React__default.createElement(PostCommunityReview, { selectedTopics: selectedTopics, currentCommunity: currentCommunity })));
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
const CreatePostDescription$1 = ({ className, style, bannedWords = [], value, onChange, onPreviewUrlChange, onInvalidUrlsChange,
|
|
473
|
+
// onImageFilesChange,
|
|
474
|
+
// imageFiles: imageFilesProp,
|
|
475
|
+
isReplying, footerEditor, }) => {
|
|
476
|
+
const { t } = useTranslations();
|
|
477
|
+
const [previewUrl, setPreviewUrl] = useState(null);
|
|
478
|
+
const imagePicker = useRef(null);
|
|
479
|
+
// const {
|
|
480
|
+
// onSelectImages,
|
|
481
|
+
// onRemoveImage,
|
|
482
|
+
// imageSrcs,
|
|
483
|
+
// // imageFiles,
|
|
484
|
+
// } = useImagePicker(imageFilesProp, onImageFilesChange)
|
|
485
|
+
useEffect(() => {
|
|
486
|
+
if (onPreviewUrlChange) {
|
|
487
|
+
if (previewUrl === null || previewUrl === void 0 ? void 0 : previewUrl.url)
|
|
488
|
+
onPreviewUrlChange({
|
|
489
|
+
title: previewUrl.title || '',
|
|
490
|
+
url: previewUrl.url || '',
|
|
491
|
+
image: previewUrl.image || '',
|
|
492
|
+
description: previewUrl.description || '',
|
|
493
|
+
});
|
|
494
|
+
else
|
|
495
|
+
onPreviewUrlChange(null);
|
|
496
|
+
}
|
|
497
|
+
}, [previewUrl]);
|
|
498
|
+
return (React__default.createElement(StyledCreatePostDescription$1, { className: className, style: style },
|
|
499
|
+
React__default.createElement(Text, { size: "p4", className: "description-label" }, t('createPost.popup.description')),
|
|
500
|
+
React__default.createElement("div", { className: `textarea-control` },
|
|
501
|
+
React__default.createElement("div", { className: "textarea-wrapper" },
|
|
502
|
+
React__default.createElement(RichTextEditor$1, { html: value || '', onChange: onChange, bannedWords: bannedWords, onImagePickerClick: () => { var _a; return (_a = imagePicker.current) === null || _a === void 0 ? void 0 : _a.click(); }, onPreviewUrlChange: setPreviewUrl, onInvalidUrlsChange: onInvalidUrlsChange, isReplying: isReplying }))),
|
|
503
|
+
footerEditor,
|
|
504
|
+
React__default.createElement(Text, { size: "p4", className: "count-string" },
|
|
505
|
+
t('character'),
|
|
506
|
+
": ",
|
|
507
|
+
innertext(value || '').length)));
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
var img$4 = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3e%3cpath d='M5.3077 20.5C4.80257 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.3077C3.5 4.80257 3.675 4.375 4.025 4.025C4.375 3.675 4.80257 3.5 5.3077 3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80257 20.5 5.3077V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.3077ZM7.65388 16.75H16.423C16.6038 16.75 16.7377 16.6679 16.8249 16.5038C16.9121 16.3397 16.8987 16.1807 16.7845 16.0269L14.4 12.8327C14.3064 12.7122 14.1859 12.6519 14.0384 12.6519C13.891 12.6519 13.7705 12.7122 13.6769 12.8327L11.2308 16.0192L9.5923 13.9192C9.49872 13.8051 9.37981 13.7481 9.23558 13.7481C9.09134 13.7481 8.97243 13.8083 8.87885 13.9289L7.30195 16.0269C7.18143 16.1807 7.16477 16.3397 7.25195 16.5038C7.33913 16.6679 7.47311 16.75 7.65388 16.75Z' fill='%232D87F3'/%3e%3c/svg%3e";
|
|
511
|
+
var IconPhone = img$4;
|
|
512
|
+
|
|
513
|
+
const CreatePostPhotos$1 = ({ imageFiles: imageFilesInit, setImageFiles, }) => {
|
|
514
|
+
const imageRef = useRef(null);
|
|
515
|
+
const { t } = useTranslations();
|
|
516
|
+
const { onSelectImages } = useImagePicker(imageFilesInit, setImageFiles);
|
|
517
|
+
const handleClick = () => {
|
|
518
|
+
var _a;
|
|
519
|
+
(_a = imageRef === null || imageRef === void 0 ? void 0 : imageRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
520
|
+
};
|
|
521
|
+
return (React__default.createElement("div", { className: "input-group" },
|
|
522
|
+
React__default.createElement(StyleSessionRow$1, { onClick: handleClick },
|
|
523
|
+
React__default.createElement("img", { alt: "anonymous-icon", src: IconPhone, style: {
|
|
524
|
+
width: '18px',
|
|
525
|
+
height: '18px',
|
|
526
|
+
objectFit: 'contain',
|
|
527
|
+
marginLeft: 'auto',
|
|
528
|
+
} }),
|
|
529
|
+
React__default.createElement("div", { className: "session-title" }, t('createPost.photos'))),
|
|
530
|
+
React__default.createElement("input", { ref: imageRef, type: "file", accept: "image/png, image/gif, image/jpeg", multiple: true, style: { display: 'none' }, onChange: (e) => onSelectImages(e) })));
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
const StyledCreatePostTitle$1 = styled.div `
|
|
534
|
+
input:focus,
|
|
535
|
+
textarea:focus,
|
|
536
|
+
[contenteditable='true'] {
|
|
537
|
+
outline: none;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.title-input {
|
|
541
|
+
overflow: hidden;
|
|
542
|
+
width: 100%;
|
|
543
|
+
padding: 12px 16px;
|
|
544
|
+
border: solid 1px #d9d9d9;
|
|
545
|
+
border-radius: ${theme.borderRadius};
|
|
546
|
+
font-size: 16px;
|
|
547
|
+
line-height: 1.2;
|
|
548
|
+
white-space: nowrap;
|
|
549
|
+
:focus {
|
|
550
|
+
border-color: ${(props) => props.color};
|
|
551
|
+
box-shadow: 0px 0px 2px 2px ${(props) => props.colorShadow};
|
|
552
|
+
}
|
|
553
|
+
br {
|
|
554
|
+
display: none;
|
|
555
|
+
}
|
|
556
|
+
* {
|
|
557
|
+
display: inline;
|
|
558
|
+
white-space: nowrap;
|
|
559
|
+
}
|
|
560
|
+
mocka {
|
|
561
|
+
padding: 2px 6px;
|
|
562
|
+
border-radius: 1rem;
|
|
563
|
+
&[data-error='true'] {
|
|
564
|
+
background-color: #ffeeee;
|
|
565
|
+
color: red;
|
|
566
|
+
text-decoration: underline;
|
|
567
|
+
font-style: bold;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
ol,
|
|
571
|
+
ul {
|
|
572
|
+
padding-left: 1rem;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
label {
|
|
577
|
+
display: block;
|
|
578
|
+
margin-bottom: 5px;
|
|
579
|
+
color: ${theme.colors.gray600};
|
|
580
|
+
font-size: 13px;
|
|
581
|
+
font-weight: bold;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.count-string {
|
|
585
|
+
margin-top: 5px;
|
|
586
|
+
color: ${theme.colors.gray500};
|
|
587
|
+
font-size: 11px;
|
|
588
|
+
text-align: right;
|
|
589
|
+
}
|
|
590
|
+
`;
|
|
591
|
+
|
|
592
|
+
const TITLE_LIMIT$1 = 120;
|
|
593
|
+
const inputModify$3 = (value, opts) => {
|
|
594
|
+
if (!opts)
|
|
595
|
+
return value;
|
|
596
|
+
const { limit, bannedWords = [] } = opts;
|
|
597
|
+
const shorten = typeof limit === 'number' && limit >= 0 ? value.substring(0, limit) : value;
|
|
598
|
+
const processedValue = highlightBadWords(shorten, bannedWords);
|
|
599
|
+
return processedValue;
|
|
600
|
+
};
|
|
601
|
+
const CreatePostTitle$1 = ({ className, style, bannedWords = [], value, onChange, }) => {
|
|
602
|
+
var _a;
|
|
603
|
+
const _theme = useMantineTheme();
|
|
604
|
+
const { t } = useTranslations();
|
|
605
|
+
const [titleValue, setTitleValue] = useState('');
|
|
606
|
+
const titleRef = useRef(null);
|
|
607
|
+
useEffect(() => {
|
|
608
|
+
if (titleRef.current) {
|
|
609
|
+
const pasteHandler = (e) => {
|
|
610
|
+
var _a;
|
|
611
|
+
e.preventDefault();
|
|
612
|
+
const text = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/plain');
|
|
613
|
+
document.execCommand('insertHTML', false, text);
|
|
614
|
+
};
|
|
615
|
+
const contentDiv = titleRef.current;
|
|
616
|
+
contentDiv.addEventListener('paste', pasteHandler, {
|
|
617
|
+
passive: true,
|
|
618
|
+
});
|
|
619
|
+
return () => contentDiv.removeEventListener('paste', pasteHandler);
|
|
620
|
+
}
|
|
621
|
+
}, [titleRef]);
|
|
622
|
+
const bannedString = (bannedWords === null || bannedWords === void 0 ? void 0 : bannedWords.join(',')) || '';
|
|
623
|
+
useEffect(() => {
|
|
624
|
+
var _a;
|
|
625
|
+
if (bannedString) {
|
|
626
|
+
const titleText = (_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.innerText;
|
|
627
|
+
if (titleText) {
|
|
628
|
+
const titleValueWithBanned = highlightBadWords(titleText, bannedWords);
|
|
629
|
+
if (titleValueWithBanned !== titleText) {
|
|
630
|
+
onChange && onChange(titleValueWithBanned);
|
|
631
|
+
setTitleValue(titleValueWithBanned);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}, [bannedString]);
|
|
636
|
+
const debounceInputModify = useCallback(debounce(() => {
|
|
637
|
+
if (titleRef.current) {
|
|
638
|
+
const shortenString = inputModify$3(titleRef.current.innerText, {
|
|
639
|
+
limit: TITLE_LIMIT$1,
|
|
640
|
+
bannedWords,
|
|
641
|
+
});
|
|
642
|
+
onChange && onChange(shortenString);
|
|
643
|
+
setTitleValue(shortenString);
|
|
644
|
+
}
|
|
645
|
+
}, 300), []);
|
|
646
|
+
useEffect(() => {
|
|
647
|
+
setTimeout(() => {
|
|
648
|
+
var _a;
|
|
649
|
+
(_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
650
|
+
}, 500);
|
|
651
|
+
}, []);
|
|
652
|
+
return (React__default.createElement(StyledCreatePostTitle$1, { className: className, style: style, color: _theme.colors[_theme.primaryColor][0], colorShadow: _theme.colors[_theme.primaryColor][2] },
|
|
653
|
+
React__default.createElement(Input, { name: "title", value: value || titleValue, size: "md", label: t('createPost.title'), CustomInput: React__default.createElement(ContentEditable, { innerRef: titleRef, html: value || titleValue, onChange: () => {
|
|
654
|
+
if (titleRef.current &&
|
|
655
|
+
titleRef.current.innerText !== (value || titleValue)) {
|
|
656
|
+
const initialValue = inputModify$3(titleRef.current.innerText, {
|
|
657
|
+
bannedWords,
|
|
658
|
+
});
|
|
659
|
+
onChange && onChange(initialValue);
|
|
660
|
+
setTitleValue(initialValue);
|
|
661
|
+
debounceInputModify();
|
|
662
|
+
}
|
|
663
|
+
}, className: "title-input" }) }),
|
|
664
|
+
React__default.createElement(Text, { size: "p4", className: "count-string" }, t('createPost.popup.wordCount', {
|
|
665
|
+
count: ((_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.innerText.length) || 0,
|
|
666
|
+
max: TITLE_LIMIT$1,
|
|
667
|
+
}))));
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
const StyledPopupFrame = styled(PopupFrame) `
|
|
671
|
+
& > div[data-open]:first-child {
|
|
672
|
+
z-index: 1000;
|
|
673
|
+
height: auto;
|
|
674
|
+
max-width: 448px;
|
|
675
|
+
}
|
|
676
|
+
.custom-media-dialog {
|
|
677
|
+
padding: 1rem;
|
|
678
|
+
.image-gallery {
|
|
679
|
+
display: none;
|
|
680
|
+
.image-item {
|
|
681
|
+
&.no-image {
|
|
682
|
+
cursor: pointer;
|
|
683
|
+
}
|
|
684
|
+
.camera-btn {
|
|
685
|
+
position: absolute;
|
|
686
|
+
top: calc(100% - 32px);
|
|
687
|
+
right: 8px;
|
|
688
|
+
left: unset;
|
|
689
|
+
width: 24px;
|
|
690
|
+
height: 24px;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
.custom-media-add-btn {
|
|
695
|
+
margin-left: auto;
|
|
696
|
+
display: block;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
`;
|
|
700
|
+
const StyledInput = styled(Input$1) `
|
|
701
|
+
margin-bottom: 10px;
|
|
702
|
+
`;
|
|
703
|
+
const StyleWrapperInfo = styled.div `
|
|
704
|
+
display: flex;
|
|
705
|
+
gap: 4px;
|
|
706
|
+
align-items: flex-start;
|
|
707
|
+
margin-bottom: 14px;
|
|
708
|
+
|
|
709
|
+
img {
|
|
710
|
+
margin-top: 2px;
|
|
711
|
+
max-width: 16px;
|
|
712
|
+
}
|
|
713
|
+
`;
|
|
714
|
+
|
|
715
|
+
var img$3 = "data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8.0026 1.33334C4.3206 1.33334 1.33594 4.31801 1.33594 8.00001C1.33594 11.682 4.3206 14.6667 8.0026 14.6667C11.6846 14.6667 14.6693 11.682 14.6693 8.00001C14.6693 4.31801 11.6846 1.33334 8.0026 1.33334ZM8.0026 11.3333C7.6346 11.3333 7.33594 11.0347 7.33594 10.6667V8.00001C7.33594 7.63201 7.6346 7.33334 8.0026 7.33334C8.3706 7.33334 8.66927 7.63201 8.66927 8.00001V10.6667C8.66927 11.0347 8.3706 11.3333 8.0026 11.3333ZM8.33594 6.00001H7.66927C7.48527 6.00001 7.33594 5.85068 7.33594 5.66668V5.00001C7.33594 4.81601 7.48527 4.66668 7.66927 4.66668H8.33594C8.51994 4.66668 8.66927 4.81601 8.66927 5.00001V5.66668C8.66927 5.85068 8.51994 6.00001 8.33594 6.00001Z' fill='%232D87F3'/%3e%3c/svg%3e";
|
|
716
|
+
var IconInfo = img$3;
|
|
717
|
+
|
|
718
|
+
const SocialLinkPopup = ({ isOpen, onClose, onSocialLinkChanged, socialLinkData, }) => {
|
|
719
|
+
const { t } = useTranslations();
|
|
720
|
+
const imagePickerRef = useRef(null);
|
|
721
|
+
const [socialLink, setSocialLinkUrl] = useState('');
|
|
722
|
+
const { onSelectImages, onRemoveImage, imageSrcs, imageFiles } = useImagePicker();
|
|
723
|
+
useEffect(() => {
|
|
724
|
+
if (isOpen) {
|
|
725
|
+
setSocialLinkUrl((socialLinkData === null || socialLinkData === void 0 ? void 0 : socialLinkData.url) || '');
|
|
726
|
+
}
|
|
727
|
+
}, [isOpen]);
|
|
728
|
+
const isAcceptedLink = socialLink.includes('youtu.be') ||
|
|
729
|
+
socialLink.includes('youtube.com') ||
|
|
730
|
+
socialLink.includes('facebook.com') ||
|
|
731
|
+
socialLink.includes('fb.watch') ||
|
|
732
|
+
socialLink.includes('tiktok.com');
|
|
733
|
+
const isValid = !!socialLink && isAcceptedLink;
|
|
734
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
735
|
+
React__default.createElement("input", { ref: imagePickerRef, type: "file", accept: "image/png, image/gif, image/jpeg", style: { display: 'none' }, onChange: onSelectImages }),
|
|
736
|
+
React__default.createElement(StyledPopupFrame, { isOpen: isOpen, onClose: onClose, heading: "Insert", style: {
|
|
737
|
+
zIndex: 3,
|
|
738
|
+
} },
|
|
739
|
+
React__default.createElement("div", { className: "custom-media-dialog", onClick: (e) => e.stopPropagation() },
|
|
740
|
+
React__default.createElement(StyledInput, { size: "md", name: "custom-media-url", placeholder: "URL", value: socialLink, onChange: (v) => setSocialLinkUrl(v), label: "" }),
|
|
741
|
+
React__default.createElement(StyleWrapperInfo, null,
|
|
742
|
+
React__default.createElement("img", { src: IconInfo, alt: "" }),
|
|
743
|
+
React__default.createElement(Text, { size: "c2", color: "#737373" }, t('editor.addSocialLink.warningDomain'))),
|
|
744
|
+
!imageSrcs[0] ? (React__default.createElement("div", { className: "image-gallery" },
|
|
745
|
+
React__default.createElement("div", { className: "image-item no-image", onClick: () => { var _a; return (_a = imagePickerRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }))) : (React__default.createElement("div", { className: "image-gallery" },
|
|
746
|
+
React__default.createElement("div", { className: "image-item" },
|
|
747
|
+
React__default.createElement("img", { src: imageSrcs[0], alt: "" }),
|
|
748
|
+
React__default.createElement("img", { className: "close-btn", alt: "", onClick: () => onRemoveImage(0) })))),
|
|
749
|
+
React__default.createElement(Button, { color: "primary", size: "md", variant: "primary", type: "button", className: "custom-media-add-btn", onClick: (e) => {
|
|
750
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
751
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
752
|
+
if (isValid) {
|
|
753
|
+
onSocialLinkChanged === null || onSocialLinkChanged === void 0 ? void 0 : onSocialLinkChanged({
|
|
754
|
+
url: !socialLink.includes('http')
|
|
755
|
+
? 'https://' + socialLink
|
|
756
|
+
: socialLink,
|
|
757
|
+
banner: imageFiles[0],
|
|
758
|
+
});
|
|
759
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
760
|
+
}
|
|
761
|
+
}, disabled: !isValid }, t('editor.addSocialLink.addLink'))))));
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
var img$2 = "data:image/svg+xml,%3csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M3.23078 14.625C2.85193 14.625 2.53125 14.4937 2.26875 14.2312C2.00625 13.9687 1.875 13.648 1.875 13.2692V4.73078C1.875 4.35193 2.00625 4.03125 2.26875 3.76875C2.53125 3.50625 2.85193 3.375 3.23078 3.375H14.7692C15.148 3.375 15.4687 3.50625 15.7312 3.76875C15.9937 4.03125 16.125 4.35193 16.125 4.73078V10.315C15.8029 10.1922 15.4534 10.125 15.0882 10.125H11.9117C10.3036 10.125 8.99998 11.4286 8.99998 13.0368C8.99998 13.6227 9.17304 14.1682 9.47085 14.625H3.23078ZM7.83606 11.6899L11.5846 9.28988C11.6875 9.21969 11.7389 9.12306 11.7389 8.99998C11.7389 8.87691 11.6875 8.78028 11.5846 8.71009L7.83606 6.31011C7.72067 6.23222 7.60456 6.22597 7.48774 6.29136C7.37091 6.35673 7.3125 6.45721 7.3125 6.59278V11.4072C7.3125 11.5428 7.37091 11.6432 7.48774 11.7086C7.60456 11.774 7.72067 11.7677 7.83606 11.6899ZM10.7181 14.6953C11.1136 15.0907 11.5889 15.2884 12.1442 15.2884H12.8099C12.9325 15.2884 13.0352 15.247 13.1182 15.1642C13.2011 15.0813 13.2426 14.9786 13.2426 14.856C13.2426 14.7333 13.2011 14.6305 13.1182 14.5475C13.0352 14.4646 12.9325 14.4231 12.8099 14.4231H12.1442C11.8269 14.4231 11.5553 14.3101 11.3293 14.0841C11.1033 13.8582 10.9903 13.5865 10.9903 13.2692C10.9903 12.9519 11.1033 12.6803 11.3293 12.4543C11.5553 12.2284 11.8269 12.1154 12.1442 12.1154H12.8099C12.9325 12.1154 13.0352 12.074 13.1182 11.9911C13.2011 11.9083 13.2426 11.8055 13.2426 11.6829C13.2426 11.5602 13.2011 11.4574 13.1182 11.3745C13.0352 11.2915 12.9325 11.25 12.8099 11.25H12.1442C11.5889 11.25 11.1136 11.4477 10.7181 11.8432C10.3227 12.2386 10.125 12.7139 10.125 13.2692C10.125 13.8245 10.3227 14.2999 10.7181 14.6953ZM12.2686 13.5775C12.3515 13.6604 12.4543 13.7019 12.5769 13.7019H15.1731C15.2957 13.7019 15.3984 13.6605 15.4814 13.5776C15.5643 13.4948 15.6058 13.3921 15.6058 13.2694C15.6058 13.1468 15.5643 13.044 15.4814 12.961C15.3984 12.878 15.2957 12.8365 15.1731 12.8365H12.5769C12.4543 12.8365 12.3515 12.878 12.2686 12.9608C12.1857 13.0436 12.1442 13.1464 12.1442 13.269C12.1442 13.3917 12.1857 13.4945 12.2686 13.5775ZM14.9401 15.2884H15.6058C16.161 15.2884 16.6364 15.0911 17.0318 14.6966C17.4273 14.3019 17.625 13.8268 17.625 13.271C17.625 12.7068 17.4273 12.2289 17.0318 11.8374C16.6364 11.4458 16.161 11.25 15.6058 11.25H14.9401C14.8175 11.25 14.7147 11.2914 14.6318 11.3743C14.5488 11.4571 14.5074 11.5598 14.5074 11.6825C14.5074 11.8051 14.5488 11.908 14.6318 11.9909C14.7147 12.0739 14.8175 12.1154 14.9401 12.1154H15.6058C15.9231 12.1154 16.1947 12.2284 16.4207 12.4543C16.6466 12.6803 16.7596 12.9519 16.7596 13.2692C16.7596 13.5865 16.6466 13.8582 16.4207 14.0841C16.1947 14.3101 15.9231 14.4231 15.6058 14.4231H14.9401C14.8175 14.4231 14.7147 14.4645 14.6318 14.5473C14.5488 14.6302 14.5074 14.7329 14.5074 14.8556C14.5074 14.9782 14.5488 15.081 14.6318 15.164C14.7147 15.247 14.8175 15.2884 14.9401 15.2884Z' fill='%23F44D2C'/%3e%3c/svg%3e";
|
|
765
|
+
var IconVideo = img$2;
|
|
766
|
+
|
|
767
|
+
const CreatePostVideo = ({ socialLinkData, setSocialLinkData, }) => {
|
|
768
|
+
const { t } = useTranslations();
|
|
769
|
+
const [activeModal, setActiveModal] = useState(false);
|
|
770
|
+
const handleClick = () => {
|
|
771
|
+
setActiveModal(true);
|
|
772
|
+
};
|
|
773
|
+
return (React__default.createElement("div", { className: "input-group" },
|
|
774
|
+
React__default.createElement(StyleSessionRow$1, { onClick: handleClick },
|
|
775
|
+
React__default.createElement("img", { alt: "anonymous-icon", src: IconVideo, style: {
|
|
776
|
+
width: '18px',
|
|
777
|
+
height: '18px',
|
|
778
|
+
objectFit: 'contain',
|
|
779
|
+
marginLeft: 'auto',
|
|
780
|
+
} }),
|
|
781
|
+
React__default.createElement("div", { className: "session-title" }, t('createPost.videoOrLink'))),
|
|
782
|
+
React__default.createElement(SocialLinkPopup, { isOpen: activeModal, onClose: () => setActiveModal(false), onSocialLinkChanged: setSocialLinkData, socialLinkData: socialLinkData })));
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
const StyleReviewPhoto$1 = styled.div `
|
|
786
|
+
.mantine-Text-root {
|
|
787
|
+
margin-bottom: 4px;
|
|
788
|
+
}
|
|
789
|
+
.preview-images-container {
|
|
790
|
+
display: flex;
|
|
791
|
+
gap: 8px;
|
|
792
|
+
overflow-x: auto;
|
|
793
|
+
overflow-y: hidden;
|
|
794
|
+
.image-src-wrapper {
|
|
795
|
+
flex: 0 0 140px;
|
|
796
|
+
width: 140px;
|
|
797
|
+
height: 96px;
|
|
798
|
+
border-radius: 4px;
|
|
799
|
+
position: relative;
|
|
800
|
+
img {
|
|
801
|
+
border-radius: 4px;
|
|
802
|
+
}
|
|
803
|
+
.icon-close {
|
|
804
|
+
position: absolute;
|
|
805
|
+
top: 6px;
|
|
806
|
+
right: 6px;
|
|
807
|
+
cursor: pointer;
|
|
808
|
+
z-index: 10;
|
|
809
|
+
max-height: 24px;
|
|
810
|
+
max-width: 24px;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
`;
|
|
815
|
+
|
|
816
|
+
const PostPhotosReview$1 = ({ error, imageFiles: imageFilesInit, setImageFiles, removeKeyError, }) => {
|
|
817
|
+
const { t } = useTranslations();
|
|
818
|
+
const { imageSrcs, onRemoveImage } = useImagePicker(imageFilesInit, setImageFiles);
|
|
819
|
+
return (React__default.createElement(StyleReviewPhoto$1, { className: "input-group" },
|
|
820
|
+
React__default.createElement(Text, { size: "p5", weight: "semiBold" }, t('createPost.photos')),
|
|
821
|
+
React__default.createElement("div", { className: "preview-images-container" }, imageSrcs === null || imageSrcs === void 0 ? void 0 : imageSrcs.map((src, index) => {
|
|
822
|
+
return (React__default.createElement("div", { className: "image-src-wrapper", key: index },
|
|
823
|
+
React__default.createElement("img", { src: src, className: "preview-image", alt: "", style: {
|
|
824
|
+
width: '100%',
|
|
825
|
+
height: '100%',
|
|
826
|
+
objectFit: 'cover',
|
|
827
|
+
} }),
|
|
828
|
+
React__default.createElement("img", { alt: "", className: "icon-close", src: IconCloseCircle, onClick: () => {
|
|
829
|
+
removeKeyError && removeKeyError('photos');
|
|
830
|
+
onRemoveImage(index);
|
|
831
|
+
} })));
|
|
832
|
+
})),
|
|
833
|
+
error && (error === null || error === void 0 ? void 0 : error.photos) && (React__default.createElement(StyledError$1, null,
|
|
834
|
+
React__default.createElement(Text, { size: "p5", color: theme.colors.red600 }, error.photos)))));
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
const inputModify$2 = (value, opts) => {
|
|
838
|
+
var _a;
|
|
839
|
+
const { formatUrl, bannedWords = [] } = opts || {};
|
|
840
|
+
const removedFormat = fixMalformedMention(removeFontFormat(value));
|
|
841
|
+
if (!formatUrl)
|
|
842
|
+
return {
|
|
843
|
+
value: highlightBadWords(removedFormat, bannedWords),
|
|
844
|
+
};
|
|
845
|
+
let descriptionWithWrappedAnchor = removeEdittedBannedWord(wrapAnchorAroundUrls(removedFormat));
|
|
846
|
+
const urls = getUrlsFromEditorString(removedFormat);
|
|
847
|
+
if (urls) {
|
|
848
|
+
const invalidUrls = [];
|
|
849
|
+
let previewUrl = '';
|
|
850
|
+
urls.forEach((url) => {
|
|
851
|
+
if (!url)
|
|
852
|
+
return;
|
|
853
|
+
try {
|
|
854
|
+
const jsUrl = new URL(url);
|
|
855
|
+
// Check url has must into domain hellohealthgroup
|
|
856
|
+
if (!ALLOW_DOMAIN_URL.some((o) => jsUrl.origin.endsWith(o))) {
|
|
857
|
+
invalidUrls.push('notification.limitUrlDomain');
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
// Check url have special character
|
|
861
|
+
if (url.endsWith('&')) {
|
|
862
|
+
invalidUrls.push('notification.urlWrongFormat');
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
catch (_a) {
|
|
867
|
+
invalidUrls.push(url);
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
if (invalidUrls.length > 0) {
|
|
871
|
+
descriptionWithWrappedAnchor = descriptionWithWrappedAnchor
|
|
872
|
+
.replace(new RegExp(`data-url="true">(${invalidUrls.map(escapeRegExp).join('|')})<`, 'gi'), 'data-error="true" data-url="true">$1<')
|
|
873
|
+
.replace(new RegExp(`data-href="(${invalidUrls
|
|
874
|
+
.map(escapeRegExp)
|
|
875
|
+
.join('|')})" data-url="true">`, 'gi'), 'data-href="$1" data-error="true" data-url="true">');
|
|
876
|
+
}
|
|
877
|
+
previewUrl = (_a = urls.filter((u) => invalidUrls.indexOf(u) === -1)) === null || _a === void 0 ? void 0 : _a[0];
|
|
878
|
+
return {
|
|
879
|
+
invalidUrls,
|
|
880
|
+
previewUrl,
|
|
881
|
+
value: highlightBadWords(descriptionWithWrappedAnchor, bannedWords),
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
return {
|
|
885
|
+
value: highlightBadWords(descriptionWithWrappedAnchor, bannedWords),
|
|
886
|
+
};
|
|
887
|
+
};
|
|
888
|
+
const usePreviewUrl = (bannedWords, onChange) => {
|
|
889
|
+
const { data: { locale }, } = useContext(TogetherComponentGlobalContext);
|
|
890
|
+
const [previewUrl, setPreviewUrl] = useState(null);
|
|
891
|
+
const bannedWordsRef = useRef([]);
|
|
892
|
+
bannedWordsRef.current = bannedWords;
|
|
893
|
+
const fetchPreviewData = (url) => {
|
|
894
|
+
if (!previewUrl || previewUrl.url !== url) {
|
|
895
|
+
setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl({
|
|
896
|
+
url,
|
|
897
|
+
isFetching: true,
|
|
898
|
+
});
|
|
899
|
+
callApi(getApiPath(PATHS.FETCH_PREVIEW, {
|
|
900
|
+
_locale: locale,
|
|
901
|
+
}), 'POST', {
|
|
902
|
+
data: {
|
|
903
|
+
link: url,
|
|
904
|
+
},
|
|
905
|
+
headers: {
|
|
906
|
+
'Content-Type': 'application/json',
|
|
907
|
+
},
|
|
908
|
+
})
|
|
909
|
+
.then((res) => {
|
|
910
|
+
var _a, _b, _c, _d;
|
|
911
|
+
setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl({
|
|
912
|
+
title: (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.title,
|
|
913
|
+
description: (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.description,
|
|
914
|
+
image: ((_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.image) || ((_d = res === null || res === void 0 ? void 0 : res.data) === null || _d === void 0 ? void 0 : _d.logo),
|
|
915
|
+
url,
|
|
916
|
+
});
|
|
917
|
+
})
|
|
918
|
+
.catch(() => {
|
|
919
|
+
setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl(null);
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
const fetchPreviewDataRef = useRef(fetchPreviewData);
|
|
924
|
+
fetchPreviewDataRef.current = fetchPreviewData;
|
|
925
|
+
const [invalidUrls, setInvalidUrls] = useState([]);
|
|
926
|
+
const debounceInputModify = useCallback(debounce((v) => {
|
|
927
|
+
if (v) {
|
|
928
|
+
const processedInput = inputModify$2(v, {
|
|
929
|
+
bannedWords: bannedWordsRef.current,
|
|
930
|
+
formatUrl: true,
|
|
931
|
+
});
|
|
932
|
+
const { invalidUrls: _invalidUrls, previewUrl: _previewUrl, value, } = processedInput;
|
|
933
|
+
if (_invalidUrls && (_invalidUrls === null || _invalidUrls === void 0 ? void 0 : _invalidUrls.length)) {
|
|
934
|
+
setInvalidUrls(_invalidUrls);
|
|
935
|
+
setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl(null);
|
|
936
|
+
}
|
|
937
|
+
else {
|
|
938
|
+
setInvalidUrls([]);
|
|
939
|
+
if (_previewUrl) {
|
|
940
|
+
fetchPreviewDataRef.current(_previewUrl);
|
|
941
|
+
}
|
|
942
|
+
else
|
|
943
|
+
setPreviewUrl === null || setPreviewUrl === void 0 ? void 0 : setPreviewUrl(null);
|
|
944
|
+
if (value !== v) {
|
|
945
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}, 500), []);
|
|
950
|
+
return {
|
|
951
|
+
previewUrl,
|
|
952
|
+
setPreviewUrl,
|
|
953
|
+
invalidUrls,
|
|
954
|
+
debounceInputModify,
|
|
955
|
+
fetchPreviewData,
|
|
956
|
+
};
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
const StyleReviewVideo = styled.div `
|
|
960
|
+
.link-preview-wrapper {
|
|
961
|
+
position: relative;
|
|
962
|
+
.icon-close {
|
|
963
|
+
position: absolute;
|
|
964
|
+
top: 6px;
|
|
965
|
+
right: 6px;
|
|
966
|
+
cursor: pointer;
|
|
967
|
+
z-index: 10;
|
|
968
|
+
max-width: 24px;
|
|
969
|
+
max-height: 24px;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
.mantine-Text-root {
|
|
973
|
+
margin-bottom: 4px;
|
|
974
|
+
}
|
|
975
|
+
`;
|
|
976
|
+
|
|
977
|
+
const PostVideoReview = ({ socialLinkData, bannedWords, onChange, onInvalidUrlsChange, onSocialLinkChanged, }) => {
|
|
978
|
+
const { t } = useTranslations();
|
|
979
|
+
const { invalidUrls, previewUrl, fetchPreviewData, setPreviewUrl } = usePreviewUrl(bannedWords || [], onChange);
|
|
980
|
+
useEffect(() => {
|
|
981
|
+
if (socialLinkData && socialLinkData.url) {
|
|
982
|
+
fetchPreviewData(socialLinkData.url);
|
|
983
|
+
}
|
|
984
|
+
}, [socialLinkData, fetchPreviewData]);
|
|
985
|
+
useEffect(() => {
|
|
986
|
+
if (invalidUrls) {
|
|
987
|
+
onInvalidUrlsChange === null || onInvalidUrlsChange === void 0 ? void 0 : onInvalidUrlsChange(invalidUrls);
|
|
988
|
+
}
|
|
989
|
+
}, [invalidUrls]);
|
|
990
|
+
return (React__default.createElement(StyleReviewVideo, { className: "input-group" },
|
|
991
|
+
React__default.createElement(Text, { size: "p5", weight: "semiBold" }, t('createPost.video')),
|
|
992
|
+
React__default.createElement("div", { className: "link-preview-wrapper" }, (socialLinkData === null || socialLinkData === void 0 ? void 0 : socialLinkData.url) && previewUrl && (React__default.createElement("div", { className: "link-preview-wrapper" }, previewUrl.isFetching ? (React__default.createElement(Loading, null)) : (React__default.createElement(React__default.Fragment, null,
|
|
993
|
+
React__default.createElement(CardLink, { title: previewUrl.title, url: previewUrl.url || '#', image: previewUrl.image, noRefetch: true }),
|
|
994
|
+
React__default.createElement("img", { alt: "", src: IconCloseCircle, className: "icon-close", onClick: () => {
|
|
995
|
+
setPreviewUrl(null);
|
|
996
|
+
onSocialLinkChanged && onSocialLinkChanged(null);
|
|
997
|
+
} }))))))));
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
const MAX_SIZE_FILE_UPLOAD$1 = 10 * 1024 * 1024;
|
|
1001
|
+
const applySpecialCharSite$1 = [
|
|
1002
|
+
LOCALE.PhilippinesEnglish,
|
|
1003
|
+
LOCALE.PhilippinesTagalog,
|
|
1004
|
+
LOCALE.Indonesia,
|
|
1005
|
+
LOCALE.Malaysia,
|
|
1006
|
+
LOCALE.Vietnam,
|
|
1007
|
+
];
|
|
1008
|
+
const CreateNewPostContent = ({ className, style, onPostCreatedEdited, onClose, communities = [], forceSelectCommunity, forceSelectTopics, articleId, optionalTopic, editPostData, defaultCommunity, defaultTopics, selectAskDoctor, showAskDoctorOptions, userInfo, isMarryBaby = false, }) => {
|
|
1009
|
+
const isInEditMode = !!(editPostData === null || editPostData === void 0 ? void 0 : editPostData.id);
|
|
1010
|
+
const { data: { locale, router, env: { togetherBasePath }, }, action: { pushNotifications, sanitizeFunction }, } = useContext(TogetherComponentGlobalContext);
|
|
1011
|
+
const { asPath } = router || {};
|
|
1012
|
+
const { t } = useTranslations();
|
|
1013
|
+
// const [isAnonymous, setIsAnonymous] = useState<boolean>(false)
|
|
1014
|
+
const [isAskDoctor, setIsAskDoctor] = useState(selectAskDoctor);
|
|
1015
|
+
const [specialCharErr, setspecialCharErr] = useState(false);
|
|
1016
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
1017
|
+
const [titleValue, setTitleValue] = useState('');
|
|
1018
|
+
const [descriptionValue, setDescriptionValue] = useState('');
|
|
1019
|
+
const [communityValue, setCommunityValue] = useState(forceSelectCommunity
|
|
1020
|
+
? {
|
|
1021
|
+
label: forceSelectCommunity.name,
|
|
1022
|
+
value: `${forceSelectCommunity.id || ''}-${forceSelectCommunity.mappedCategoryId || ''}`,
|
|
1023
|
+
}
|
|
1024
|
+
: {
|
|
1025
|
+
label: t('community.choose'),
|
|
1026
|
+
value: '',
|
|
1027
|
+
});
|
|
1028
|
+
const [selectedTopics, setSelectedTopics] = useState([...forceSelectTopics] || []);
|
|
1029
|
+
const [socialLinkData, setSocialLinkData] = useState();
|
|
1030
|
+
const [error, setError] = useState({});
|
|
1031
|
+
const [imageFiles, setImageFiles] = useState([]);
|
|
1032
|
+
const [bannedWords, setBannedWords] = useState([]);
|
|
1033
|
+
const [postActionValue, setPostActionValue] = useState({
|
|
1034
|
+
label: t('cardPost.public'),
|
|
1035
|
+
value: 'public',
|
|
1036
|
+
});
|
|
1037
|
+
const { imageSrcs = [] } = useImagePicker(imageFiles);
|
|
1038
|
+
const currentCommunity = forceSelectCommunity ||
|
|
1039
|
+
communities.find((c) => `${c.id || ''}-${c.mappedCategoryId || ''}` === communityValue.value);
|
|
1040
|
+
const communitiesList = forceSelectCommunity
|
|
1041
|
+
? [forceSelectCommunity]
|
|
1042
|
+
: communities
|
|
1043
|
+
.filter((c) => c.isActive)
|
|
1044
|
+
.sort((a, b) => {
|
|
1045
|
+
if (a.name > b.name)
|
|
1046
|
+
return 1;
|
|
1047
|
+
if (a.name < b.name)
|
|
1048
|
+
return -1;
|
|
1049
|
+
return 0;
|
|
1050
|
+
});
|
|
1051
|
+
const [previewUrl, setPreviewUrl] = useState(null);
|
|
1052
|
+
const [invalidUrls, setInvalidUrls] = useState([]);
|
|
1053
|
+
const isReadyToSubmit = titleValue &&
|
|
1054
|
+
!specialCharErr &&
|
|
1055
|
+
innertext(descriptionValue) &&
|
|
1056
|
+
(optionalTopic || (!optionalTopic && selectedTopics.length > 0)) &&
|
|
1057
|
+
currentCommunity &&
|
|
1058
|
+
(!imageFiles || imageFiles.length <= MAX_IMAGE_UPLOADS) &&
|
|
1059
|
+
!(invalidUrls === null || invalidUrls === void 0 ? void 0 : invalidUrls.length) &&
|
|
1060
|
+
!isSubmitting;
|
|
1061
|
+
const postActionType = [
|
|
1062
|
+
{
|
|
1063
|
+
label: t('cardPost.public'),
|
|
1064
|
+
value: 'public',
|
|
1065
|
+
icon: (React__default.createElement("img", { alt: "anonymous-icon", src: IconPublic, style: {
|
|
1066
|
+
width: '100%',
|
|
1067
|
+
height: '100%',
|
|
1068
|
+
objectFit: 'contain',
|
|
1069
|
+
marginLeft: 'auto',
|
|
1070
|
+
} })),
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
label: t('cardPost.anonymous'),
|
|
1074
|
+
value: 'anonymous',
|
|
1075
|
+
icon: (React__default.createElement("img", { alt: "anonymous-icon", src: IconAnonymous, style: {
|
|
1076
|
+
width: '100%',
|
|
1077
|
+
height: '100%',
|
|
1078
|
+
objectFit: 'contain',
|
|
1079
|
+
marginLeft: 'auto',
|
|
1080
|
+
} })),
|
|
1081
|
+
},
|
|
1082
|
+
];
|
|
1083
|
+
// HANDLE etra action when OPEN AND CLOSE
|
|
1084
|
+
useEffect(() => {
|
|
1085
|
+
if (editPostData) {
|
|
1086
|
+
const post = editPostData;
|
|
1087
|
+
setTitleValue(post.title || '');
|
|
1088
|
+
setDescriptionValue(decodeMention(decodePostUrl(post.description || '', 'edit'), post.mentions));
|
|
1089
|
+
setCommunityValue({
|
|
1090
|
+
label: post.community.name,
|
|
1091
|
+
value: `${post.community.id || ''}-${post.community.mappedCategoryId || ''}`,
|
|
1092
|
+
});
|
|
1093
|
+
setSelectedTopics(post.topics || []);
|
|
1094
|
+
setImageFiles(post.photos || []);
|
|
1095
|
+
// setIsAnonymous(!!post.isAnonymous || false)
|
|
1096
|
+
setIsAskDoctor(!!post.isAskDoctor || false);
|
|
1097
|
+
}
|
|
1098
|
+
else {
|
|
1099
|
+
if (defaultCommunity) {
|
|
1100
|
+
setCommunityValue({
|
|
1101
|
+
label: defaultCommunity.name,
|
|
1102
|
+
value: `${defaultCommunity.id || ''}-${defaultCommunity.mappedCategoryId || ''}`,
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
if (defaultTopics) {
|
|
1106
|
+
setSelectedTopics(defaultTopics);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}, []);
|
|
1110
|
+
useEffect(() => {
|
|
1111
|
+
setspecialCharErr(applySpecialCharSite$1.includes(locale) &&
|
|
1112
|
+
titleValue !== '' &&
|
|
1113
|
+
!/[a-zA-Z]/.test(titleValue));
|
|
1114
|
+
setError({});
|
|
1115
|
+
}, [titleValue]);
|
|
1116
|
+
const onCreateEditSuccess = (res) => {
|
|
1117
|
+
if (onPostCreatedEdited) {
|
|
1118
|
+
onPostCreatedEdited(formatPost(res), isInEditMode);
|
|
1119
|
+
}
|
|
1120
|
+
onClose && onClose();
|
|
1121
|
+
};
|
|
1122
|
+
const validationUploadPhoto = (files) => {
|
|
1123
|
+
const errorMessage = Object.assign({}, error);
|
|
1124
|
+
if (files && files.length > 10) {
|
|
1125
|
+
errorMessage.photos = t('createPost.message.photoMaxium');
|
|
1126
|
+
}
|
|
1127
|
+
if (files && files.length) {
|
|
1128
|
+
const inValidSizeFile = files.some((file) => (file === null || file === void 0 ? void 0 : file.size) > MAX_SIZE_FILE_UPLOAD$1);
|
|
1129
|
+
if (inValidSizeFile) {
|
|
1130
|
+
errorMessage.photos = t('createPost.message.photoSize');
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
setError(errorMessage);
|
|
1134
|
+
};
|
|
1135
|
+
const validationPost = () => {
|
|
1136
|
+
let hasError = false;
|
|
1137
|
+
const errorMessage = {};
|
|
1138
|
+
const description = innertext(descriptionValue);
|
|
1139
|
+
if (!description) {
|
|
1140
|
+
errorMessage.description = t('createPost.message.requiredDescription');
|
|
1141
|
+
hasError = true;
|
|
1142
|
+
}
|
|
1143
|
+
if (isInEditMode && !titleValue) {
|
|
1144
|
+
errorMessage.title = t('createPost.message.requiredTitle');
|
|
1145
|
+
hasError = true;
|
|
1146
|
+
}
|
|
1147
|
+
if (description && description.split(' ').length < 10) {
|
|
1148
|
+
errorMessage.description = t('createPost.message.lengthDescription');
|
|
1149
|
+
hasError = true;
|
|
1150
|
+
}
|
|
1151
|
+
if (showAskDoctorOptions &&
|
|
1152
|
+
!(errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.description) &&
|
|
1153
|
+
typeof isAskDoctor === 'undefined') {
|
|
1154
|
+
errorMessage.askDoctor = t('createPost.message.askDoctorRequireMess');
|
|
1155
|
+
hasError = true;
|
|
1156
|
+
}
|
|
1157
|
+
if (imageFiles && imageFiles.length > 10) {
|
|
1158
|
+
errorMessage.photos = t('createPost.message.photoMaxium');
|
|
1159
|
+
hasError = true;
|
|
1160
|
+
}
|
|
1161
|
+
if (imageFiles && imageFiles.length) {
|
|
1162
|
+
const inValidSizeFile = imageFiles.some((file) => (file === null || file === void 0 ? void 0 : file.size) > MAX_SIZE_FILE_UPLOAD$1);
|
|
1163
|
+
if (inValidSizeFile) {
|
|
1164
|
+
errorMessage.photos = t('createPost.message.photoSize');
|
|
1165
|
+
hasError = true;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
if (invalidUrls && invalidUrls.length) {
|
|
1169
|
+
errorMessage.video = 'Invalid video url';
|
|
1170
|
+
hasError = true;
|
|
1171
|
+
}
|
|
1172
|
+
setError(errorMessage);
|
|
1173
|
+
return hasError;
|
|
1174
|
+
};
|
|
1175
|
+
const removeKeyError = (deleteKey) => {
|
|
1176
|
+
if (error[deleteKey]) {
|
|
1177
|
+
const _a = Object.assign({}, error), _b = `${deleteKey}`, value = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
1178
|
+
setError(rest);
|
|
1179
|
+
console.log(value);
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
const submitPost = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1183
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1184
|
+
const isError = validationPost();
|
|
1185
|
+
if (isError)
|
|
1186
|
+
return;
|
|
1187
|
+
const bodyFormData = yield getPostFormData({
|
|
1188
|
+
title: titleValue,
|
|
1189
|
+
description: descriptionValue,
|
|
1190
|
+
communityId: String((currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.id) || ''),
|
|
1191
|
+
imageFiles,
|
|
1192
|
+
previewUrl,
|
|
1193
|
+
topicIds: selectedTopics === null || selectedTopics === void 0 ? void 0 : selectedTopics.map((topic) => String(topic.id || '')).filter(Boolean),
|
|
1194
|
+
locale,
|
|
1195
|
+
sanitizeFunction,
|
|
1196
|
+
categoryCommunityId: String((currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.mappedCategoryId) || ''),
|
|
1197
|
+
categoryTopicIds: selectedTopics === null || selectedTopics === void 0 ? void 0 : selectedTopics.map((topic) => String((topic === null || topic === void 0 ? void 0 : topic.mappedCategoryId) || '')).filter(Boolean),
|
|
1198
|
+
isAnonymous: (postActionValue === null || postActionValue === void 0 ? void 0 : postActionValue.value) === 'anonymous' ? 1 : 0,
|
|
1199
|
+
isAskDoctor: isAskDoctor ? 1 : 0,
|
|
1200
|
+
introUrl: (socialLinkData === null || socialLinkData === void 0 ? void 0 : socialLinkData.url) || '',
|
|
1201
|
+
});
|
|
1202
|
+
if (articleId) {
|
|
1203
|
+
bodyFormData.append('article_id', articleId);
|
|
1204
|
+
}
|
|
1205
|
+
let res;
|
|
1206
|
+
if (isInEditMode) {
|
|
1207
|
+
if (editPostData === null || editPostData === void 0 ? void 0 : editPostData.id) {
|
|
1208
|
+
res = yield editPost({
|
|
1209
|
+
id: editPostData.id,
|
|
1210
|
+
formData: bodyFormData,
|
|
1211
|
+
locale,
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
else {
|
|
1216
|
+
res = yield createPost({
|
|
1217
|
+
formData: bodyFormData,
|
|
1218
|
+
locale,
|
|
1219
|
+
isArticleComment: !(currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.id) && !!(currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.mappedCategoryId),
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
const resData = res === null || res === void 0 ? void 0 : res.data;
|
|
1223
|
+
if ((resData === null || resData === void 0 ? void 0 : resData.id) && !((_b = (_a = res === null || res === void 0 ? void 0 : res.messages) === null || _a === void 0 ? void 0 : _a.moderation) === null || _b === void 0 ? void 0 : _b.type)) {
|
|
1224
|
+
pushNotifications({
|
|
1225
|
+
message: t('createPost.popup.success'),
|
|
1226
|
+
type: 'success',
|
|
1227
|
+
});
|
|
1228
|
+
onCreateEditSuccess(resData);
|
|
1229
|
+
}
|
|
1230
|
+
else {
|
|
1231
|
+
if (((_d = (_c = res === null || res === void 0 ? void 0 : res.messages) === null || _c === void 0 ? void 0 : _c.moderation) === null || _d === void 0 ? void 0 : _d.type) === 'banned') {
|
|
1232
|
+
pushNotifications({
|
|
1233
|
+
title: t('notification.post.blocked.title'),
|
|
1234
|
+
message: t('notification.post.blocked.message'),
|
|
1235
|
+
type: 'danger',
|
|
1236
|
+
});
|
|
1237
|
+
if (res.messages.moderation.words) {
|
|
1238
|
+
setBannedWords(res.messages.moderation.words);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
else if (((_f = (_e = res === null || res === void 0 ? void 0 : res.messages) === null || _e === void 0 ? void 0 : _e.moderation) === null || _f === void 0 ? void 0 : _f.type) === 'suspect') {
|
|
1242
|
+
pushNotifications({
|
|
1243
|
+
title: t('notification.post.suspect.title'),
|
|
1244
|
+
message: t('notification.post.suspect.message'),
|
|
1245
|
+
type: 'warning',
|
|
1246
|
+
});
|
|
1247
|
+
onClose && onClose();
|
|
1248
|
+
}
|
|
1249
|
+
else if ((_h = (_g = res === null || res === void 0 ? void 0 : res.messages) === null || _g === void 0 ? void 0 : _g.find) === null || _h === void 0 ? void 0 : _h.call(_g, (m) => { var _a; return !!((_a = m === null || m === void 0 ? void 0 : m.includes) === null || _a === void 0 ? void 0 : _a.call(m, 'suspend')); })) {
|
|
1250
|
+
pushNotifications({
|
|
1251
|
+
message: t('notification.suspend.message'),
|
|
1252
|
+
type: 'danger',
|
|
1253
|
+
});
|
|
1254
|
+
onClose && onClose();
|
|
1255
|
+
}
|
|
1256
|
+
else {
|
|
1257
|
+
pushNotifications({
|
|
1258
|
+
message: ((_j = res === null || res === void 0 ? void 0 : res.messages) === null || _j === void 0 ? void 0 : _j[0]) || t('notification.failure'),
|
|
1259
|
+
type: 'danger',
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1264
|
+
return (React__default.createElement(StyledCreateNewPost$1, { className: `${className} create-post-popup-frame`, style: style },
|
|
1265
|
+
React__default.createElement("div", { className: "input-group-container" },
|
|
1266
|
+
React__default.createElement(StyledFormGroupInner$1, null,
|
|
1267
|
+
React__default.createElement("div", { className: "input-group" },
|
|
1268
|
+
React__default.createElement(StylePostAction$1, null,
|
|
1269
|
+
React__default.createElement("div", { className: "avatar" }, (userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) ? (React__default.createElement("img", { alt: "avatar-icon", src: userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar, style: {
|
|
1270
|
+
width: '100%',
|
|
1271
|
+
height: '100%',
|
|
1272
|
+
objectFit: 'contain',
|
|
1273
|
+
marginLeft: 'auto',
|
|
1274
|
+
} })) : (React__default.createElement(CardAuthor, { showDetailPopup: false, avatar: "", avatarProps: { size: 40 }, name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name, userId: userInfo === null || userInfo === void 0 ? void 0 : userInfo.userId, className: "author-avatar" }))),
|
|
1275
|
+
React__default.createElement("div", { className: "post-action-form" },
|
|
1276
|
+
React__default.createElement("div", { className: "post-action-by" }, (userInfo === null || userInfo === void 0 ? void 0 : userInfo.name) || ''),
|
|
1277
|
+
React__default.createElement(Dropdown, { disabled: isInEditMode, options: postActionType, id: "post-action-type", size: "sm", className: "dropdown-post-action", placeholder: t('community.choose'), value: postActionValue, onChange: (option) => {
|
|
1278
|
+
setPostActionValue({
|
|
1279
|
+
label: option.label,
|
|
1280
|
+
value: String(option.value),
|
|
1281
|
+
});
|
|
1282
|
+
}, placeholderIcon: React__default.createElement("div", { className: "post-action-result" }, postActionValue.value === 'public' ? (React__default.createElement("img", { alt: "public-icon", src: IconPublic, style: {
|
|
1283
|
+
width: '100%',
|
|
1284
|
+
height: '100%',
|
|
1285
|
+
objectFit: 'contain',
|
|
1286
|
+
marginLeft: 'auto',
|
|
1287
|
+
} })) : (React__default.createElement("img", { alt: "anonymous-icon", src: IconAnonymous, style: {
|
|
1288
|
+
width: '100%',
|
|
1289
|
+
height: '100%',
|
|
1290
|
+
objectFit: 'contain',
|
|
1291
|
+
marginLeft: 'auto',
|
|
1292
|
+
} }))), style: {
|
|
1293
|
+
zIndex: 10,
|
|
1294
|
+
width: 'calc(100% + 20px)',
|
|
1295
|
+
} })))),
|
|
1296
|
+
React__default.createElement(CreatePostTitle$1, { className: "input-group", bannedWords: bannedWords, value: titleValue, onChange: setTitleValue }),
|
|
1297
|
+
specialCharErr && (React__default.createElement(StyledError$1, null,
|
|
1298
|
+
React__default.createElement(Info, { isSolid: true, color: theme.colors.red700, size: 14 }),
|
|
1299
|
+
React__default.createElement(Text, { size: "p3", as: "span", color: theme.colors.red700 }, t('createPost.popup.specialCharErr')))),
|
|
1300
|
+
React__default.createElement("div", { className: "input-group" },
|
|
1301
|
+
React__default.createElement(CreatePostDescription$1, { bannedWords: bannedWords, value: descriptionValue, onChange: (v) => {
|
|
1302
|
+
setDescriptionValue(v);
|
|
1303
|
+
removeKeyError('description');
|
|
1304
|
+
}, onPreviewUrlChange: setPreviewUrl, onInvalidUrlsChange: setInvalidUrls, onImageFilesChange: setImageFiles, imageFiles: imageFiles, className: `${error && (error === null || error === void 0 ? void 0 : error.description) ? 'error-description' : ''} ${showAskDoctorOptions ? 'has-ask-doctor-option' : ''}`, footerEditor: React__default.createElement(React__default.Fragment, null,
|
|
1305
|
+
showAskDoctorOptions && (React__default.createElement(StyledIsQuestion$1, { color: "", className: `${error && (error === null || error === void 0 ? void 0 : error.askDoctor) ? 'has-error' : ''} ${error && (error === null || error === void 0 ? void 0 : error.description) ? 'error-description' : ''}` },
|
|
1306
|
+
React__default.createElement("div", { className: "switch-label" },
|
|
1307
|
+
React__default.createElement(Ask, { size: isMarryBaby ? 32 : 24, isMarryBaby: isMarryBaby }),
|
|
1308
|
+
React__default.createElement("div", { className: "wrapper-text" },
|
|
1309
|
+
React__default.createElement("div", { className: "label-txt" }, t('createPost.askDoctor')),
|
|
1310
|
+
React__default.createElement("div", { className: "description-txt" }, t('createPost.askDoctor.description')))),
|
|
1311
|
+
React__default.createElement(BtnChoice, { value: isAskDoctor, choices: [
|
|
1312
|
+
{
|
|
1313
|
+
label: t('createPost.askDoctorChoice.yes'),
|
|
1314
|
+
value: true,
|
|
1315
|
+
dataEventCategory: 'Together',
|
|
1316
|
+
dataEventAction: 'Write Post Click - Ask Doctor',
|
|
1317
|
+
dataEventLabel: getCurrentHref(locale, togetherBasePath, asPath),
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
label: t('createPost.askDoctorChoice.no'),
|
|
1321
|
+
value: false,
|
|
1322
|
+
},
|
|
1323
|
+
], onChange: (v) => {
|
|
1324
|
+
if (typeof v === 'boolean') {
|
|
1325
|
+
setIsAskDoctor(v);
|
|
1326
|
+
removeKeyError('askDoctor');
|
|
1327
|
+
}
|
|
1328
|
+
} }))),
|
|
1329
|
+
error && (error === null || error === void 0 ? void 0 : error.askDoctor) && (React__default.createElement(StyledError$1, { style: { margin: '4px 0 0' } },
|
|
1330
|
+
React__default.createElement(Text, { size: "p5", as: "span", color: theme.colors.red600 }, error.askDoctor))),
|
|
1331
|
+
error && (error === null || error === void 0 ? void 0 : error.description) && (React__default.createElement(StyledError$1, { style: { margin: '4px 0 0' } },
|
|
1332
|
+
React__default.createElement(Text, { size: "p5", as: "span", color: theme.colors.red600 }, error.description)))) })),
|
|
1333
|
+
imageSrcs.length > 0 && (React__default.createElement(PostPhotosReview$1, { imageFiles: imageFiles, error: error, setImageFiles: setImageFiles, removeKeyError: removeKeyError })),
|
|
1334
|
+
socialLinkData && (React__default.createElement(PostVideoReview, { bannedWords: bannedWords, socialLinkData: socialLinkData, onSocialLinkChanged: setSocialLinkData, onInvalidUrlsChange: setInvalidUrls, onChange: (v) => {
|
|
1335
|
+
setDescriptionValue(v);
|
|
1336
|
+
} })),
|
|
1337
|
+
React__default.createElement(CreatePostCommunity$1, { communitiesList: communitiesList, currentCommunity: currentCommunity, selectedTopics: selectedTopics, forceTopics: forceSelectTopics, communityValue: communityValue, error: error, isFullscreen: false, isInEditMode: isInEditMode, setSelectedTopics: setSelectedTopics, setCommunityValue: setCommunityValue }),
|
|
1338
|
+
React__default.createElement(CreatePostPhotos$1, { imageFiles: imageFiles, setImageFiles: (data) => {
|
|
1339
|
+
setImageFiles(data);
|
|
1340
|
+
validationUploadPhoto(data);
|
|
1341
|
+
} }),
|
|
1342
|
+
React__default.createElement(CreatePostVideo, { socialLinkData: socialLinkData, setSocialLinkData: setSocialLinkData }))),
|
|
1343
|
+
React__default.createElement("div", { className: "form-action" },
|
|
1344
|
+
React__default.createElement("div", { className: "input-group" },
|
|
1345
|
+
React__default.createElement(Button, { className: "submit-btn pointer-event-child-none", size: "lg", "data-event-category": "Ask Doctor", "data-event-action": "Submit Question", "data-event-label": window.location.href, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1346
|
+
if (isReadyToSubmit && !isSubmitting) {
|
|
1347
|
+
setIsSubmitting(true);
|
|
1348
|
+
try {
|
|
1349
|
+
yield submitPost();
|
|
1350
|
+
}
|
|
1351
|
+
catch (e) {
|
|
1352
|
+
console.error(e);
|
|
1353
|
+
pushNotifications(getDefaultFailNoti(t));
|
|
1354
|
+
}
|
|
1355
|
+
setIsSubmitting(false);
|
|
1356
|
+
}
|
|
1357
|
+
}), disabled: !isReadyToSubmit, loading: isSubmitting }, t('createPost.popup.submit'))))));
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
const StyleContainer$2 = styled.div ``;
|
|
1361
|
+
const StyleContentWrapper$1 = styled.div `
|
|
1362
|
+
display: flex;
|
|
1363
|
+
flex-direction: column;
|
|
1364
|
+
gap: 16px;
|
|
1365
|
+
|
|
1366
|
+
.mantine-TopicSelectList-root {
|
|
1367
|
+
padding: 0;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
.mantine-TopicSelectList-list {
|
|
1371
|
+
gap: 12px;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
.tag-list {
|
|
1375
|
+
margin: 0;
|
|
1376
|
+
}
|
|
1377
|
+
`;
|
|
1378
|
+
const StyleWrapperButton$1 = styled.div `
|
|
1379
|
+
display: flex;
|
|
1380
|
+
flex-direction: column;
|
|
1381
|
+
gap: 8px;
|
|
1382
|
+
.other-btn-community {
|
|
1383
|
+
color: ${theme.colors.gray400};
|
|
1384
|
+
font-size: 16px;
|
|
1385
|
+
font-weight: 600;
|
|
1386
|
+
line-height: 24px;
|
|
1387
|
+
cursor: pointer;
|
|
1388
|
+
}
|
|
1389
|
+
`;
|
|
1390
|
+
|
|
1391
|
+
const StyledTopicSelectList$1 = styled.div `
|
|
1392
|
+
display: flex;
|
|
1393
|
+
width: 100%;
|
|
1394
|
+
flex-wrap: wrap;
|
|
1395
|
+
margin-top: 1rem;
|
|
1396
|
+
gap: 12px;
|
|
1397
|
+
|
|
1398
|
+
.tag-item {
|
|
1399
|
+
min-height: 32px;
|
|
1400
|
+
padding: 5px 12px;
|
|
1401
|
+
border: 1px solid ${theme.colors.neutral100};
|
|
1402
|
+
border-radius: 1rem;
|
|
1403
|
+
color: ${theme.colors.gray800};
|
|
1404
|
+
cursor: pointer;
|
|
1405
|
+
font-size: 13px;
|
|
1406
|
+
line-height: 22px;
|
|
1407
|
+
transition: all 0.2s;
|
|
1408
|
+
|
|
1409
|
+
&.--active {
|
|
1410
|
+
border-color: ${theme.colors.primary50};
|
|
1411
|
+
background: ${theme.colors.primary50};
|
|
1412
|
+
color: ${theme.colors.primaryBase};
|
|
1413
|
+
}
|
|
1414
|
+
&[data-disabled='true'] {
|
|
1415
|
+
background: ${theme.colors.gray100};
|
|
1416
|
+
color: ${theme.colors.gray800};
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
.topic-spinner {
|
|
1420
|
+
margin-right: auto;
|
|
1421
|
+
margin-left: auto;
|
|
1422
|
+
& > button {
|
|
1423
|
+
width: 24px;
|
|
1424
|
+
height: 24px;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
&[data-is-marrybaby='true'] {
|
|
1428
|
+
.tag-item {
|
|
1429
|
+
border-color: transparent;
|
|
1430
|
+
background: #f3f3f3;
|
|
1431
|
+
color: #3e3f58;
|
|
1432
|
+
&.--active {
|
|
1433
|
+
border-color: #b6cdff;
|
|
1434
|
+
background: #e0e9fb;
|
|
1435
|
+
color: #3e3f58;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
`;
|
|
1440
|
+
|
|
1441
|
+
const TopicSelectList$1 = ({ className, style, topics: topicsProp, communityId, onChange, isLoading, disabled, forceTopics, selectedTopics: selectedTopicsProp, noFetch, dataEventCategory, dataEventAction, dataEventLabel, }) => {
|
|
1442
|
+
const { data: { locale, env: { isMarryBaby }, }, } = useContext(TogetherComponentGlobalContext);
|
|
1443
|
+
const [topics, setTopics] = useState(topicsProp ? [...topicsProp] : []);
|
|
1444
|
+
const [selectedTopics, setSelectedTopics] = useState(selectedTopicsProp ? [...selectedTopicsProp] : []);
|
|
1445
|
+
const [isLoadingTopics, setIsLoadingTopics] = useState(false);
|
|
1446
|
+
const topicsPropRef = useRef(topicsProp);
|
|
1447
|
+
topicsPropRef.current = topicsProp;
|
|
1448
|
+
useEffect(() => {
|
|
1449
|
+
var _a;
|
|
1450
|
+
if (communityId && !noFetch && !((_a = topicsPropRef.current) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1451
|
+
setTopics([]);
|
|
1452
|
+
setIsLoadingTopics(true);
|
|
1453
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
1454
|
+
var _b;
|
|
1455
|
+
try {
|
|
1456
|
+
const res = yield callApi(getApiPath(PATHS.TOPIC.LIST, {
|
|
1457
|
+
communityId: communityId,
|
|
1458
|
+
_locale: locale,
|
|
1459
|
+
}), 'GET');
|
|
1460
|
+
const topicRes = (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.topics;
|
|
1461
|
+
if (Array.isArray(topicRes)) {
|
|
1462
|
+
setTopics(() => (topicRes === null || topicRes === void 0 ? void 0 : topicRes.map(formatTopic).sort((t1, t2) => (t1.order || 0) - (t2.order || 0))) || []);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
catch (e) {
|
|
1466
|
+
console.log(e);
|
|
1467
|
+
setIsLoadingTopics(false);
|
|
1468
|
+
}
|
|
1469
|
+
setIsLoadingTopics(false);
|
|
1470
|
+
}))();
|
|
1471
|
+
}
|
|
1472
|
+
}, [communityId, noFetch]);
|
|
1473
|
+
const topicsPropString = topicsProp === null || topicsProp === void 0 ? void 0 : topicsProp.map((t) => t.id).join('-');
|
|
1474
|
+
const topicsStateString = topics === null || topics === void 0 ? void 0 : topics.map((t) => t.id).join('-');
|
|
1475
|
+
const forceTopicsPropString = forceTopics === null || forceTopics === void 0 ? void 0 : forceTopics.map((t) => t.id).join('-');
|
|
1476
|
+
useEffect(() => {
|
|
1477
|
+
if (topicsProp &&
|
|
1478
|
+
typeof topicsPropString !== 'undefined' &&
|
|
1479
|
+
topicsPropString !== topicsStateString) {
|
|
1480
|
+
setTopics(topicsProp);
|
|
1481
|
+
}
|
|
1482
|
+
}, [topicsProp, topicsPropString, topicsStateString]);
|
|
1483
|
+
const topicsWithoutForced = useMemo(() => topics.filter((t) => !(forceTopics === null || forceTopics === void 0 ? void 0 : forceTopics.some((ft) => (ft.id && ft.id === t.id) ||
|
|
1484
|
+
(ft.mappedCategoryId &&
|
|
1485
|
+
ft.mappedCategoryId === t.mappedCategoryId)))), [topicsStateString, forceTopicsPropString]);
|
|
1486
|
+
return (React__default.createElement(StyledTopicSelectList$1, { "data-is-marrybaby": isMarryBaby, className: className, style: style },
|
|
1487
|
+
forceTopics.map((topic) => (React__default.createElement(TopicItem$1, { key: `${topic.id}-${topic.mappedCategoryId}`, topic: topic, disabled: true, selected: true, dataEventAction: dataEventAction, dataEventCategory: dataEventCategory, dataEventLabel: dataEventLabel }))),
|
|
1488
|
+
topicsWithoutForced.map((topic) => (React__default.createElement(TopicItem$1, { key: `${topic.id}-${topic.mappedCategoryId}`, topic: topic, disabled: disabled, selected: (selectedTopicsProp || selectedTopics).some((t) => (t.id && t.id === topic.id) ||
|
|
1489
|
+
(t.mappedCategoryId &&
|
|
1490
|
+
t.mappedCategoryId === topic.mappedCategoryId)), onClick: () => {
|
|
1491
|
+
const _selected = selectedTopicsProp || selectedTopics;
|
|
1492
|
+
const foundIndex = _selected.findIndex((_selected) => (_selected.id && _selected.id === topic.id) ||
|
|
1493
|
+
(_selected.mappedCategoryId &&
|
|
1494
|
+
_selected.mappedCategoryId === topic.mappedCategoryId));
|
|
1495
|
+
if (foundIndex !== -1) {
|
|
1496
|
+
_selected.splice(foundIndex, 1);
|
|
1497
|
+
}
|
|
1498
|
+
else {
|
|
1499
|
+
_selected.push(topic);
|
|
1500
|
+
}
|
|
1501
|
+
if (onChange && selectedTopicsProp) {
|
|
1502
|
+
onChange(_selected.slice());
|
|
1503
|
+
}
|
|
1504
|
+
else {
|
|
1505
|
+
onChange && onChange(_selected.slice());
|
|
1506
|
+
setSelectedTopics(_selected.slice());
|
|
1507
|
+
}
|
|
1508
|
+
}, dataEventAction: dataEventAction, dataEventCategory: dataEventCategory, dataEventLabel: dataEventLabel }))),
|
|
1509
|
+
(isLoading || isLoadingTopics) && React__default.createElement(Loading$1, { className: "topic-spinner" })));
|
|
1510
|
+
};
|
|
1511
|
+
const TopicItem$1 = (_a) => {
|
|
1512
|
+
var { topic, disabled, selected, onClick } = _a, rest = __rest(_a, ["topic", "disabled", "selected", "onClick"]);
|
|
1513
|
+
return (React__default.createElement("div", Object.assign({ className: 'tag-item' + (selected ? ' --active' : ''), "data-disabled": disabled, onClick: !disabled ? onClick : undefined }, rest), topic.name));
|
|
1514
|
+
};
|
|
1515
|
+
|
|
1516
|
+
const StyleContainer$1 = styled.div `
|
|
1517
|
+
border-radius: 8px;
|
|
1518
|
+
border: 1px solid ${theme.colors.neutral100};
|
|
1519
|
+
background: ${theme.colors.white};
|
|
1520
|
+
border: 1px solid ${theme.colors.neutral100};
|
|
1521
|
+
.card-header {
|
|
1522
|
+
padding: 12px 16px;
|
|
1523
|
+
color: ${theme.colors.gray800};
|
|
1524
|
+
font-size: 14px;
|
|
1525
|
+
font-weight: 600;
|
|
1526
|
+
line-height: 22px;
|
|
1527
|
+
border-bottom: 1px solid ${theme.colors.neutral100};
|
|
1528
|
+
background: ${theme.colors.neutral50};
|
|
1529
|
+
border-radius: 8px 8px 0px 0px;
|
|
1530
|
+
}
|
|
1531
|
+
.card-body {
|
|
1532
|
+
padding: 16px;
|
|
1533
|
+
}
|
|
1534
|
+
`;
|
|
1535
|
+
|
|
1536
|
+
const CardPostCommunity = ({ title, children }) => {
|
|
1537
|
+
return (React__default.createElement(StyleContainer$1, null,
|
|
1538
|
+
React__default.createElement("div", { className: "card-header" }, title),
|
|
1539
|
+
React__default.createElement("div", { className: "card-body" }, children)));
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
const CommonCommunity = ({ communitiesList, communityValue, selectedTopics, defaultCommunity, isInEditMode, setCommunityValue, setSelectedTopics, onSubmitPost, }) => {
|
|
1543
|
+
const { t } = useTranslations();
|
|
1544
|
+
useEffect(() => {
|
|
1545
|
+
if (defaultCommunity && !isInEditMode) {
|
|
1546
|
+
setCommunityValue({
|
|
1547
|
+
label: defaultCommunity.name,
|
|
1548
|
+
value: defaultCommunity.id,
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
}, [defaultCommunity, isInEditMode]);
|
|
1552
|
+
return (React__default.createElement(StyleContainer$2, null,
|
|
1553
|
+
React__default.createElement(StyleContentWrapper$1, null,
|
|
1554
|
+
React__default.createElement(CardPostCommunity, { title: t('admin.community') },
|
|
1555
|
+
React__default.createElement(Dropdown, { options: (communitiesList === null || communitiesList === void 0 ? void 0 : communitiesList.map((c) => ({
|
|
1556
|
+
label: c.name,
|
|
1557
|
+
value: c.id || '',
|
|
1558
|
+
}))) || [], id: "community-picker", disabled: isInEditMode, value: communityValue, placeholder: t('community.choose'), onChange: (option) => {
|
|
1559
|
+
setCommunityValue({
|
|
1560
|
+
label: option.label,
|
|
1561
|
+
value: String(option.value),
|
|
1562
|
+
});
|
|
1563
|
+
setSelectedTopics([]);
|
|
1564
|
+
}, style: {
|
|
1565
|
+
zIndex: 1,
|
|
1566
|
+
} })),
|
|
1567
|
+
React__default.createElement(CardPostCommunity, { title: t('tab.topic') }, communityValue.value ? (React__default.createElement(TopicSelectList$1, { className: "tag-list", communityId: Number(communityValue.value), onChange: (topics) => setSelectedTopics(topics), selectedTopics: selectedTopics, forceTopics: [] })) : (React__default.createElement("div", { style: { height: '30px' } }))),
|
|
1568
|
+
React__default.createElement(StyleWrapperButton$1, null,
|
|
1569
|
+
React__default.createElement(Button, { className: "submit-btn", size: "lg", "data-event-category": "Ask Doctor", "data-event-action": "Submit Question", "data-event-label": window.location.href, "data-testid": "Button Post", disabled: !communityValue.value, onClick: () => onSubmitPost() }, t('createPost.popup.submit'))))));
|
|
1570
|
+
};
|
|
1571
|
+
|
|
1572
|
+
styled.div `
|
|
1573
|
+
display: flex;
|
|
1574
|
+
flex-direction: column;
|
|
1575
|
+
gap: 8px;
|
|
1576
|
+
margin-top: 8px;
|
|
1577
|
+
|
|
1578
|
+
.topic-review {
|
|
1579
|
+
display: flex;
|
|
1580
|
+
gap: 4px;
|
|
1581
|
+
flex-wrap: wrap;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
.community-review {
|
|
1585
|
+
.tag-item {
|
|
1586
|
+
background-color: ${theme.colors.neutral50};
|
|
1587
|
+
|
|
1588
|
+
img {
|
|
1589
|
+
border-radius: 50%;
|
|
1590
|
+
margin-right: 8px;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
`;
|
|
1595
|
+
const StyleDrawer = styled.div `
|
|
1596
|
+
background-color: white;
|
|
1597
|
+
z-index: 1000;
|
|
1598
|
+
top: 0;
|
|
1599
|
+
left: 0;
|
|
1600
|
+
height: 100%;
|
|
1601
|
+
position: absolute;
|
|
1602
|
+
width: 100%;
|
|
1603
|
+
|
|
1604
|
+
.drawer-header {
|
|
1605
|
+
display: flex;
|
|
1606
|
+
gap: 12px;
|
|
1607
|
+
align-items: center;
|
|
1608
|
+
padding: 12px 16px;
|
|
1609
|
+
border-bottom: 1px solid ${theme.colors.gray200};
|
|
1610
|
+
|
|
1611
|
+
img {
|
|
1612
|
+
cursor: pointer;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
p {
|
|
1616
|
+
flex: 1;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
.drawer-content {
|
|
1621
|
+
padding: 24px;
|
|
1622
|
+
display: flex;
|
|
1623
|
+
flex-direction: column;
|
|
1624
|
+
gap: 16px;
|
|
1625
|
+
overflow-y: auto;
|
|
1626
|
+
height: calc(100% - 49px);
|
|
1627
|
+
|
|
1628
|
+
${MediaQueries.mbDown} {
|
|
1629
|
+
padding: 16px;
|
|
1630
|
+
&.drawer-content-adjust {
|
|
1631
|
+
justify-content: center;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
.input-field-label {
|
|
1636
|
+
margin-bottom: 8px;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
&.drawer-content-full-screen {
|
|
1640
|
+
max-width: 680px;
|
|
1641
|
+
margin: 0 auto;
|
|
1642
|
+
padding: 16px 24px;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
`;
|
|
1646
|
+
|
|
1647
|
+
const StyleContainer = styled.div `
|
|
1648
|
+
display: flex;
|
|
1649
|
+
flex-direction: column;
|
|
1650
|
+
gap: 32px;
|
|
1651
|
+
`;
|
|
1652
|
+
const StyleSearchWrapper = styled.div `
|
|
1653
|
+
display: flex;
|
|
1654
|
+
flex-direction: column;
|
|
1655
|
+
justify-content: center;
|
|
1656
|
+
gap: 24px;
|
|
1657
|
+
align-items: center;
|
|
1658
|
+
max-width: 400px;
|
|
1659
|
+
margin: 0 auto;
|
|
1660
|
+
.search-description {
|
|
1661
|
+
text-align: center;
|
|
1662
|
+
font-size: 16px;
|
|
1663
|
+
font-weight: 600;
|
|
1664
|
+
line-height: 24px;
|
|
1665
|
+
background: linear-gradient(92deg, #45a4ff 16.17%, #00c076 98.95%);
|
|
1666
|
+
background-clip: text;
|
|
1667
|
+
-webkit-background-clip: text;
|
|
1668
|
+
-webkit-text-fill-color: transparent;
|
|
1669
|
+
}
|
|
1670
|
+
.result-search-description {
|
|
1671
|
+
color: ${theme.colors.gray800};
|
|
1672
|
+
font-size: 16px;
|
|
1673
|
+
font-weight: 400;
|
|
1674
|
+
line-height: 24px;
|
|
1675
|
+
text-align: center;
|
|
1676
|
+
}
|
|
1677
|
+
`;
|
|
1678
|
+
const StyleContentWrapper = styled.div `
|
|
1679
|
+
display: flex;
|
|
1680
|
+
flex-direction: column;
|
|
1681
|
+
gap: 16px;
|
|
1682
|
+
|
|
1683
|
+
.tag-item-review {
|
|
1684
|
+
display: flex;
|
|
1685
|
+
align-items: center;
|
|
1686
|
+
gap: 12px;
|
|
1687
|
+
|
|
1688
|
+
.tag-item-label {
|
|
1689
|
+
flex: 1;
|
|
1690
|
+
color: ${theme.colors.gray800};
|
|
1691
|
+
font-size: 16px;
|
|
1692
|
+
font-weight: 400;
|
|
1693
|
+
line-height: 24px;
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
.topic-item-review-wrapper {
|
|
1697
|
+
display: flex;
|
|
1698
|
+
gap: 12px;
|
|
1699
|
+
flex-wrap: wrap;
|
|
1700
|
+
}
|
|
1701
|
+
.topic-item-review {
|
|
1702
|
+
border-radius: 40px;
|
|
1703
|
+
background: ${theme.colors.blue50};
|
|
1704
|
+
padding: 6px 12px;
|
|
1705
|
+
}
|
|
1706
|
+
`;
|
|
1707
|
+
const StyleWrapperButton = styled.div `
|
|
1708
|
+
display: flex;
|
|
1709
|
+
flex-direction: column;
|
|
1710
|
+
gap: 8px;
|
|
1711
|
+
.other-btn-community {
|
|
1712
|
+
color: ${theme.colors.gray400};
|
|
1713
|
+
font-size: 16px;
|
|
1714
|
+
font-weight: 600;
|
|
1715
|
+
line-height: 24px;
|
|
1716
|
+
cursor: pointer;
|
|
1717
|
+
}
|
|
1718
|
+
`;
|
|
1719
|
+
|
|
1720
|
+
var img$1 = "data:image/svg+xml,%3csvg width='268' height='268' viewBox='0 0 268 268' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg filter='url(%23filter0_f_270_203608)'%3e%3ccircle cx='134.175' cy='134.174' r='99.1225' fill='url(%23paint0_linear_270_203608)'/%3e%3c/g%3e%3cpath d='M143.63 122.941C143.884 121.934 145.315 121.934 145.569 122.941L146.243 125.609C147.585 130.925 151.907 134.969 157.301 135.954L158.295 136.136C159.389 136.336 159.389 137.903 158.295 138.103L157.301 138.285C151.907 139.271 147.585 143.314 146.243 148.631L145.569 151.299C145.315 152.306 143.884 152.306 143.63 151.299L142.956 148.631C141.614 143.314 137.292 139.271 131.899 138.285L130.904 138.103C129.81 137.904 129.81 136.336 130.904 136.136L131.899 135.954C137.292 134.969 141.614 130.925 142.956 125.609L143.63 122.941Z' fill='url(%23paint1_linear_270_203608)'/%3e%3cpath d='M134.365 89.0399C134.461 88.2144 135.659 88.2144 135.755 89.04L135.958 90.7817C136.317 93.8718 138.673 96.3541 141.74 96.8746L143.713 97.2094C144.49 97.3413 144.49 98.4578 143.713 98.5897L141.74 98.9246C138.673 99.4451 136.317 101.927 135.958 105.017L135.755 106.759C135.659 107.585 134.461 107.585 134.365 106.759L134.162 105.017C133.803 101.927 131.447 99.4451 128.38 98.9246L126.407 98.5897C125.629 98.4578 125.629 97.3413 126.407 97.2094L128.38 96.8746C131.447 96.3541 133.803 93.8718 134.162 90.7816L134.365 89.0399Z' fill='url(%23paint2_linear_270_203608)'/%3e%3cdefs%3e%3cfilter id='filter0_f_270_203608' x='0.782799' y='0.781822' width='266.784' height='266.785' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3e%3cfeFlood flood-opacity='0' result='BackgroundImageFix'/%3e%3cfeBlend mode='normal' in='SourceGraphic' in2='BackgroundImageFix' result='shape'/%3e%3cfeGaussianBlur stdDeviation='17.135' result='effect1_foregroundBlur_270_203608'/%3e%3c/filter%3e%3clinearGradient id='paint0_linear_270_203608' x1='55.5444' y1='48.7129' x2='193.903' y2='233.297' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%23A7D2FF'/%3e%3cstop offset='1' stop-color='%2376EE9A' stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient id='paint1_linear_270_203608' x1='144.6' y1='118.518' x2='144.6' y2='155.721' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0.26' stop-color='%2378B0F6'/%3e%3cstop offset='1' stop-color='%2376F197'/%3e%3c/linearGradient%3e%3clinearGradient id='paint2_linear_270_203608' x1='135.06' y1='82.5809' x2='135.06' y2='113.218' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0.26' stop-color='%2378B0F6'/%3e%3cstop offset='1' stop-color='%2376F197'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
|
|
1721
|
+
var IconSuggestSearch = img$1;
|
|
1722
|
+
|
|
1723
|
+
const SuggestedCommunity = ({ currentCommunity, selectedTopics, isLoading, clickOtherCommunity, onSubmitPost, }) => {
|
|
1724
|
+
const { t } = useTranslations();
|
|
1725
|
+
return (React__default.createElement(StyleContainer, null,
|
|
1726
|
+
isLoading || !currentCommunity ? (React__default.createElement(StyleSearchWrapper, null,
|
|
1727
|
+
React__default.createElement("img", { alt: "anonymous-icon", src: IconSuggestSearch, style: {
|
|
1728
|
+
width: '212px',
|
|
1729
|
+
height: '212px',
|
|
1730
|
+
objectFit: 'contain',
|
|
1731
|
+
} }),
|
|
1732
|
+
isLoading ? (React__default.createElement("div", { className: "search-description" },
|
|
1733
|
+
t('createPost.message.suggestLoading'),
|
|
1734
|
+
"...")) : (React__default.createElement("div", { className: "result-search-description" }, t('createPost.message.suggestResult'))))) : (React__default.createElement(StyleContentWrapper, null,
|
|
1735
|
+
React__default.createElement(CardPostCommunity, { title: t('admin.community') },
|
|
1736
|
+
React__default.createElement(React__default.Fragment, null, currentCommunity && (React__default.createElement("div", { className: "tag-item-review" },
|
|
1737
|
+
React__default.createElement("img", { alt: "community-thumbnail", src: currentCommunity.thumbnail, style: {
|
|
1738
|
+
width: '40px',
|
|
1739
|
+
height: '40px',
|
|
1740
|
+
objectFit: 'contain',
|
|
1741
|
+
marginLeft: 'auto',
|
|
1742
|
+
flex: '0 0 40px',
|
|
1743
|
+
} }),
|
|
1744
|
+
React__default.createElement(Text, { size: "p4", as: "span", color: "inherit", className: "tag-item-label" }, currentCommunity.name))))),
|
|
1745
|
+
selectedTopics.length > 0 && (React__default.createElement(CardPostCommunity, { title: t('tab.topic') },
|
|
1746
|
+
React__default.createElement("div", { className: "topic-item-review-wrapper" }, selectedTopics.map((item, index) => (React__default.createElement("div", { className: "topic-item-review", key: index },
|
|
1747
|
+
React__default.createElement(Text, { size: "p4", as: "span", color: "inherit", className: "tag-item-label" }, item.name))))))))),
|
|
1748
|
+
!isLoading && (React__default.createElement(StyleWrapperButton, null,
|
|
1749
|
+
React__default.createElement(Button, { className: "submit-btn", size: "lg", "data-testid": "Button Post", "data-event-category": "Ask Doctor", "data-event-action": "Submit Question", "data-event-label": window.location.href, onClick: () => onSubmitPost(!currentCommunity) }, t('createPost.now')),
|
|
1750
|
+
React__default.createElement(Button, { variant: "ghost", className: "other-btn-community", type: "button", onClick: clickOtherCommunity }, currentCommunity
|
|
1751
|
+
? t('choose.other.community')
|
|
1752
|
+
: t('choose.community'))))));
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
const CreatePostCommunity = ({ communitiesList, currentCommunity, selectedTopics, communityValue, isInEditMode, isLoadingSuggest, defaultCommunity, isMarryBaby = false, setSelectedTopics, setCommunityValue, onSubmitPost, setStepPost, }) => {
|
|
1756
|
+
const { t, locale } = useTranslations();
|
|
1757
|
+
const [typeSelectionCommunity, setTypeSelectionCommunity] = useState('chatbot');
|
|
1758
|
+
const clickOtherCommunity = () => {
|
|
1759
|
+
setTypeSelectionCommunity('manual');
|
|
1760
|
+
setCommunityValue({
|
|
1761
|
+
label: t('community.choose'),
|
|
1762
|
+
value: '',
|
|
1763
|
+
});
|
|
1764
|
+
setSelectedTopics([]);
|
|
1765
|
+
};
|
|
1766
|
+
const onClickBack = () => {
|
|
1767
|
+
setCommunityValue({
|
|
1768
|
+
label: t('community.choose'),
|
|
1769
|
+
value: '',
|
|
1770
|
+
});
|
|
1771
|
+
setSelectedTopics([]);
|
|
1772
|
+
setStepPost === null || setStepPost === void 0 ? void 0 : setStepPost('step_info');
|
|
1773
|
+
};
|
|
1774
|
+
return ReactDOM.createPortal(React__default.createElement(StyleDrawer, null,
|
|
1775
|
+
React__default.createElement("div", { className: "drawer-header" },
|
|
1776
|
+
React__default.createElement("img", { alt: "public-icon", src: IconArrowLeft, onClick: onClickBack, style: {
|
|
1777
|
+
width: '24px',
|
|
1778
|
+
height: '24px',
|
|
1779
|
+
objectFit: 'contain',
|
|
1780
|
+
marginLeft: 'auto',
|
|
1781
|
+
} }),
|
|
1782
|
+
React__default.createElement(Text, { size: "p3", className: "input-group-label", weight: "semiBold" }, t('createPost.communityAndTopic'))),
|
|
1783
|
+
React__default.createElement("div", { className: `drawer-content` }, !isInEditMode &&
|
|
1784
|
+
typeSelectionCommunity === 'chatbot' &&
|
|
1785
|
+
locale === LOCALE.Vietnam &&
|
|
1786
|
+
!isMarryBaby ? (React__default.createElement(SuggestedCommunity, { selectedTopics: selectedTopics, currentCommunity: currentCommunity, isLoading: isLoadingSuggest, clickOtherCommunity: clickOtherCommunity, onSubmitPost: onSubmitPost })) : (React__default.createElement(CommonCommunity, { communitiesList: communitiesList, communityValue: communityValue, selectedTopics: selectedTopics, isInEditMode: isInEditMode, defaultCommunity: defaultCommunity, setCommunityValue: setCommunityValue, setSelectedTopics: setSelectedTopics, onSubmitPost: onSubmitPost })))), document.querySelector('.create-post-popup-frame') || document.body);
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
const StyledCreatePostDescription = styled.div `
|
|
1790
|
+
input:focus,
|
|
1791
|
+
textarea:focus,
|
|
1792
|
+
[contenteditable='true'] {
|
|
1793
|
+
outline: none;
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
&.has-ask-doctor-option {
|
|
1797
|
+
.textarea-control {
|
|
1798
|
+
border-bottom: none;
|
|
1799
|
+
border-radius: 4px 4px 0 0;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
&.error-description {
|
|
1804
|
+
.textarea-control {
|
|
1805
|
+
border: 1px solid ${theme.colors.red600};
|
|
1806
|
+
border-bottom: none;
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
.textarea-control {
|
|
1811
|
+
position: relative;
|
|
1812
|
+
border: 1px solid ${theme.colors.gray200};
|
|
1813
|
+
border-bottom: none;
|
|
1814
|
+
border-radius: 8px 8px 0 0;
|
|
1815
|
+
&.--focus {
|
|
1816
|
+
border-color: ${theme.colors.primaryBase};
|
|
1817
|
+
box-shadow: 0px 0px 2px 2px ${theme.colors.primary200};
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
.textarea-wrapper {
|
|
1821
|
+
width: 100%;
|
|
1822
|
+
min-height: 268px;
|
|
1823
|
+
height: auto;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
.control-tool {
|
|
1827
|
+
position: absolute;
|
|
1828
|
+
bottom: 0;
|
|
1829
|
+
left: 0;
|
|
1830
|
+
display: flex;
|
|
1831
|
+
width: calc(100% - 2rem);
|
|
1832
|
+
height: 40px;
|
|
1833
|
+
align-items: center;
|
|
1834
|
+
justify-content: flex-end;
|
|
1835
|
+
border-top: 1px solid ${theme.colors.gray200};
|
|
1836
|
+
margin: 0 1rem;
|
|
1837
|
+
|
|
1838
|
+
.tool-button {
|
|
1839
|
+
display: flex;
|
|
1840
|
+
width: 2rem;
|
|
1841
|
+
height: 2rem;
|
|
1842
|
+
align-items: center;
|
|
1843
|
+
justify-content: center;
|
|
1844
|
+
background: transparent;
|
|
1845
|
+
cursor: pointer;
|
|
1846
|
+
}
|
|
1847
|
+
.image-icon {
|
|
1848
|
+
vertical-align: middle;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
.link-preview-wrapper {
|
|
1854
|
+
position: relative;
|
|
1855
|
+
.icon-close {
|
|
1856
|
+
position: absolute;
|
|
1857
|
+
top: 5px;
|
|
1858
|
+
right: 5px;
|
|
1859
|
+
width: 24px;
|
|
1860
|
+
height: 24px;
|
|
1861
|
+
cursor: pointer;
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
.image-gallery {
|
|
1866
|
+
margin-bottom: 1rem;
|
|
1867
|
+
|
|
1868
|
+
.image-item {
|
|
1869
|
+
position: relative;
|
|
1870
|
+
overflow: hidden;
|
|
1871
|
+
width: 100%;
|
|
1872
|
+
height: 0;
|
|
1873
|
+
padding-top: 67%;
|
|
1874
|
+
margin-top: 1rem;
|
|
1875
|
+
border-radius: ${theme.borderRadius};
|
|
1876
|
+
|
|
1877
|
+
& > img {
|
|
1878
|
+
position: absolute;
|
|
1879
|
+
top: 0;
|
|
1880
|
+
left: 0;
|
|
1881
|
+
width: 100%;
|
|
1882
|
+
height: 100%;
|
|
1883
|
+
object-fit: cover;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
.close-btn {
|
|
1887
|
+
position: absolute;
|
|
1888
|
+
top: 8px;
|
|
1889
|
+
right: 8px;
|
|
1890
|
+
left: unset;
|
|
1891
|
+
width: 24px;
|
|
1892
|
+
height: 24px;
|
|
1893
|
+
cursor: pointer;
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
.description-label {
|
|
1899
|
+
margin-bottom: 5px;
|
|
1900
|
+
color: ${theme.colors.gray600};
|
|
1901
|
+
/* font-family: 'Open Sans', sans-serif; */
|
|
1902
|
+
font-size: 13px;
|
|
1903
|
+
font-weight: bold;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
.count-string {
|
|
1907
|
+
margin-top: 5px;
|
|
1908
|
+
color: ${theme.colors.gray500};
|
|
1909
|
+
font-size: 11px;
|
|
1910
|
+
text-align: right;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
.input-notification {
|
|
1914
|
+
display: flex;
|
|
1915
|
+
|
|
1916
|
+
& > img {
|
|
1917
|
+
width: 16px;
|
|
1918
|
+
height: 16px;
|
|
1919
|
+
margin-top: 1.5px;
|
|
1920
|
+
margin-right: 8px;
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
`;
|
|
1924
|
+
const StyledEditorContainer = styled.div `
|
|
1925
|
+
height: 100%;
|
|
1926
|
+
position: relative;
|
|
1927
|
+
width: 100%;
|
|
1928
|
+
display: flex;
|
|
1929
|
+
flex-direction: column;
|
|
1930
|
+
.ql-toolbar.ql-snow {
|
|
1931
|
+
top: 0;
|
|
1932
|
+
width: 100%;
|
|
1933
|
+
// position: sticky;
|
|
1934
|
+
z-index: 3;
|
|
1935
|
+
border: none;
|
|
1936
|
+
border-bottom: 1px solid #ccc;
|
|
1937
|
+
border-radius: 8px 8px 0 0;
|
|
1938
|
+
background: white;
|
|
1939
|
+
.ql-formats {
|
|
1940
|
+
display: inline-flex;
|
|
1941
|
+
align-items: center;
|
|
1942
|
+
margin-right: 0.5rem;
|
|
1943
|
+
.link-tool-wrapper {
|
|
1944
|
+
.popover-menu__content {
|
|
1945
|
+
padding: 0.5rem;
|
|
1946
|
+
transform: translateX(calc(-50% - 1rem));
|
|
1947
|
+
max-width: calc(100vw - 4rem);
|
|
1948
|
+
::before {
|
|
1949
|
+
right: calc(50% - 8px);
|
|
1950
|
+
}
|
|
1951
|
+
.link-tool-popover {
|
|
1952
|
+
input {
|
|
1953
|
+
padding-left: 1rem;
|
|
1954
|
+
}
|
|
1955
|
+
.link-input-url {
|
|
1956
|
+
margin-bottom: 0.5rem;
|
|
1957
|
+
}
|
|
1958
|
+
.link-input-text {
|
|
1959
|
+
margin-bottom: 0.5rem;
|
|
1960
|
+
}
|
|
1961
|
+
label {
|
|
1962
|
+
display: inline-block;
|
|
1963
|
+
margin-bottom: 0.2rem;
|
|
1964
|
+
}
|
|
1965
|
+
.link-input-button-wrapper {
|
|
1966
|
+
&[data-is-marrybaby='true'] {
|
|
1967
|
+
.link-input-button {
|
|
1968
|
+
border: solid 2px ${theme.mbColors.pink};
|
|
1969
|
+
background-color: ${theme.mbColors.pink};
|
|
1970
|
+
&:hover:not(:disabled) {
|
|
1971
|
+
border: solid 2px ${theme.mbColors.pink};
|
|
1972
|
+
background-color: ${theme.colors.white};
|
|
1973
|
+
color: ${theme.mbColors.pink};
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
.link-input-button {
|
|
1979
|
+
width: auto;
|
|
1980
|
+
height: auto;
|
|
1981
|
+
padding: 0.4rem 1rem;
|
|
1982
|
+
background-color: ${theme.colors.primaryBase};
|
|
1983
|
+
|
|
1984
|
+
&:disabled {
|
|
1985
|
+
border-color: #bfbfbf;
|
|
1986
|
+
background-color: #bfbfbf;
|
|
1987
|
+
color: #fff;
|
|
1988
|
+
cursor: not-allowed;
|
|
1989
|
+
}
|
|
1990
|
+
&:hover:not(:disabled) {
|
|
1991
|
+
background-color: ${theme.colors.primaryHover};
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
.error-text {
|
|
1995
|
+
padding: 0;
|
|
1996
|
+
margin-bottom: 0.5rem;
|
|
1997
|
+
font-weight: 600;
|
|
1998
|
+
color: ${theme.colors.red700};
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
@media (max-width: 450px) {
|
|
2005
|
+
position: relative;
|
|
2006
|
+
.ql-formats {
|
|
2007
|
+
.link-tool-wrapper {
|
|
2008
|
+
position: unset;
|
|
2009
|
+
.popover-menu__content {
|
|
2010
|
+
left: 0;
|
|
2011
|
+
transform: unset;
|
|
2012
|
+
max-width: 100%;
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
.quill {
|
|
2019
|
+
flex: 1;
|
|
2020
|
+
overflow-y: hidden;
|
|
2021
|
+
.ql-container {
|
|
2022
|
+
display: inline-block;
|
|
2023
|
+
width: 100%;
|
|
2024
|
+
min-height: 100%;
|
|
2025
|
+
/* padding: 14px 16px; */
|
|
2026
|
+
border: none;
|
|
2027
|
+
border-radius: ${theme.borderRadius};
|
|
2028
|
+
color: ${theme.colors.gray800};
|
|
2029
|
+
font-size: 1rem;
|
|
2030
|
+
line-height: 1.5;
|
|
2031
|
+
resize: none;
|
|
2032
|
+
white-space: break-spaces;
|
|
2033
|
+
.ql-editor {
|
|
2034
|
+
word-break: break-word;
|
|
2035
|
+
overflow-wrap: break-word;
|
|
2036
|
+
/* -ms-overflow-style: none;
|
|
2037
|
+
scrollbar-width: none;
|
|
2038
|
+
&::-webkit-scrollbar {
|
|
2039
|
+
display: none;
|
|
2040
|
+
} */
|
|
2041
|
+
|
|
2042
|
+
&::before {
|
|
2043
|
+
font-size: 16px;
|
|
2044
|
+
color: ${theme.colors.gray400};
|
|
2045
|
+
font-weight: 400;
|
|
2046
|
+
line-height: 24px;
|
|
2047
|
+
font-style: normal;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
mocka {
|
|
2051
|
+
padding: 2px 6px;
|
|
2052
|
+
border-radius: 1rem;
|
|
2053
|
+
&[data-url='true'] {
|
|
2054
|
+
/* background-color: #eeeeff; */
|
|
2055
|
+
font-style: italic;
|
|
2056
|
+
color: #1890ff;
|
|
2057
|
+
cursor: pointer;
|
|
2058
|
+
outline: none;
|
|
2059
|
+
text-decoration: underline;
|
|
2060
|
+
}
|
|
2061
|
+
&[data-error='true'] {
|
|
2062
|
+
background-color: #ffeeee;
|
|
2063
|
+
color: red;
|
|
2064
|
+
text-decoration: underline;
|
|
2065
|
+
font-style: bold;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
mention {
|
|
2069
|
+
padding: 2px 6px;
|
|
2070
|
+
border-radius: 1rem;
|
|
2071
|
+
background-color: #eeeeff;
|
|
2072
|
+
color: #1890ff;
|
|
2073
|
+
cursor: pointer;
|
|
2074
|
+
outline: none;
|
|
2075
|
+
text-decoration: none;
|
|
2076
|
+
}
|
|
2077
|
+
ol,
|
|
2078
|
+
ul {
|
|
2079
|
+
padding-left: 1rem;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
.mention-search-container {
|
|
2084
|
+
position: absolute;
|
|
2085
|
+
background: white;
|
|
2086
|
+
border-radius: ${theme.borderRadius};
|
|
2087
|
+
filter: drop-shadow(0px 10px 16px rgba(0, 0, 0, 0.04))
|
|
2088
|
+
drop-shadow(0px 2px 8px rgba(0, 0, 0, 0.04))
|
|
2089
|
+
drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.04));
|
|
2090
|
+
overflow-y: scroll;
|
|
2091
|
+
z-index: 99;
|
|
2092
|
+
::-webkit-scrollbar {
|
|
2093
|
+
-webkit-appearance: none;
|
|
2094
|
+
}
|
|
2095
|
+
::-webkit-scrollbar:vertical {
|
|
2096
|
+
width: 14px;
|
|
2097
|
+
}
|
|
2098
|
+
::-webkit-scrollbar-thumb {
|
|
2099
|
+
border-radius: ${theme.borderRadius};
|
|
2100
|
+
background-color: #d9d9d9;
|
|
2101
|
+
@supports (background-clip: padding-box) {
|
|
2102
|
+
border: 3px solid rgba(0, 0, 0, 0);
|
|
2103
|
+
background-clip: padding-box;
|
|
2104
|
+
}
|
|
2105
|
+
@supports not (background-clip: padding-box) {
|
|
2106
|
+
border: 3px solid white;
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
::-webkit-scrollbar-track {
|
|
2110
|
+
background-color: #fff;
|
|
2111
|
+
border-radius: 0 6px 6px 0;
|
|
2112
|
+
border-left: 1px solid #f2f2f2;
|
|
2113
|
+
}
|
|
2114
|
+
.mention-search-item {
|
|
2115
|
+
cursor: pointer;
|
|
2116
|
+
padding: 12px 1rem;
|
|
2117
|
+
display: flex;
|
|
2118
|
+
align-items: center;
|
|
2119
|
+
&.item-selected {
|
|
2120
|
+
background-color: ${theme.colors.gray100};
|
|
2121
|
+
}
|
|
2122
|
+
.search-avatar {
|
|
2123
|
+
width: 40px;
|
|
2124
|
+
height: 40px;
|
|
2125
|
+
font-size: 20px;
|
|
2126
|
+
margin-right: 20px;
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
`;
|
|
2131
|
+
|
|
2132
|
+
let ReactQuill = null;
|
|
2133
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
2134
|
+
if (typeof window === 'undefined')
|
|
2135
|
+
return;
|
|
2136
|
+
const QuillRes = yield import('react-quill');
|
|
2137
|
+
ReactQuill = QuillRes.default;
|
|
2138
|
+
const Quill = QuillRes.Quill || ReactQuill.Quill;
|
|
2139
|
+
class PreserveWhiteSpace {
|
|
2140
|
+
constructor(quill, options) {
|
|
2141
|
+
this.quill = quill;
|
|
2142
|
+
this.options = options;
|
|
2143
|
+
quill.container.style.whiteSpace = 'pre-line';
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
Quill.register('modules/preserveWhiteSpace', PreserveWhiteSpace);
|
|
2147
|
+
const Inline = Quill.import('blots/inline');
|
|
2148
|
+
class MockABlot extends Inline {
|
|
2149
|
+
static create(options) {
|
|
2150
|
+
if (!options)
|
|
2151
|
+
return super.create(false);
|
|
2152
|
+
const node = super.create(options);
|
|
2153
|
+
MockABlot.setNodeConfigurations(node, options);
|
|
2154
|
+
return node;
|
|
2155
|
+
}
|
|
2156
|
+
static formats(node) {
|
|
2157
|
+
if (node.innerText &&
|
|
2158
|
+
(node.getAttribute('data-href') ||
|
|
2159
|
+
node.getAttribute('data-url') ||
|
|
2160
|
+
node.getAttribute('data-error') ||
|
|
2161
|
+
node.getAttribute('data-bad-word'))) {
|
|
2162
|
+
return {
|
|
2163
|
+
'data-bad-word': node.getAttribute('data-bad-word'),
|
|
2164
|
+
'data-error': node.getAttribute('data-error'),
|
|
2165
|
+
'data-href': node.getAttribute('data-href'),
|
|
2166
|
+
'data-url': node.getAttribute('data-url'),
|
|
2167
|
+
'data-text': node.innerText || node.getAttribute('data-href'),
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
else {
|
|
2171
|
+
return false;
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
/* To prevent the node from accidentally being built in different ways. */
|
|
2175
|
+
static setNodeConfigurations(node, value) {
|
|
2176
|
+
var _a, _b;
|
|
2177
|
+
if (!value)
|
|
2178
|
+
return;
|
|
2179
|
+
if (!((_b = (_a = value === null || value === void 0 ? void 0 : value['data-text']) === null || _a === void 0 ? void 0 : _a.replace(/(\ )+/g, ' ')) === null || _b === void 0 ? void 0 : _b.replace(/(\u200c|‌)+/g, '')))
|
|
2180
|
+
return;
|
|
2181
|
+
if (value['data-bad-word'])
|
|
2182
|
+
node.setAttribute('data-bad-word', value['data-bad-word']);
|
|
2183
|
+
if (value['data-href'])
|
|
2184
|
+
node.setAttribute('data-href', value['data-href']);
|
|
2185
|
+
if (value['data-error'])
|
|
2186
|
+
node.setAttribute('data-error', value['data-error']);
|
|
2187
|
+
// setTimeout(() => {
|
|
2188
|
+
// if (value['data-text'] !== node.innerText && !node.innerText)
|
|
2189
|
+
// node.innerHTML = value['data-text']
|
|
2190
|
+
// }, 200)
|
|
2191
|
+
if (value['data-url'])
|
|
2192
|
+
node.setAttribute('data-url', value['data-url']);
|
|
2193
|
+
// if (value['data-text']) node.innerText = value['data-text']
|
|
2194
|
+
// console.log(value, node.outerHTML, node)
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
MockABlot.blotName = 'mocka1';
|
|
2198
|
+
MockABlot.tagName = 'mocka';
|
|
2199
|
+
Quill.register(MockABlot);
|
|
2200
|
+
class MentionBlot extends Inline {
|
|
2201
|
+
static create(options) {
|
|
2202
|
+
if (!options)
|
|
2203
|
+
return super.create(false);
|
|
2204
|
+
const node = super.create(options);
|
|
2205
|
+
MentionBlot.setNodeConfigurations(node, options);
|
|
2206
|
+
return node;
|
|
2207
|
+
}
|
|
2208
|
+
static formats(node) {
|
|
2209
|
+
if (node.getAttribute('data-name') && node.getAttribute('data-id')) {
|
|
2210
|
+
return {
|
|
2211
|
+
'data-name': node.getAttribute('data-name'),
|
|
2212
|
+
'data-id': node.getAttribute('data-id'),
|
|
2213
|
+
};
|
|
2214
|
+
}
|
|
2215
|
+
else {
|
|
2216
|
+
return false;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
/* To prevent the node from accidentally being built in different ways. */
|
|
2220
|
+
static setNodeConfigurations(node, value) {
|
|
2221
|
+
var _a, _b;
|
|
2222
|
+
if (!value)
|
|
2223
|
+
return;
|
|
2224
|
+
if (!value['data-id'] ||
|
|
2225
|
+
!((_b = (_a = value === null || value === void 0 ? void 0 : value['data-name']) === null || _a === void 0 ? void 0 : _a.replace(/(\ )+/g, ' ')) === null || _b === void 0 ? void 0 : _b.replace(/(\u200c|‌)+/g, '')))
|
|
2226
|
+
return;
|
|
2227
|
+
if (value['data-id'])
|
|
2228
|
+
node.setAttribute('data-id', value['data-id']);
|
|
2229
|
+
if (value['data-name']) {
|
|
2230
|
+
// node.setAttribute('contenteditable', false)
|
|
2231
|
+
node.setAttribute('data-name', value['data-name']);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
MentionBlot.blotName = 'mention';
|
|
2236
|
+
MentionBlot.tagName = 'mention';
|
|
2237
|
+
Quill.register(MentionBlot);
|
|
2238
|
+
}))();
|
|
2239
|
+
function getCaretCharacterOffsetWithin(element) {
|
|
2240
|
+
var _a, _b;
|
|
2241
|
+
let caretOffset = -1;
|
|
2242
|
+
if (typeof window.getSelection != 'undefined') {
|
|
2243
|
+
const sel = window.getSelection();
|
|
2244
|
+
if ((sel === null || sel === void 0 ? void 0 : sel.rangeCount) && (sel === null || sel === void 0 ? void 0 : sel.rangeCount) > 0) {
|
|
2245
|
+
const range = (_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.getRangeAt(0);
|
|
2246
|
+
if (range) {
|
|
2247
|
+
const preCaretRange = range.cloneRange();
|
|
2248
|
+
// preCaretRange.setStart(element, 0)
|
|
2249
|
+
preCaretRange.selectNodeContents(element);
|
|
2250
|
+
preCaretRange.setEnd(range.endContainer, range.endOffset);
|
|
2251
|
+
caretOffset = calculateChildNodeOffset(preCaretRange.cloneContents().childNodes, caretOffset);
|
|
2252
|
+
const parentMockAElement = (_b = range.endContainer.parentElement) === null || _b === void 0 ? void 0 : _b.closest('mocka');
|
|
2253
|
+
const lastNodeValue = range.endContainer.nodeValue ||
|
|
2254
|
+
range.endContainer.outerHTML;
|
|
2255
|
+
if (parentMockAElement && (lastNodeValue === null || lastNodeValue === void 0 ? void 0 : lastNodeValue.length)) {
|
|
2256
|
+
/// set selector to end of <mocka elemt, prevent select in the middle
|
|
2257
|
+
caretOffset =
|
|
2258
|
+
caretOffset -
|
|
2259
|
+
range.endOffset +
|
|
2260
|
+
(parentMockAElement.outerHTML.length -
|
|
2261
|
+
(parentMockAElement === null || parentMockAElement === void 0 ? void 0 : parentMockAElement.outerHTML.lastIndexOf(lastNodeValue)));
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
return caretOffset;
|
|
2267
|
+
}
|
|
2268
|
+
function calculateChildNodeOffset(childNodes, caretOffset) {
|
|
2269
|
+
childNodes.forEach((node, index) => {
|
|
2270
|
+
const isLast = index + 1 === childNodes.length;
|
|
2271
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
2272
|
+
const outerHTML = node.outerHTML;
|
|
2273
|
+
if (!isLast) {
|
|
2274
|
+
caretOffset += outerHTML.length;
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
else {
|
|
2278
|
+
caretOffset += outerHTML.indexOf('>') + 1;
|
|
2279
|
+
caretOffset = calculateChildNodeOffset(node.childNodes, caretOffset);
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
else if (node.nodeType === Node.TEXT_NODE) {
|
|
2283
|
+
caretOffset += (node.nodeValue || '')
|
|
2284
|
+
.replace(/&/g, '&')
|
|
2285
|
+
.replace(/</g, '<')
|
|
2286
|
+
.replace(/>/g, '>')
|
|
2287
|
+
.replace(/"/g, '"')
|
|
2288
|
+
.replace(/'/g, ''').length;
|
|
2289
|
+
}
|
|
2290
|
+
});
|
|
2291
|
+
return caretOffset;
|
|
2292
|
+
}
|
|
2293
|
+
function getSearchName(root) {
|
|
2294
|
+
var _a, _b;
|
|
2295
|
+
let res = null;
|
|
2296
|
+
if (typeof window.getSelection != 'undefined') {
|
|
2297
|
+
const sel = window.getSelection();
|
|
2298
|
+
if ((sel === null || sel === void 0 ? void 0 : sel.rangeCount) && (sel === null || sel === void 0 ? void 0 : sel.rangeCount) > 0) {
|
|
2299
|
+
const range = (_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.getRangeAt(0);
|
|
2300
|
+
if (range) {
|
|
2301
|
+
const preCaretRange = range.cloneRange();
|
|
2302
|
+
// preCaretRange.setStart(element, 0)
|
|
2303
|
+
preCaretRange.selectNodeContents(root);
|
|
2304
|
+
preCaretRange.setEnd(range.endContainer, range.endOffset);
|
|
2305
|
+
const endText = (preCaretRange.endContainer.nodeValue || '').substring(0, range.endOffset);
|
|
2306
|
+
// only allow @ at start of text or has space before it
|
|
2307
|
+
const lastAnchorSymbolIndex = endText.lastIndexOf('@');
|
|
2308
|
+
if (lastAnchorSymbolIndex + 1 < endText.length &&
|
|
2309
|
+
(lastAnchorSymbolIndex === 0 ||
|
|
2310
|
+
endText.slice(lastAnchorSymbolIndex - 1, lastAnchorSymbolIndex + 1) === ' @')) {
|
|
2311
|
+
const name = (_b = endText.slice(lastAnchorSymbolIndex + 1)) === null || _b === void 0 ? void 0 : _b.trim();
|
|
2312
|
+
if (name) {
|
|
2313
|
+
preCaretRange.setStart(range.endContainer, lastAnchorSymbolIndex);
|
|
2314
|
+
const replaceRange = preCaretRange.cloneRange();
|
|
2315
|
+
replaceRange.setStart(replaceRange.endContainer, lastAnchorSymbolIndex);
|
|
2316
|
+
res = {
|
|
2317
|
+
name,
|
|
2318
|
+
rect: preCaretRange.getBoundingClientRect(),
|
|
2319
|
+
replaceRange,
|
|
2320
|
+
};
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
return res;
|
|
2327
|
+
}
|
|
2328
|
+
const inputModify$1 = (value, opts) => {
|
|
2329
|
+
var _a;
|
|
2330
|
+
const { formatUrl, bannedWords = [] } = opts || {};
|
|
2331
|
+
const removedFormat = fixMalformedMention(removeFontFormat(value));
|
|
2332
|
+
if (!formatUrl)
|
|
2333
|
+
return {
|
|
2334
|
+
value: highlightBadWords(removedFormat, bannedWords),
|
|
2335
|
+
};
|
|
2336
|
+
let descriptionWithWrappedAnchor = removeEdittedBannedWord(wrapAnchorAroundUrls(removedFormat));
|
|
2337
|
+
const urls = getUrlsFromEditorString(removedFormat);
|
|
2338
|
+
if (urls) {
|
|
2339
|
+
const invalidUrls = [];
|
|
2340
|
+
let previewUrl = '';
|
|
2341
|
+
urls.forEach((url) => {
|
|
2342
|
+
if (!url)
|
|
2343
|
+
return;
|
|
2344
|
+
try {
|
|
2345
|
+
const jsUrl = new URL(url);
|
|
2346
|
+
if (ALLOW_DOMAIN_URL.some((o) => jsUrl.origin.endsWith(o))) {
|
|
2347
|
+
// is valid
|
|
2348
|
+
}
|
|
2349
|
+
else {
|
|
2350
|
+
invalidUrls.push(url);
|
|
2351
|
+
// is not valid
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
catch (_a) {
|
|
2355
|
+
invalidUrls.push(url);
|
|
2356
|
+
}
|
|
2357
|
+
});
|
|
2358
|
+
if (invalidUrls.length > 0) {
|
|
2359
|
+
descriptionWithWrappedAnchor = descriptionWithWrappedAnchor
|
|
2360
|
+
.replace(new RegExp(`data-url="true">(${invalidUrls.map(escapeRegExp).join('|')})<`, 'gi'), 'data-error="true" data-url="true">$1<')
|
|
2361
|
+
.replace(new RegExp(`data-href="(${invalidUrls
|
|
2362
|
+
.map(escapeRegExp)
|
|
2363
|
+
.join('|')})" data-url="true">`, 'gi'), 'data-href="$1" data-error="true" data-url="true">');
|
|
2364
|
+
}
|
|
2365
|
+
previewUrl = (_a = urls.filter((u) => invalidUrls.indexOf(u) === -1)) === null || _a === void 0 ? void 0 : _a[0];
|
|
2366
|
+
return {
|
|
2367
|
+
invalidUrls,
|
|
2368
|
+
previewUrl,
|
|
2369
|
+
value: highlightBadWords(descriptionWithWrappedAnchor, bannedWords),
|
|
2370
|
+
};
|
|
2371
|
+
}
|
|
2372
|
+
return {
|
|
2373
|
+
value: highlightBadWords(descriptionWithWrappedAnchor, bannedWords),
|
|
2374
|
+
};
|
|
2375
|
+
};
|
|
2376
|
+
const RichTextEditor = ({ html, onChange, className, style, placeholder, onImagePickerClick, bannedWords = [], onInvalidUrlsChange, onPreviewUrlChange, setEditorRef, isReplying, }) => {
|
|
2377
|
+
var _a, _b, _c, _d;
|
|
2378
|
+
const bannedWordsRef = useRef([]);
|
|
2379
|
+
bannedWordsRef.current = bannedWords;
|
|
2380
|
+
const [invalidUrls, setInvalidUrls] = useState([]);
|
|
2381
|
+
const [previewUrl, setPreviewUrl] = useState(null);
|
|
2382
|
+
const { data: { locale }, } = useContext(TogetherComponentGlobalContext);
|
|
2383
|
+
const bannedString = (bannedWords === null || bannedWords === void 0 ? void 0 : bannedWords.join(',')) || '';
|
|
2384
|
+
useEffect(() => {
|
|
2385
|
+
var _a, _b;
|
|
2386
|
+
const currHTML = (_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root.innerHTML;
|
|
2387
|
+
debounceInputModify(currHTML);
|
|
2388
|
+
}, [bannedString]);
|
|
2389
|
+
const fetchPreviewData = (url) => {
|
|
2390
|
+
if (!previewUrl || previewUrl.url !== url) {
|
|
2391
|
+
setPreviewUrl({
|
|
2392
|
+
url,
|
|
2393
|
+
isFetching: true,
|
|
2394
|
+
});
|
|
2395
|
+
callApi(getApiPath(PATHS.FETCH_PREVIEW, {
|
|
2396
|
+
_locale: locale,
|
|
2397
|
+
}), 'POST', {
|
|
2398
|
+
data: {
|
|
2399
|
+
link: url,
|
|
2400
|
+
},
|
|
2401
|
+
})
|
|
2402
|
+
.then((res) => {
|
|
2403
|
+
var _a, _b, _c, _d;
|
|
2404
|
+
setPreviewUrl({
|
|
2405
|
+
title: (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.title,
|
|
2406
|
+
description: (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.description,
|
|
2407
|
+
image: ((_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.image) || ((_d = res === null || res === void 0 ? void 0 : res.data) === null || _d === void 0 ? void 0 : _d.logo),
|
|
2408
|
+
url,
|
|
2409
|
+
});
|
|
2410
|
+
})
|
|
2411
|
+
.catch(() => {
|
|
2412
|
+
setPreviewUrl(null);
|
|
2413
|
+
});
|
|
2414
|
+
}
|
|
2415
|
+
};
|
|
2416
|
+
const fetchPreviewDataRef = useRef(fetchPreviewData);
|
|
2417
|
+
fetchPreviewDataRef.current = fetchPreviewData;
|
|
2418
|
+
const debounceInputModify = useCallback(debounce((v) => {
|
|
2419
|
+
if (v) {
|
|
2420
|
+
const processedInput = inputModify$1(v, {
|
|
2421
|
+
bannedWords: bannedWordsRef.current,
|
|
2422
|
+
formatUrl: true,
|
|
2423
|
+
});
|
|
2424
|
+
const { invalidUrls: _invalidUrls, previewUrl: _previewUrl, value, } = processedInput;
|
|
2425
|
+
if (_invalidUrls) {
|
|
2426
|
+
setInvalidUrls(_invalidUrls);
|
|
2427
|
+
}
|
|
2428
|
+
if (_previewUrl) {
|
|
2429
|
+
fetchPreviewDataRef.current(_previewUrl);
|
|
2430
|
+
}
|
|
2431
|
+
else
|
|
2432
|
+
setPreviewUrl(null);
|
|
2433
|
+
if (value !== v) {
|
|
2434
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
}, 500), []);
|
|
2438
|
+
useEffect(() => {
|
|
2439
|
+
onInvalidUrlsChange && onInvalidUrlsChange(invalidUrls);
|
|
2440
|
+
}, [invalidUrls]);
|
|
2441
|
+
useEffect(() => {
|
|
2442
|
+
if (onPreviewUrlChange) {
|
|
2443
|
+
if (previewUrl === null || previewUrl === void 0 ? void 0 : previewUrl.url)
|
|
2444
|
+
onPreviewUrlChange({
|
|
2445
|
+
title: previewUrl.title || '',
|
|
2446
|
+
url: previewUrl.url || '',
|
|
2447
|
+
image: previewUrl.image || '',
|
|
2448
|
+
description: previewUrl.description || '',
|
|
2449
|
+
});
|
|
2450
|
+
else
|
|
2451
|
+
onPreviewUrlChange(null);
|
|
2452
|
+
}
|
|
2453
|
+
}, [previewUrl]);
|
|
2454
|
+
const imageHandlerRef = useRef(onImagePickerClick);
|
|
2455
|
+
imageHandlerRef.current = onImagePickerClick;
|
|
2456
|
+
const toolbarId = useUniqueId();
|
|
2457
|
+
const cachedModules = useRef({
|
|
2458
|
+
toolbar: {
|
|
2459
|
+
handlers: {
|
|
2460
|
+
image: () => { var _a; return (_a = imageHandlerRef.current) === null || _a === void 0 ? void 0 : _a.call(imageHandlerRef); },
|
|
2461
|
+
link: () => false,
|
|
2462
|
+
},
|
|
2463
|
+
container: '#toolbar-' + toolbarId,
|
|
2464
|
+
},
|
|
2465
|
+
// toolbar: [
|
|
2466
|
+
// ['bold', 'italic', 'underline'],
|
|
2467
|
+
// [{ list: 'ordered' }, { list: 'bullet' }],
|
|
2468
|
+
// ],
|
|
2469
|
+
preserveWhiteSpace: true,
|
|
2470
|
+
});
|
|
2471
|
+
const contentEditableCaretPos = useRef(-1);
|
|
2472
|
+
const reactQuillRef = useRef(null);
|
|
2473
|
+
setEditorRef &&
|
|
2474
|
+
((_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root) &&
|
|
2475
|
+
setEditorRef((_d = (_c = reactQuillRef.current) === null || _c === void 0 ? void 0 : _c.getEditor()) === null || _d === void 0 ? void 0 : _d.root);
|
|
2476
|
+
const handleSelectionChange = () => {
|
|
2477
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2478
|
+
if ((_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root) {
|
|
2479
|
+
const newCaretPos = getCaretCharacterOffsetWithin((_d = (_c = reactQuillRef.current) === null || _c === void 0 ? void 0 : _c.getEditor()) === null || _d === void 0 ? void 0 : _d.root);
|
|
2480
|
+
const currHTML = (_f = (_e = reactQuillRef.current) === null || _e === void 0 ? void 0 : _e.getEditor()) === null || _f === void 0 ? void 0 : _f.root.innerHTML;
|
|
2481
|
+
// in case of clicking on a div outside editor while focus, we get caret position too large
|
|
2482
|
+
if (newCaretPos >= 0 && newCaretPos < currHTML.length) {
|
|
2483
|
+
const mentionIds = getMentionIdsFromString(currHTML, true);
|
|
2484
|
+
if (mentionIds.length < LIMIT_MENTION - (isReplying ? 1 : 0)) {
|
|
2485
|
+
const searchData = getSearchName((_h = (_g = reactQuillRef.current) === null || _g === void 0 ? void 0 : _g.getEditor()) === null || _h === void 0 ? void 0 : _h.root);
|
|
2486
|
+
if (searchData) {
|
|
2487
|
+
searchUser(searchData.name, searchData.rect);
|
|
2488
|
+
replaceRangeRef.current = searchData.replaceRange;
|
|
2489
|
+
}
|
|
2490
|
+
else {
|
|
2491
|
+
replaceRangeRef.current = null;
|
|
2492
|
+
// to avoid race condition, we reuse this function to clear foundUsers
|
|
2493
|
+
searchUser('', null);
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
else {
|
|
2497
|
+
replaceRangeRef.current = null;
|
|
2498
|
+
// to avoid race condition, we reuse this function to clear foundUsers
|
|
2499
|
+
searchUser('', null);
|
|
2500
|
+
}
|
|
2501
|
+
// const insertIndex = newCaretPos + 1
|
|
2502
|
+
// const currHTML = reactQuillRef.current?.getEditor()?.root.innerHTML
|
|
2503
|
+
// console.log(
|
|
2504
|
+
// currHTML?.substring(0, insertIndex) || '',
|
|
2505
|
+
// '========',
|
|
2506
|
+
// currHTML?.substring(insertIndex) || '',
|
|
2507
|
+
// )
|
|
2508
|
+
contentEditableCaretPos.current = newCaretPos;
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
else {
|
|
2512
|
+
setFoundUsers([]);
|
|
2513
|
+
}
|
|
2514
|
+
};
|
|
2515
|
+
const [foundUsers, setFoundUsers] = useState([]);
|
|
2516
|
+
const [searchUserPosition, setSearchUserPosition] = useState({
|
|
2517
|
+
top: 0,
|
|
2518
|
+
left: 0,
|
|
2519
|
+
});
|
|
2520
|
+
const searchUser = useCallback(debounce((name, rect, excludeIds) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2521
|
+
var _e, _f, _g, _h;
|
|
2522
|
+
if (!name || !DOMRect) {
|
|
2523
|
+
return setFoundUsers([]);
|
|
2524
|
+
}
|
|
2525
|
+
const res = yield ((((_e = getCookie(BEARER_TOKEN_COOKIE)) === null || _e === void 0 ? void 0 : _e.length) || 0) > 0
|
|
2526
|
+
? callApiWithAuth(getApiPath(PATHS.SEARCH_USER, {
|
|
2527
|
+
_locale: locale,
|
|
2528
|
+
name: name,
|
|
2529
|
+
}), 'get')
|
|
2530
|
+
: callApiWithAdminAuth(getApiPath(ADMIN_PATHS.SEARCH_USER, {
|
|
2531
|
+
_locale: locale,
|
|
2532
|
+
name: name,
|
|
2533
|
+
}), 'get'));
|
|
2534
|
+
setSelectTagUserIndex(0);
|
|
2535
|
+
setFoundUsers((_g = (_f = res === null || res === void 0 ? void 0 : res.data) === null || _f === void 0 ? void 0 : _f.users) === null || _g === void 0 ? void 0 : _g.filter((u) => !(excludeIds === null || excludeIds === void 0 ? void 0 : excludeIds.includes(String(u.id)))));
|
|
2536
|
+
const textNodeRect = rect;
|
|
2537
|
+
const containerRect = (_h = containerRef.current) === null || _h === void 0 ? void 0 : _h.getBoundingClientRect();
|
|
2538
|
+
if (textNodeRect && containerRect) {
|
|
2539
|
+
const idealWidth = 343;
|
|
2540
|
+
const idealHeight = 256;
|
|
2541
|
+
const styleConfig = {
|
|
2542
|
+
top: textNodeRect.bottom - containerRect.top,
|
|
2543
|
+
width: `min(343px, 100%)`,
|
|
2544
|
+
maxHeight: idealHeight,
|
|
2545
|
+
};
|
|
2546
|
+
const tempRightWidth = containerRect.width - (textNodeRect.left - containerRect.left);
|
|
2547
|
+
if (tempRightWidth < idealWidth) {
|
|
2548
|
+
styleConfig.right = 0;
|
|
2549
|
+
}
|
|
2550
|
+
else {
|
|
2551
|
+
styleConfig.left = textNodeRect.left - containerRect.left;
|
|
2552
|
+
}
|
|
2553
|
+
setSearchUserPosition(styleConfig);
|
|
2554
|
+
}
|
|
2555
|
+
}), 500), []);
|
|
2556
|
+
const setSelectUser = (id, name) => {
|
|
2557
|
+
var _a, _b, _c;
|
|
2558
|
+
if (replaceRangeRef.current) {
|
|
2559
|
+
replaceRangeRef.current.deleteContents();
|
|
2560
|
+
const newMention = document.createElement('mention');
|
|
2561
|
+
newMention.setAttribute('data-id', id);
|
|
2562
|
+
newMention.setAttribute('data-name', name);
|
|
2563
|
+
// newMention.setAttribute('contenteditable', 'false')
|
|
2564
|
+
newMention.innerText = name;
|
|
2565
|
+
const newPostText = document.createTextNode(' ');
|
|
2566
|
+
replaceRangeRef.current.insertNode(newPostText);
|
|
2567
|
+
replaceRangeRef.current.insertNode(newMention);
|
|
2568
|
+
const editorRoot = (_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root;
|
|
2569
|
+
editorRoot.focus();
|
|
2570
|
+
const range = (_c = window.getSelection()) === null || _c === void 0 ? void 0 : _c.getRangeAt(0);
|
|
2571
|
+
range === null || range === void 0 ? void 0 : range.setStart(replaceRangeRef.current.endContainer, replaceRangeRef.current.endOffset);
|
|
2572
|
+
range === null || range === void 0 ? void 0 : range.setEnd(replaceRangeRef.current.endContainer, replaceRangeRef.current.endOffset);
|
|
2573
|
+
}
|
|
2574
|
+
setFoundUsers([]);
|
|
2575
|
+
};
|
|
2576
|
+
const containerRef = useRef(null);
|
|
2577
|
+
const replaceRangeRef = useRef(null);
|
|
2578
|
+
const foundUsersListRef = useRef(null);
|
|
2579
|
+
const [selectTagUserIndex, setSelectTagUserIndex] = useState(0);
|
|
2580
|
+
useEffect(() => {
|
|
2581
|
+
// convenient behavior, scroll item into view when select using keyboard
|
|
2582
|
+
if (foundUsersListRef.current) {
|
|
2583
|
+
const parentElement = foundUsersListRef.current;
|
|
2584
|
+
const childElement = parentElement.children.item(selectTagUserIndex);
|
|
2585
|
+
if (childElement) {
|
|
2586
|
+
const containerRect = parentElement.getBoundingClientRect();
|
|
2587
|
+
const childRect = childElement.getBoundingClientRect();
|
|
2588
|
+
if (childElement.offsetTop < parentElement.scrollTop)
|
|
2589
|
+
parentElement.scrollTop = childElement.offsetTop;
|
|
2590
|
+
else if (childElement.offsetTop + childRect.height >
|
|
2591
|
+
parentElement.scrollTop + containerRect.height) {
|
|
2592
|
+
parentElement.scrollTop =
|
|
2593
|
+
childElement.offsetTop - containerRect.height + childRect.height;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
}, [selectTagUserIndex]);
|
|
2598
|
+
useEffect(() => {
|
|
2599
|
+
const clickHandler = function (e) {
|
|
2600
|
+
var _a;
|
|
2601
|
+
if (!((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
2602
|
+
// Clicked outside the box
|
|
2603
|
+
setFoundUsers([]);
|
|
2604
|
+
}
|
|
2605
|
+
};
|
|
2606
|
+
window.addEventListener('click', clickHandler, {
|
|
2607
|
+
passive: true,
|
|
2608
|
+
});
|
|
2609
|
+
return () => {
|
|
2610
|
+
window.removeEventListener('click', clickHandler);
|
|
2611
|
+
};
|
|
2612
|
+
}, []);
|
|
2613
|
+
useEffect(() => {
|
|
2614
|
+
var _a, _b;
|
|
2615
|
+
if (placeholder && reactQuillRef) {
|
|
2616
|
+
const elmInput = (_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root;
|
|
2617
|
+
if (elmInput) {
|
|
2618
|
+
elmInput.setAttribute('data-placeholder', placeholder);
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
}, [placeholder]);
|
|
2622
|
+
return (React__default.createElement(StyledEditorContainer, { ref: containerRef, className: className, style: style, onKeyDownCapture: (e) => {
|
|
2623
|
+
// convenient behavior, use arrow to select tag user and enter to choose
|
|
2624
|
+
if (foundUsers === null || foundUsers === void 0 ? void 0 : foundUsers.length) {
|
|
2625
|
+
let preventKey = false;
|
|
2626
|
+
if (e.key === 'ArrowDown') {
|
|
2627
|
+
preventKey = true;
|
|
2628
|
+
setSelectTagUserIndex((s) => s + 1 >= foundUsers.length ? 0 : s + 1);
|
|
2629
|
+
}
|
|
2630
|
+
else if (e.key === 'Escape') {
|
|
2631
|
+
preventKey = true;
|
|
2632
|
+
setSelectTagUserIndex(0);
|
|
2633
|
+
setFoundUsers([]);
|
|
2634
|
+
}
|
|
2635
|
+
else if (e.key === 'ArrowUp') {
|
|
2636
|
+
preventKey = true;
|
|
2637
|
+
setSelectTagUserIndex((s) => s - 1 < 0 ? foundUsers.length - 1 : s - 1);
|
|
2638
|
+
}
|
|
2639
|
+
else if (e.key === 'Enter' || e.key === 'Tab') {
|
|
2640
|
+
const user = foundUsers[selectTagUserIndex];
|
|
2641
|
+
if (user) {
|
|
2642
|
+
preventKey = true;
|
|
2643
|
+
setSelectUser(user.id, user.name);
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
if (preventKey) {
|
|
2647
|
+
e.preventDefault();
|
|
2648
|
+
return false;
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
} },
|
|
2652
|
+
React__default.createElement(CustomToolbar, { id: toolbarId, onAddLink: (text, href) => {
|
|
2653
|
+
var _a, _b;
|
|
2654
|
+
const insertIndex = contentEditableCaretPos.current + 1;
|
|
2655
|
+
const currHTML = (_b = (_a = reactQuillRef.current) === null || _a === void 0 ? void 0 : _a.getEditor()) === null || _b === void 0 ? void 0 : _b.root.innerHTML;
|
|
2656
|
+
const newHTML = ((currHTML === null || currHTML === void 0 ? void 0 : currHTML.substring(0, insertIndex)) || '') +
|
|
2657
|
+
`<mocka data-href="${href}" data-url="true">${text}</mocka> ` +
|
|
2658
|
+
((currHTML === null || currHTML === void 0 ? void 0 : currHTML.substring(insertIndex)) || '');
|
|
2659
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newHTML);
|
|
2660
|
+
debounceInputModify(newHTML);
|
|
2661
|
+
} }),
|
|
2662
|
+
ReactQuill && (React__default.createElement(ReactQuill, { ref: reactQuillRef, theme: "snow", value: html, placeholder: placeholder, onChange: (t) => {
|
|
2663
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(t);
|
|
2664
|
+
debounceInputModify(t);
|
|
2665
|
+
handleSelectionChange();
|
|
2666
|
+
}, onChangeSelection: () => {
|
|
2667
|
+
handleSelectionChange();
|
|
2668
|
+
}, modules: cachedModules.current, formats: [
|
|
2669
|
+
'mocka1',
|
|
2670
|
+
'mention',
|
|
2671
|
+
'id',
|
|
2672
|
+
'key',
|
|
2673
|
+
'bold',
|
|
2674
|
+
'italic',
|
|
2675
|
+
'underline',
|
|
2676
|
+
'list',
|
|
2677
|
+
'bullet',
|
|
2678
|
+
] })),
|
|
2679
|
+
!!(foundUsers === null || foundUsers === void 0 ? void 0 : foundUsers.length) && (React__default.createElement("div", { ref: foundUsersListRef, className: "mention-search-container", style: searchUserPosition }, foundUsers.map((foundUser, index) => (React__default.createElement("div", { className: `mention-search-item ${selectTagUserIndex === index ? 'item-selected' : ''}`, key: foundUser.id, onClick: (e) => {
|
|
2680
|
+
e.preventDefault();
|
|
2681
|
+
e.stopPropagation();
|
|
2682
|
+
setSelectUser(foundUser.id, foundUser.name);
|
|
2683
|
+
}, onMouseEnter: () => {
|
|
2684
|
+
setSelectTagUserIndex(index);
|
|
2685
|
+
} },
|
|
2686
|
+
React__default.createElement(UserAvatar, { className: "search-avatar", username: foundUser.name, avatar: foundUser.avatar }),
|
|
2687
|
+
React__default.createElement("div", null,
|
|
2688
|
+
React__default.createElement(Text, { size: "p2" }, foundUser.name),
|
|
2689
|
+
React__default.createElement(Text, { size: "p4", color: "#595959" },
|
|
2690
|
+
"@",
|
|
2691
|
+
foundUser.username)))))))));
|
|
2692
|
+
};
|
|
2693
|
+
const CustomToolbar = ({ onAddLink, id, }) => {
|
|
2694
|
+
return (React__default.createElement("div", { id: 'toolbar-' + id, onClick: (e) => {
|
|
2695
|
+
e.preventDefault();
|
|
2696
|
+
e.stopPropagation();
|
|
2697
|
+
} },
|
|
2698
|
+
React__default.createElement("span", { className: "ql-formats" },
|
|
2699
|
+
React__default.createElement("button", { className: "ql-bold", type: "button" }),
|
|
2700
|
+
React__default.createElement("button", { className: "ql-italic", type: "button" }),
|
|
2701
|
+
React__default.createElement("button", { className: "ql-underline", type: "button" })),
|
|
2702
|
+
React__default.createElement("span", { className: "ql-formats" },
|
|
2703
|
+
React__default.createElement("button", { className: "ql-list", value: "ordered", type: "button" }),
|
|
2704
|
+
React__default.createElement("button", { className: "ql-list", value: "bullet", type: "button" })),
|
|
2705
|
+
React__default.createElement("span", { className: "ql-formats" }, onAddLink && (React__default.createElement(PopoverMenu, { className: "link-tool-wrapper", toggleButtonContent: React__default.createElement("img", { className: "link-icon", src: IconLink, loading: "lazy" }), buttonProps: {
|
|
2706
|
+
size: 'md',
|
|
2707
|
+
color: 'transparent',
|
|
2708
|
+
}, align: "end" }, ({ setShow }) => (React__default.createElement(LinkToolInputPopover, { onAddUrl: onAddLink, setShow: setShow })))))));
|
|
2709
|
+
};
|
|
2710
|
+
const URL_WARN_MAP = [
|
|
2711
|
+
'notification.limitUrlDomain',
|
|
2712
|
+
'notification.urlWrongFormat',
|
|
2713
|
+
];
|
|
2714
|
+
const LinkToolInputPopover = ({ onAddUrl, setShow }) => {
|
|
2715
|
+
const { data: { env: { isMarryBaby }, }, } = useContext(TogetherComponentGlobalContext);
|
|
2716
|
+
const { t } = useTranslations();
|
|
2717
|
+
const [urlValue, setUrlValue] = useState('');
|
|
2718
|
+
const [textValue, setTextValue] = useState('');
|
|
2719
|
+
const [urlWarnType, setUrlWarnType] = useState(-1);
|
|
2720
|
+
const checkUrlValid = (v) => {
|
|
2721
|
+
const trimmedUrl = reformatUrl(v.trim());
|
|
2722
|
+
try {
|
|
2723
|
+
const jsUrl = new URL(trimmedUrl);
|
|
2724
|
+
if (!jsUrl.protocol.startsWith('http')) {
|
|
2725
|
+
setUrlWarnType(1);
|
|
2726
|
+
return false;
|
|
2727
|
+
}
|
|
2728
|
+
if (!ALLOW_DOMAIN_URL.some((o) => jsUrl.origin.endsWith('/' + o) || jsUrl.origin.endsWith('.' + o))) {
|
|
2729
|
+
setUrlWarnType(0);
|
|
2730
|
+
return false;
|
|
2731
|
+
}
|
|
2732
|
+
setUrlWarnType(-1);
|
|
2733
|
+
return true;
|
|
2734
|
+
}
|
|
2735
|
+
catch (_a) {
|
|
2736
|
+
setUrlWarnType(1);
|
|
2737
|
+
return false;
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
const isValid = urlValue.trim() && textValue.trim() && urlWarnType < 0;
|
|
2741
|
+
return (React__default.createElement("div", { className: "link-tool-popover" },
|
|
2742
|
+
React__default.createElement(Input, { name: "url", value: urlValue, size: "md", label: "URL", placeholder: t('placeholder.enterUrlHere'), type: "text", className: "link-input-url", onChange: (v) => {
|
|
2743
|
+
setUrlValue(v);
|
|
2744
|
+
checkUrlValid(v);
|
|
2745
|
+
} }),
|
|
2746
|
+
urlWarnType >= 0 && (React__default.createElement(Text, { size: "c2", className: "error-text" }, t(URL_WARN_MAP[urlWarnType]))),
|
|
2747
|
+
React__default.createElement(Input, { name: "text", value: textValue, size: "md", label: t('createPost.urlText'), placeholder: t('placeholder.enterUrlTextHere'), type: "text", className: "link-input-text", onChange: (v) => setTextValue(v) }),
|
|
2748
|
+
React__default.createElement("div", { "data-is-marrybaby": isMarryBaby, className: "link-input-button-wrapper" },
|
|
2749
|
+
React__default.createElement(Button$1, { theme: isMarryBaby ? 'marryBaby' : 'helloSites', size: "sm", color: "primary", className: "link-input-button", onClick: () => {
|
|
2750
|
+
if (!isValid)
|
|
2751
|
+
return;
|
|
2752
|
+
onAddUrl(textValue.trim(), reformatUrl(urlValue.trim()));
|
|
2753
|
+
setShow && setShow(false);
|
|
2754
|
+
}, isDisabled: !isValid }, t('insert')))));
|
|
2755
|
+
};
|
|
2756
|
+
|
|
2757
|
+
const StyledCreatePostTitle = styled.div `
|
|
2758
|
+
input:focus,
|
|
2759
|
+
textarea:focus,
|
|
2760
|
+
[contenteditable='true'] {
|
|
2761
|
+
outline: none;
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
input {
|
|
2765
|
+
&::placeholder {
|
|
2766
|
+
font-size: 16px;
|
|
2767
|
+
color: ${theme.colors.gray400};
|
|
2768
|
+
font-weight: 400;
|
|
2769
|
+
line-height: 24px;
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
.title-input {
|
|
2774
|
+
overflow: hidden;
|
|
2775
|
+
width: 100%;
|
|
2776
|
+
padding: 12px 16px;
|
|
2777
|
+
border: solid 1px #d9d9d9;
|
|
2778
|
+
border-radius: ${theme.borderRadius};
|
|
2779
|
+
font-size: 16px;
|
|
2780
|
+
line-height: 1.2;
|
|
2781
|
+
white-space: nowrap;
|
|
2782
|
+
:focus {
|
|
2783
|
+
border-color: ${(props) => props.color};
|
|
2784
|
+
box-shadow: 0px 0px 2px 2px ${(props) => props.colorShadow};
|
|
2785
|
+
}
|
|
2786
|
+
br {
|
|
2787
|
+
display: none;
|
|
2788
|
+
}
|
|
2789
|
+
* {
|
|
2790
|
+
display: inline;
|
|
2791
|
+
white-space: nowrap;
|
|
2792
|
+
}
|
|
2793
|
+
mocka {
|
|
2794
|
+
padding: 2px 6px;
|
|
2795
|
+
border-radius: 1rem;
|
|
2796
|
+
&[data-error='true'] {
|
|
2797
|
+
background-color: #ffeeee;
|
|
2798
|
+
color: red;
|
|
2799
|
+
text-decoration: underline;
|
|
2800
|
+
font-style: bold;
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
ol,
|
|
2804
|
+
ul {
|
|
2805
|
+
padding-left: 1rem;
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
label {
|
|
2810
|
+
display: block;
|
|
2811
|
+
margin-bottom: 5px;
|
|
2812
|
+
color: ${theme.colors.gray600};
|
|
2813
|
+
font-size: 13px;
|
|
2814
|
+
font-weight: bold;
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
.count-string {
|
|
2818
|
+
color: ${theme.colors.gray400};
|
|
2819
|
+
font-size: 14px;
|
|
2820
|
+
text-align: right;
|
|
2821
|
+
font-weight: 400;
|
|
2822
|
+
line-height: 22px;
|
|
2823
|
+
letter-spacing: -0.2px;
|
|
2824
|
+
text-transform: lowercase;
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
.has-input-error {
|
|
2828
|
+
input {
|
|
2829
|
+
border: 1px solid ${theme.colors.red600};
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
`;
|
|
2833
|
+
const StyleWrapperTitle = styled.div `
|
|
2834
|
+
display: flex;
|
|
2835
|
+
justify-content: space-between;
|
|
2836
|
+
align-items: center;
|
|
2837
|
+
margin-bottom: 2px;
|
|
2838
|
+
|
|
2839
|
+
.field-label {
|
|
2840
|
+
color: ${theme.colors.gray600};
|
|
2841
|
+
font-size: 14px;
|
|
2842
|
+
font-weight: 600;
|
|
2843
|
+
line-height: 22px;
|
|
2844
|
+
}
|
|
2845
|
+
`;
|
|
2846
|
+
|
|
2847
|
+
var ErrorFieldKey;
|
|
2848
|
+
(function (ErrorFieldKey) {
|
|
2849
|
+
ErrorFieldKey["title"] = "create-post-title-field";
|
|
2850
|
+
ErrorFieldKey["description"] = "create-post-description-field";
|
|
2851
|
+
ErrorFieldKey["photos"] = "create-post-photos-field";
|
|
2852
|
+
})(ErrorFieldKey || (ErrorFieldKey = {}));
|
|
2853
|
+
const orderErrorFieldKey = ['title', 'description', 'photos'];
|
|
2854
|
+
|
|
2855
|
+
const CreatePostDescription = ({ className, style, bannedWords = [], value, placeholder = '', onChange, onPreviewUrlChange, onInvalidUrlsChange, isReplying, footerEditor, }) => {
|
|
2856
|
+
const { t } = useTranslations();
|
|
2857
|
+
const [previewUrl, setPreviewUrl] = useState(null);
|
|
2858
|
+
const imagePicker = useRef(null);
|
|
2859
|
+
useEffect(() => {
|
|
2860
|
+
if (onPreviewUrlChange) {
|
|
2861
|
+
if (previewUrl === null || previewUrl === void 0 ? void 0 : previewUrl.url)
|
|
2862
|
+
onPreviewUrlChange({
|
|
2863
|
+
title: previewUrl.title || '',
|
|
2864
|
+
url: previewUrl.url || '',
|
|
2865
|
+
image: previewUrl.image || '',
|
|
2866
|
+
description: previewUrl.description || '',
|
|
2867
|
+
});
|
|
2868
|
+
else
|
|
2869
|
+
onPreviewUrlChange(null);
|
|
2870
|
+
}
|
|
2871
|
+
}, [previewUrl]);
|
|
2872
|
+
return (React__default.createElement("div", null,
|
|
2873
|
+
React__default.createElement(StyleWrapperTitle, null,
|
|
2874
|
+
React__default.createElement(Text, { size: "p4", className: "field-label" }, t('createPost.popup.description'))),
|
|
2875
|
+
React__default.createElement(StyledCreatePostDescription, { className: className, style: style },
|
|
2876
|
+
React__default.createElement("div", { className: `textarea-control ${ErrorFieldKey.description}` },
|
|
2877
|
+
React__default.createElement("div", { className: "textarea-wrapper" },
|
|
2878
|
+
React__default.createElement(RichTextEditor, { html: value || '', placeholder: placeholder, onChange: onChange, bannedWords: bannedWords, onImagePickerClick: () => { var _a; return (_a = imagePicker.current) === null || _a === void 0 ? void 0 : _a.click(); }, onPreviewUrlChange: setPreviewUrl, onInvalidUrlsChange: onInvalidUrlsChange, isReplying: isReplying }))),
|
|
2879
|
+
footerEditor)));
|
|
2880
|
+
};
|
|
2881
|
+
|
|
2882
|
+
const StyledCreateNewPost = styled.div `
|
|
2883
|
+
position: relative;
|
|
2884
|
+
display: flex;
|
|
2885
|
+
height: 100%;
|
|
2886
|
+
flex-direction: column;
|
|
2887
|
+
|
|
2888
|
+
${MediaQueries.mbDown} {
|
|
2889
|
+
padding: 16px 16px;
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
.input-group-container {
|
|
2893
|
+
flex: 1;
|
|
2894
|
+
padding: 16px 24px;
|
|
2895
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
2896
|
+
overflow-y: auto;
|
|
2897
|
+
scrollbar-width: none; /* Firefox */
|
|
2898
|
+
&::-webkit-scrollbar {
|
|
2899
|
+
display: none;
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
.input-group {
|
|
2904
|
+
:not(:last-child) {
|
|
2905
|
+
margin-bottom: 0.6rem;
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
input:focus,
|
|
2909
|
+
textarea:focus,
|
|
2910
|
+
[contenteditable='true'] {
|
|
2911
|
+
outline: none;
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
label {
|
|
2915
|
+
margin-bottom: 5px;
|
|
2916
|
+
color: ${theme.colors.gray600};
|
|
2917
|
+
/* font-family: 'Open Sans', sans-serif; */
|
|
2918
|
+
font-size: 13px;
|
|
2919
|
+
font-weight: bold;
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
.input-group-label {
|
|
2923
|
+
margin-bottom: 5px;
|
|
2924
|
+
color: ${theme.colors.gray600};
|
|
2925
|
+
/* font-family: 'Open Sans', sans-serif; */
|
|
2926
|
+
font-size: 13px;
|
|
2927
|
+
font-weight: bold;
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
.input-notification {
|
|
2931
|
+
display: flex;
|
|
2932
|
+
|
|
2933
|
+
& > img {
|
|
2934
|
+
width: 16px;
|
|
2935
|
+
height: 16px;
|
|
2936
|
+
margin-top: 1.5px;
|
|
2937
|
+
margin-right: 8px;
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
.tag-list {
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
.warning {
|
|
2946
|
+
margin-top: 16px;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
.submit-btn {
|
|
2950
|
+
width: 100%;
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
.switch-label {
|
|
2954
|
+
display: flex;
|
|
2955
|
+
align-items: center;
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
.swich-input-group {
|
|
2959
|
+
padding: 12px 16px;
|
|
2960
|
+
border-radius: 8px;
|
|
2961
|
+
background: ${theme.colors.neutral50};
|
|
2962
|
+
|
|
2963
|
+
&.askdoctor-switch {
|
|
2964
|
+
background: ${theme.colors.primary50};
|
|
2965
|
+
&.mb-color {
|
|
2966
|
+
background: ${theme.mbColors.tonePink};
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
.mantine-Switch-labelWrapper {
|
|
2971
|
+
flex-grow: 1;
|
|
2972
|
+
}
|
|
2973
|
+
.mantine-Checkbox-body {
|
|
2974
|
+
display: flex;
|
|
2975
|
+
width: 100%;
|
|
2976
|
+
align-items: center;
|
|
2977
|
+
justify-content: space-between;
|
|
2978
|
+
}
|
|
2979
|
+
.mantine-Switch-track {
|
|
2980
|
+
margin-bottom: 0;
|
|
2981
|
+
}
|
|
2982
|
+
.label-txt {
|
|
2983
|
+
font-weight: normal;
|
|
2984
|
+
font-size: 14px;
|
|
2985
|
+
color: ${theme.colors.gray800};
|
|
2986
|
+
margin-left: 10px;
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
`;
|
|
2990
|
+
const StyledIsQuestion = styled.div `
|
|
2991
|
+
display: flex;
|
|
2992
|
+
width: 100%;
|
|
2993
|
+
align-items: center;
|
|
2994
|
+
justify-content: space-between;
|
|
2995
|
+
padding: 12px;
|
|
2996
|
+
border-radius: 0 0 8px 8px;
|
|
2997
|
+
background: ${theme.colors.neutral50};
|
|
2998
|
+
gap: 12px;
|
|
2999
|
+
|
|
3000
|
+
&.has-error {
|
|
3001
|
+
border: 1px solid ${theme.colors.red600};
|
|
3002
|
+
}
|
|
3003
|
+
&.error-description {
|
|
3004
|
+
border: 1px solid ${theme.colors.red600};
|
|
3005
|
+
border-top: none;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
&[data-is-marry-baby='true'] {
|
|
3009
|
+
background: ${theme.mbColors.tonePink};
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
.switch-label {
|
|
3013
|
+
display: flex;
|
|
3014
|
+
gap: 12px;
|
|
3015
|
+
align-items: center;
|
|
3016
|
+
|
|
3017
|
+
.wrapper-text {
|
|
3018
|
+
.label-txt {
|
|
3019
|
+
color: ${theme.colors.gray800};
|
|
3020
|
+
font-size: 14px;
|
|
3021
|
+
font-weight: 600;
|
|
3022
|
+
line-height: 22px;
|
|
3023
|
+
}
|
|
3024
|
+
.description-txt {
|
|
3025
|
+
color: ${theme.colors.gray700};
|
|
3026
|
+
font-size: 12px;
|
|
3027
|
+
font-weight: 400;
|
|
3028
|
+
line-height: 18px;
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
.switch-btn {
|
|
3034
|
+
.mantine-Switch-track {
|
|
3035
|
+
margin: 0;
|
|
3036
|
+
min-width: 40px;
|
|
3037
|
+
width: 40px;
|
|
3038
|
+
}
|
|
3039
|
+
.mantine-Switch-labelWrapper {
|
|
3040
|
+
display: none;
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
button {
|
|
3045
|
+
height: 40px;
|
|
3046
|
+
&:hover,
|
|
3047
|
+
&.primary {
|
|
3048
|
+
border-radius: 16px;
|
|
3049
|
+
border: 1px solid ${theme.colors.blue100};
|
|
3050
|
+
background: ${theme.colors.blue50};
|
|
3051
|
+
color: ${theme.colors.primaryBase};
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
`;
|
|
3055
|
+
const StyledError = styled.div `
|
|
3056
|
+
margin-bottom: 12px;
|
|
3057
|
+
color: ${theme.colors.red700};
|
|
3058
|
+
svg {
|
|
3059
|
+
margin-right: 5px;
|
|
3060
|
+
}
|
|
3061
|
+
svg,
|
|
3062
|
+
span {
|
|
3063
|
+
vertical-align: middle;
|
|
3064
|
+
}
|
|
3065
|
+
.mantine-Text-root {
|
|
3066
|
+
color: ${theme.colors.red600};
|
|
3067
|
+
font-size: 12px;
|
|
3068
|
+
font-weight: 400;
|
|
3069
|
+
line-height: 18px;
|
|
3070
|
+
display: block;
|
|
3071
|
+
}
|
|
3072
|
+
`;
|
|
3073
|
+
const StyledFormGroupInner = styled.div `
|
|
3074
|
+
.swich-input-group {
|
|
3075
|
+
padding: 12px 16px;
|
|
3076
|
+
border-radius: 8px;
|
|
3077
|
+
background: ${theme.colors.neutral50};
|
|
3078
|
+
|
|
3079
|
+
&.askdoctor-switch {
|
|
3080
|
+
background: ${theme.colors.blue50};
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3083
|
+
.switch-label {
|
|
3084
|
+
display: flex;
|
|
3085
|
+
align-items: center;
|
|
3086
|
+
}
|
|
3087
|
+
.mantine-Switch-labelWrapper {
|
|
3088
|
+
flex-grow: 1;
|
|
3089
|
+
}
|
|
3090
|
+
.mantine-Checkbox-body {
|
|
3091
|
+
display: flex;
|
|
3092
|
+
width: 100%;
|
|
3093
|
+
align-items: center;
|
|
3094
|
+
justify-content: space-between;
|
|
3095
|
+
}
|
|
3096
|
+
.mantine-Switch-track {
|
|
3097
|
+
margin-bottom: 0;
|
|
3098
|
+
}
|
|
3099
|
+
.label-txt {
|
|
3100
|
+
font-weight: normal;
|
|
3101
|
+
font-size: 14px;
|
|
3102
|
+
color: ${theme.colors.gray800};
|
|
3103
|
+
margin-left: 14px;
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
`;
|
|
3107
|
+
const StylePostAction = styled.div `
|
|
3108
|
+
display: flex;
|
|
3109
|
+
gap: 12px;
|
|
3110
|
+
.avatar {
|
|
3111
|
+
width: 40px;
|
|
3112
|
+
height: 40px;
|
|
3113
|
+
border-radius: 100%;
|
|
3114
|
+
|
|
3115
|
+
&.avatar-anonymous {
|
|
3116
|
+
background: ${theme.colors.neutral100};
|
|
3117
|
+
}
|
|
3118
|
+
|
|
3119
|
+
img {
|
|
3120
|
+
border-radius: 100%;
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
.author-avatar {
|
|
3124
|
+
.col-left {
|
|
3125
|
+
display: none;
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3130
|
+
.post-action-form {
|
|
3131
|
+
display: flex;
|
|
3132
|
+
flex-direction: column;
|
|
3133
|
+
gap: 4px;
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
.post-action-by {
|
|
3137
|
+
color: ${theme.colors.gray800};
|
|
3138
|
+
font-size: 16px;
|
|
3139
|
+
font-weight: 600;
|
|
3140
|
+
line-height: 24px;
|
|
3141
|
+
}
|
|
3142
|
+
|
|
3143
|
+
.post-action-result {
|
|
3144
|
+
display: flex;
|
|
3145
|
+
position: relative;
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
.dropdown-post-action {
|
|
3149
|
+
background: ${theme.colors.white} !important;
|
|
3150
|
+
border-radius: 8px;
|
|
3151
|
+
border: 1px solid ${theme.colors.neutral200} !important;
|
|
3152
|
+
|
|
3153
|
+
> div {
|
|
3154
|
+
padding: 3px 8px;
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
span {
|
|
3158
|
+
flex: 1;
|
|
3159
|
+
color: ${theme.colors.gray600};
|
|
3160
|
+
font-size: 12px;
|
|
3161
|
+
font-weight: 600;
|
|
3162
|
+
line-height: 18px;
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
ul {
|
|
3166
|
+
width: 130px;
|
|
3167
|
+
li {
|
|
3168
|
+
img {
|
|
3169
|
+
flex: 0 0 16px;
|
|
3170
|
+
width: 16px;
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
`;
|
|
3176
|
+
const StyleSessionRow = styled.div `
|
|
3177
|
+
display: inline-flex;
|
|
3178
|
+
gap: 8px;
|
|
3179
|
+
align-items: center;
|
|
3180
|
+
cursor: pointer;
|
|
3181
|
+
|
|
3182
|
+
.session-title {
|
|
3183
|
+
color: ${theme.colors.gray600};
|
|
3184
|
+
font-size: 14px;
|
|
3185
|
+
font-weight: 600;
|
|
3186
|
+
line-height: 22px;
|
|
3187
|
+
flex: 1;
|
|
3188
|
+
}
|
|
3189
|
+
`;
|
|
3190
|
+
const StyledIsQuestionWrapper = styled.div `
|
|
3191
|
+
padding: 8px 8px;
|
|
3192
|
+
border: 1px solid ${theme.colors.gray200};
|
|
3193
|
+
border-top: none;
|
|
3194
|
+
border-radius: 0 0 8px 8px;
|
|
3195
|
+
&.has-error {
|
|
3196
|
+
border: 1px solid ${theme.colors.red600};
|
|
3197
|
+
}
|
|
3198
|
+
&.error-description {
|
|
3199
|
+
border: 1px solid ${theme.colors.red600};
|
|
3200
|
+
border-top: none;
|
|
3201
|
+
}
|
|
3202
|
+
`;
|
|
3203
|
+
const StyleActionFooter = styled.div `
|
|
3204
|
+
display: flex;
|
|
3205
|
+
padding: 16px 24px 24px 24px;
|
|
3206
|
+
justify-content: space-between;
|
|
3207
|
+
align-items: center;
|
|
3208
|
+
box-shadow: 0px -2px 10px 0px rgba(0, 0, 0, 0.08);
|
|
3209
|
+
${MediaQueries.mbDown} {
|
|
3210
|
+
padding: 8px 16px 12px 16px;
|
|
3211
|
+
gap: 12px;
|
|
3212
|
+
flex-direction: column;
|
|
3213
|
+
justify-content: flex-start;
|
|
3214
|
+
align-items: flex-start;
|
|
3215
|
+
}
|
|
3216
|
+
.input-group {
|
|
3217
|
+
margin-bottom: 0 !important;
|
|
3218
|
+
}
|
|
3219
|
+
`;
|
|
3220
|
+
|
|
3221
|
+
const CreatePostPhotos = ({ imageFiles: imageFilesInit, setImageFiles, }) => {
|
|
3222
|
+
const imageRef = useRef(null);
|
|
3223
|
+
const { t } = useTranslations();
|
|
3224
|
+
const { onSelectImages } = useImagePicker(imageFilesInit, setImageFiles);
|
|
3225
|
+
const handleClick = () => {
|
|
3226
|
+
var _a;
|
|
3227
|
+
(_a = imageRef === null || imageRef === void 0 ? void 0 : imageRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
3228
|
+
};
|
|
3229
|
+
return (React__default.createElement("div", { className: "input-group" },
|
|
3230
|
+
React__default.createElement(StyleSessionRow, { onClick: handleClick },
|
|
3231
|
+
React__default.createElement("img", { alt: "anonymous-icon", src: IconPhone, style: {
|
|
3232
|
+
width: '18px',
|
|
3233
|
+
height: '18px',
|
|
3234
|
+
objectFit: 'contain',
|
|
3235
|
+
marginLeft: 'auto',
|
|
3236
|
+
} }),
|
|
3237
|
+
React__default.createElement("div", { className: "session-title" }, t('createPost.photos'))),
|
|
3238
|
+
React__default.createElement("input", { ref: imageRef, type: "file", accept: "image/png, image/gif, image/jpeg", multiple: true, style: { display: 'none' }, onChange: (e) => onSelectImages(e) })));
|
|
3239
|
+
};
|
|
3240
|
+
|
|
3241
|
+
const TITLE_LIMIT = 120;
|
|
3242
|
+
const inputModify = (value, opts) => {
|
|
3243
|
+
if (!opts)
|
|
3244
|
+
return value;
|
|
3245
|
+
const { limit, bannedWords = [] } = opts;
|
|
3246
|
+
const shorten = typeof limit === 'number' && limit >= 0 ? value.substring(0, limit) : value;
|
|
3247
|
+
const processedValue = highlightBadWords(shorten, bannedWords);
|
|
3248
|
+
return processedValue;
|
|
3249
|
+
};
|
|
3250
|
+
const CreatePostTitle = ({ className, style, bannedWords = [], value, placeholder = '', error, onChange, }) => {
|
|
3251
|
+
const _theme = useMantineTheme();
|
|
3252
|
+
const { t } = useTranslations();
|
|
3253
|
+
const [titleValue, setTitleValue] = useState('');
|
|
3254
|
+
const titleRef = useRef(null);
|
|
3255
|
+
useEffect(() => {
|
|
3256
|
+
if (titleRef.current) {
|
|
3257
|
+
const pasteHandler = (e) => {
|
|
3258
|
+
var _a;
|
|
3259
|
+
e.preventDefault();
|
|
3260
|
+
const text = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/plain');
|
|
3261
|
+
document.execCommand('insertHTML', false, text);
|
|
3262
|
+
};
|
|
3263
|
+
const contentDiv = titleRef.current;
|
|
3264
|
+
contentDiv.addEventListener('paste', pasteHandler, {
|
|
3265
|
+
passive: true,
|
|
3266
|
+
});
|
|
3267
|
+
return () => contentDiv.removeEventListener('paste', pasteHandler);
|
|
3268
|
+
}
|
|
3269
|
+
}, [titleRef]);
|
|
3270
|
+
const bannedString = (bannedWords === null || bannedWords === void 0 ? void 0 : bannedWords.join(',')) || '';
|
|
3271
|
+
useEffect(() => {
|
|
3272
|
+
var _a;
|
|
3273
|
+
if (bannedString) {
|
|
3274
|
+
const titleText = (_a = titleRef.current) === null || _a === void 0 ? void 0 : _a.innerText;
|
|
3275
|
+
if (titleText) {
|
|
3276
|
+
const titleValueWithBanned = highlightBadWords(titleText, bannedWords);
|
|
3277
|
+
if (titleValueWithBanned !== titleText) {
|
|
3278
|
+
onChange && onChange(titleValueWithBanned);
|
|
3279
|
+
setTitleValue(titleValueWithBanned);
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
}, [bannedString]);
|
|
3284
|
+
const debounceInputModify = useCallback(debounce((v) => {
|
|
3285
|
+
if (v) {
|
|
3286
|
+
const shortenString = inputModify(v, {
|
|
3287
|
+
limit: TITLE_LIMIT,
|
|
3288
|
+
bannedWords,
|
|
3289
|
+
});
|
|
3290
|
+
onChange && onChange(shortenString);
|
|
3291
|
+
setTitleValue(shortenString);
|
|
3292
|
+
}
|
|
3293
|
+
}, 300), []);
|
|
3294
|
+
return (React__default.createElement(StyledCreatePostTitle, { className: className, style: style, color: _theme.colors[_theme.primaryColor][0], colorShadow: _theme.colors[_theme.primaryColor][2] },
|
|
3295
|
+
React__default.createElement(StyleWrapperTitle, null,
|
|
3296
|
+
React__default.createElement(Text, { size: "p4", className: "field-label" }, t('createPost.title')),
|
|
3297
|
+
React__default.createElement(Text, { size: "p4", className: "count-string" },
|
|
3298
|
+
`${value === null || value === void 0 ? void 0 : value.length}/${TITLE_LIMIT}`,
|
|
3299
|
+
"\u00A0",
|
|
3300
|
+
t('character'))),
|
|
3301
|
+
React__default.createElement(Input, { name: "title", value: value || titleValue, size: "md", label: "", placeholder: placeholder, onChange: (str) => {
|
|
3302
|
+
if (str !== (value || titleValue)) {
|
|
3303
|
+
const initialValue = inputModify(str, {
|
|
3304
|
+
bannedWords,
|
|
3305
|
+
});
|
|
3306
|
+
onChange && onChange(initialValue);
|
|
3307
|
+
setTitleValue(initialValue);
|
|
3308
|
+
debounceInputModify(str);
|
|
3309
|
+
}
|
|
3310
|
+
}, className: `${ErrorFieldKey.title} ${error && (error === null || error === void 0 ? void 0 : error.title) ? 'has-input-error' : ''}` }),
|
|
3311
|
+
error && (error === null || error === void 0 ? void 0 : error.title) && (React__default.createElement(StyledError, { style: { margin: '4px 0 0' } },
|
|
3312
|
+
React__default.createElement(Text, { size: "p5", as: "span", color: theme.colors.red600 }, error.title)))));
|
|
3313
|
+
};
|
|
3314
|
+
|
|
3315
|
+
const StyleReviewPhoto = styled.div `
|
|
3316
|
+
.mantine-Text-root {
|
|
3317
|
+
margin-bottom: 4px;
|
|
3318
|
+
}
|
|
3319
|
+
.preview-images-container {
|
|
3320
|
+
display: flex;
|
|
3321
|
+
gap: 8px;
|
|
3322
|
+
overflow-x: auto;
|
|
3323
|
+
overflow-y: hidden;
|
|
3324
|
+
.image-src-wrapper {
|
|
3325
|
+
flex: 0 0 116px;
|
|
3326
|
+
width: 116px;
|
|
3327
|
+
height: 116px;
|
|
3328
|
+
border-radius: 4px;
|
|
3329
|
+
position: relative;
|
|
3330
|
+
img {
|
|
3331
|
+
border-radius: 4px;
|
|
3332
|
+
}
|
|
3333
|
+
.icon-close {
|
|
3334
|
+
position: absolute;
|
|
3335
|
+
top: 6px;
|
|
3336
|
+
right: 6px;
|
|
3337
|
+
cursor: pointer;
|
|
3338
|
+
z-index: 10;
|
|
3339
|
+
max-height: 24px;
|
|
3340
|
+
max-width: 24px;
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
&.image-has-error {
|
|
3344
|
+
.preview-image {
|
|
3345
|
+
border: 1.5px solid ${theme.colors.red600};
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
`;
|
|
3351
|
+
|
|
3352
|
+
const PostPhotosReview = ({ error, imageFiles: imageFilesInit, indexImageError = [], setIndexImageError, setImageFiles, removeKeyError, }) => {
|
|
3353
|
+
const { t } = useTranslations();
|
|
3354
|
+
const { imageSrcs, onRemoveImage } = useImagePicker(imageFilesInit, setImageFiles);
|
|
3355
|
+
return (React__default.createElement(StyleReviewPhoto, { className: "input-group" },
|
|
3356
|
+
React__default.createElement(Text, { size: "p5", weight: "semiBold" }, t('createPost.photos')),
|
|
3357
|
+
React__default.createElement("div", { className: `${ErrorFieldKey.photos} preview-images-container` }, imageSrcs === null || imageSrcs === void 0 ? void 0 : imageSrcs.map((src, index) => {
|
|
3358
|
+
const imageError = indexImageError.includes(index);
|
|
3359
|
+
return (React__default.createElement("div", { className: `image-src-wrapper ${imageError ? 'image-has-error' : ''}`, key: index },
|
|
3360
|
+
React__default.createElement("img", { src: src, className: "preview-image", alt: "", style: {
|
|
3361
|
+
width: '100%',
|
|
3362
|
+
height: '100%',
|
|
3363
|
+
objectFit: 'cover',
|
|
3364
|
+
} }),
|
|
3365
|
+
React__default.createElement("img", { alt: "", className: "icon-close", src: IconCloseCircle, onClick: () => {
|
|
3366
|
+
removeKeyError && removeKeyError('photos');
|
|
3367
|
+
onRemoveImage(index);
|
|
3368
|
+
const newIndexError = indexImageError.filter((item) => item !== index) || [];
|
|
3369
|
+
setIndexImageError(newIndexError);
|
|
3370
|
+
} })));
|
|
3371
|
+
})),
|
|
3372
|
+
error && (error === null || error === void 0 ? void 0 : error.photos) && (React__default.createElement(StyledError, null,
|
|
3373
|
+
React__default.createElement(Text, { size: "p5", color: theme.colors.red600 }, error.photos)))));
|
|
3374
|
+
};
|
|
3375
|
+
|
|
3376
|
+
var img = "data:image/svg+xml,%3csvg width='27' height='34' viewBox='0 0 27 34' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M26.6198 30.8276C26.1994 29.8612 25.6858 28.938 25.0862 28.0712C24.7039 27.4646 24.1752 26.9639 23.5487 26.6152L20.809 24.8984H6.56441L3.82386 26.6152C3.19735 26.9639 2.66863 27.4646 2.28637 28.0712C1.68686 28.938 1.1733 29.8612 0.752979 30.8276C0.66293 31.0085 0.641973 31.216 0.694039 31.4113C0.746105 31.6065 0.867615 31.776 1.03578 31.8881C3.0517 33.0766 8.44044 33.6133 13.6865 33.6133C18.9327 33.6133 24.3197 33.0766 26.3357 31.8881C26.5041 31.7762 26.6259 31.6068 26.6782 31.4116C26.7305 31.2163 26.7098 31.0087 26.6198 30.8276Z' fill='%23626D7C'/%3e%3cpath d='M10.0127 16.6728C11.3205 16.6728 12.3808 15.6125 12.3808 14.3046C12.3808 12.9968 11.3205 11.9365 10.0127 11.9365C8.70478 11.9365 7.64453 12.9968 7.64453 14.3046C7.64453 15.6125 8.70478 16.6728 10.0127 16.6728Z' fill='%23626D7C'/%3e%3cpath d='M17.3642 16.6728C18.6721 16.6728 19.7323 15.6125 19.7323 14.3046C19.7323 12.9968 18.6721 11.9365 17.3642 11.9365C16.0563 11.9365 14.9961 12.9968 14.9961 14.3046C14.9961 15.6125 16.0563 16.6728 17.3642 16.6728Z' fill='%23626D7C'/%3e%3cpath d='M21.9864 28.0466C22.082 29.5658 21.4126 32.585 21.0465 33.4184C20.347 33.5359 19.612 33.6342 18.8497 33.7162C19.2541 28.6723 18.254 25.817 17.3633 23.1885C19.6065 23.9945 20.3088 24.4426 20.8088 24.8989C21.6531 25.664 21.8006 26.2187 21.6094 26.5192C21.4181 26.828 20.5082 27.0438 20.5082 27.0438C21.6831 27.3225 21.9564 27.5958 21.9864 28.0466Z' fill='%2387909C'/%3e%3cpath d='M10.0121 23.1885C9.11859 25.817 8.11855 28.6723 8.52293 33.7162C7.76061 33.6342 7.02561 33.5359 6.32613 33.4184C5.95999 32.585 5.29057 29.5658 5.3862 28.0466C5.41625 27.5958 5.68949 27.3225 6.8644 27.0438C6.8644 27.0438 5.95726 26.828 5.76326 26.5219C5.56927 26.2159 5.72228 25.664 6.56384 24.8989C7.06659 24.4426 7.76881 23.9945 10.0121 23.1885Z' fill='%2387909C'/%3e%3cpath d='M3.82307 26.6153L6.56361 24.8994C5.72205 25.6645 5.57177 26.2191 5.76304 26.5224C5.9543 26.8257 6.86417 27.0443 6.86417 27.0443C5.68926 27.323 5.41603 27.5962 5.38597 28.0471C5.29034 29.5663 5.95977 32.5855 6.3259 33.4189C3.99248 33.0391 2.07164 32.4981 1.03608 31.8888C0.868115 31.7766 0.746669 31.6072 0.694385 31.4122C0.6421 31.2171 0.662547 31.0097 0.751911 30.8286C1.17295 29.8624 1.68628 28.9392 2.28476 28.0717C2.66772 27.4653 3.19662 26.9645 3.82307 26.6153Z' fill='%23626D7C'/%3e%3cpath d='M26.6201 30.8286C26.7101 31.0096 26.7309 31.2172 26.6786 31.4124C26.6262 31.6077 26.5044 31.7771 26.3359 31.8888C25.3031 32.4981 23.3822 33.0391 21.0461 33.4189C21.4122 32.5855 22.0816 29.5663 21.986 28.0471C21.956 27.5962 21.6827 27.323 20.5078 27.0443C20.5078 27.0443 21.4177 26.8285 21.6089 26.5197C21.8002 26.2191 21.6527 25.6645 20.8084 24.8994L23.5489 26.6153C24.1754 26.9645 24.7043 27.4653 25.0872 28.0717C25.6863 28.9388 26.1996 29.8621 26.6201 30.8286Z' fill='%23626D7C'/%3e%3cpath d='M17.3632 23.1885C18.254 25.817 19.254 28.6723 18.8496 33.7162C17.1356 33.9049 15.4126 33.9998 13.6882 34.0004C11.963 33.9997 10.239 33.9049 8.5241 33.7162C8.11971 28.6723 9.11975 25.817 10.0132 23.1885C10.2264 22.4453 10.5843 22.3497 10.8411 22.3797C11.4805 22.4562 12.1171 23.0136 13.6828 23.0136H13.691C15.2566 23.0136 15.896 22.4562 16.5326 22.3797C16.7895 22.3497 17.1501 22.4453 17.3632 23.1885Z' fill='%23D2D6DC'/%3e%3cpath d='M21.5965 8.49707H5.7789C3.77117 8.55172 2.41347 9.08289 2.59189 9.89057C2.8889 11.2362 7.55957 13.0035 13.6877 13.0035C19.8158 13.0035 24.4865 11.2362 24.7835 9.89057C24.9619 9.08289 23.6042 8.55117 21.5965 8.49707Z' fill='%2387909C'/%3e%3cpath d='M21.6065 8.49671C21.6725 8.82817 21.7208 9.1629 21.7513 9.49949C21.7513 10.2072 18.1009 11.2263 13.6882 11.2263C9.27542 11.2263 5.625 10.2072 5.625 9.49949C5.65547 9.1629 5.70381 8.82817 5.76981 8.49671C6.50755 4.6441 9.52133 -0.744085 12.8001 1.00735C13.0736 1.15268 13.3785 1.22867 13.6882 1.22867C13.9978 1.22867 14.3027 1.15268 14.5762 1.00735C17.855 -0.744085 20.8688 4.6441 21.6065 8.49671Z' fill='%23626D7C'/%3e%3c/svg%3e";
|
|
3377
|
+
var AvatarAnonymous = img;
|
|
3378
|
+
|
|
3379
|
+
const MAX_SIZE_FILE_UPLOAD = 10 * 1024 * 1024;
|
|
3380
|
+
const applySpecialCharSite = [
|
|
3381
|
+
LOCALE.PhilippinesEnglish,
|
|
3382
|
+
LOCALE.PhilippinesTagalog,
|
|
3383
|
+
LOCALE.Indonesia,
|
|
3384
|
+
LOCALE.Malaysia,
|
|
3385
|
+
LOCALE.Vietnam,
|
|
3386
|
+
];
|
|
3387
|
+
const CreateNewPostContentV2 = ({ className, style, onClose, forceSelectCommunity, articleId, editPostData, defaultCommunity, defaultTopics, userInfo, isMarryBaby = false, }) => {
|
|
3388
|
+
const isInEditMode = !!(editPostData === null || editPostData === void 0 ? void 0 : editPostData.id);
|
|
3389
|
+
const { data: { locale, env: { togetherBasePath }, }, action: { pushNotifications, sanitizeFunction }, } = useContext(TogetherComponentGlobalContext);
|
|
3390
|
+
const { t } = useTranslations();
|
|
3391
|
+
const containerRef = useRef(null);
|
|
3392
|
+
const [isAskDoctor, setIsAskDoctor] = useState(false);
|
|
3393
|
+
const [specialCharErr, setspecialCharErr] = useState(false);
|
|
3394
|
+
const [titleValue, setTitleValue] = useState('');
|
|
3395
|
+
const [descriptionValue, setDescriptionValue] = useState('');
|
|
3396
|
+
const [communityValue, setCommunityValue] = useState({
|
|
3397
|
+
label: t('community.choose'),
|
|
3398
|
+
value: '',
|
|
3399
|
+
});
|
|
3400
|
+
const [selectedTopics, setSelectedTopics] = useState([]);
|
|
3401
|
+
const [error, setError] = useState({});
|
|
3402
|
+
const [imageFiles, setImageFiles] = useState([]);
|
|
3403
|
+
const [bannedWords, setBannedWords] = useState([]);
|
|
3404
|
+
const [indexImageError, setIndexImageError] = useState([]);
|
|
3405
|
+
const [postActionValue, setPostActionValue] = useState({
|
|
3406
|
+
label: t('cardPost.public'),
|
|
3407
|
+
value: 'public',
|
|
3408
|
+
});
|
|
3409
|
+
const [communitiesList, setCommunitiesList] = useState([]);
|
|
3410
|
+
const [topicsList, setTopicsList] = useState([]);
|
|
3411
|
+
const { imageSrcs = [] } = useImagePicker(imageFiles);
|
|
3412
|
+
const [previewUrl, setPreviewUrl] = useState(null);
|
|
3413
|
+
const [invalidUrls, setInvalidUrls] = useState([]);
|
|
3414
|
+
const [stepPost, setStepPost] = useState('step_info');
|
|
3415
|
+
const [isLoadingSuggest, setIsLoadingSuggest] = useState(false);
|
|
3416
|
+
const [uncategorizedId, setUncategorizedId] = useState('');
|
|
3417
|
+
const postActionType = [
|
|
3418
|
+
{
|
|
3419
|
+
label: t('cardPost.public'),
|
|
3420
|
+
value: 'public',
|
|
3421
|
+
icon: (React__default.createElement("img", { alt: "anonymous-icon", src: IconPublic, style: {
|
|
3422
|
+
width: '100%',
|
|
3423
|
+
height: '100%',
|
|
3424
|
+
objectFit: 'contain',
|
|
3425
|
+
marginLeft: 'auto',
|
|
3426
|
+
} })),
|
|
3427
|
+
},
|
|
3428
|
+
{
|
|
3429
|
+
label: t('cardPost.option.anonymous'),
|
|
3430
|
+
value: 'anonymous',
|
|
3431
|
+
icon: (React__default.createElement("img", { alt: "anonymous-icon", src: IconAnonymous, style: {
|
|
3432
|
+
width: '100%',
|
|
3433
|
+
height: '100%',
|
|
3434
|
+
objectFit: 'contain',
|
|
3435
|
+
marginLeft: 'auto',
|
|
3436
|
+
} })),
|
|
3437
|
+
},
|
|
3438
|
+
];
|
|
3439
|
+
const currentCommunity = useMemo(() => {
|
|
3440
|
+
if (!communityValue.value)
|
|
3441
|
+
return null;
|
|
3442
|
+
const result = communitiesList.find((item) => String(item.id) === String(communityValue.value));
|
|
3443
|
+
if (!result)
|
|
3444
|
+
return null;
|
|
3445
|
+
return result;
|
|
3446
|
+
}, [communityValue, communitiesList]);
|
|
3447
|
+
// HANDLE etra action when OPEN AND CLOSE
|
|
3448
|
+
useEffect(() => {
|
|
3449
|
+
if (editPostData) {
|
|
3450
|
+
const post = editPostData;
|
|
3451
|
+
setTitleValue(post.title || '');
|
|
3452
|
+
setDescriptionValue(decodeMention(decodePostUrl(post.description || '', 'edit'), post.mentions));
|
|
3453
|
+
setCommunityValue({
|
|
3454
|
+
label: post.community.name,
|
|
3455
|
+
value: `${post.community.id || ''}-${post.community.mappedCategoryId || ''}`,
|
|
3456
|
+
});
|
|
3457
|
+
setSelectedTopics(post.topics || []);
|
|
3458
|
+
setImageFiles(post.photos || []);
|
|
3459
|
+
setIsAskDoctor(!!post.isAskDoctor || false);
|
|
3460
|
+
}
|
|
3461
|
+
else {
|
|
3462
|
+
if (defaultCommunity) {
|
|
3463
|
+
setCommunityValue({
|
|
3464
|
+
label: defaultCommunity.name,
|
|
3465
|
+
value: `${defaultCommunity.id || ''}-${defaultCommunity.mappedCategoryId || ''}`,
|
|
3466
|
+
});
|
|
3467
|
+
}
|
|
3468
|
+
if (defaultTopics) {
|
|
3469
|
+
setSelectedTopics(defaultTopics);
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
}, []);
|
|
3473
|
+
useEffect(() => {
|
|
3474
|
+
setspecialCharErr(applySpecialCharSite.includes(locale) &&
|
|
3475
|
+
titleValue !== '' &&
|
|
3476
|
+
!/[a-zA-Z]/.test(titleValue));
|
|
3477
|
+
setError({});
|
|
3478
|
+
}, [titleValue]);
|
|
3479
|
+
useEffect(() => {
|
|
3480
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
3481
|
+
var _a, _b, _c;
|
|
3482
|
+
const [resListCommunity, resListTopic, resUncategorized] = yield Promise.all([
|
|
3483
|
+
callApiWithAuth(getApiPath(PATHS.COMMUNITY.LIST, {
|
|
3484
|
+
_locale: locale,
|
|
3485
|
+
pageSize: 100,
|
|
3486
|
+
}), 'GET'),
|
|
3487
|
+
callApiWithAuth(getApiPath(PATHS.TOPIC.LIST, {
|
|
3488
|
+
_locale: locale,
|
|
3489
|
+
pageSize: 100,
|
|
3490
|
+
}), 'GET'),
|
|
3491
|
+
callApiWithAuth(getApiPath(PATHS.COMMUNITY.GET_UNCATEGORIZED, {
|
|
3492
|
+
_locale: locale,
|
|
3493
|
+
}), 'GET'),
|
|
3494
|
+
]);
|
|
3495
|
+
const communitiesApi = (_a = resListCommunity === null || resListCommunity === void 0 ? void 0 : resListCommunity.data) === null || _a === void 0 ? void 0 : _a.communities;
|
|
3496
|
+
if (Array.isArray(communitiesApi) && communitiesApi.length) {
|
|
3497
|
+
setCommunitiesList(communitiesApi);
|
|
3498
|
+
}
|
|
3499
|
+
const topicRes = (_b = resListTopic === null || resListTopic === void 0 ? void 0 : resListTopic.data) === null || _b === void 0 ? void 0 : _b.topics;
|
|
3500
|
+
if (Array.isArray(topicRes)) {
|
|
3501
|
+
setTopicsList(() => topicRes === null || topicRes === void 0 ? void 0 : topicRes.map(formatTopic));
|
|
3502
|
+
}
|
|
3503
|
+
const uncategorizedApi = (_c = resUncategorized === null || resUncategorized === void 0 ? void 0 : resUncategorized.data) === null || _c === void 0 ? void 0 : _c.communities;
|
|
3504
|
+
if (Array.isArray(uncategorizedApi) && uncategorizedApi.length) {
|
|
3505
|
+
setUncategorizedId(String(uncategorizedApi[0].id));
|
|
3506
|
+
}
|
|
3507
|
+
}))();
|
|
3508
|
+
}, []);
|
|
3509
|
+
const validationUploadPhoto = (files) => {
|
|
3510
|
+
const errorMessage = Object.assign({}, error);
|
|
3511
|
+
if (files && files.length > 10) {
|
|
3512
|
+
errorMessage.photos = t('createPost.message.photoMaxium');
|
|
3513
|
+
}
|
|
3514
|
+
if (files && files.length) {
|
|
3515
|
+
let inValidSizeFile = false;
|
|
3516
|
+
const indexInValid = [];
|
|
3517
|
+
files.forEach((file, index) => {
|
|
3518
|
+
if ((file === null || file === void 0 ? void 0 : file.size) > MAX_SIZE_FILE_UPLOAD) {
|
|
3519
|
+
inValidSizeFile = true;
|
|
3520
|
+
indexInValid.push(index);
|
|
3521
|
+
}
|
|
3522
|
+
});
|
|
3523
|
+
if (inValidSizeFile) {
|
|
3524
|
+
errorMessage.photos = t('createPost.message.photoSize');
|
|
3525
|
+
}
|
|
3526
|
+
setIndexImageError(indexInValid);
|
|
3527
|
+
}
|
|
3528
|
+
else {
|
|
3529
|
+
setIndexImageError([]);
|
|
3530
|
+
}
|
|
3531
|
+
setError(errorMessage);
|
|
3532
|
+
};
|
|
3533
|
+
const validationPost = () => {
|
|
3534
|
+
let hasError = false;
|
|
3535
|
+
const errorMessage = {};
|
|
3536
|
+
const description = innertext(descriptionValue);
|
|
3537
|
+
if (!description) {
|
|
3538
|
+
errorMessage.description = t('createPost.message.requiredDescription');
|
|
3539
|
+
hasError = true;
|
|
3540
|
+
}
|
|
3541
|
+
if (!titleValue) {
|
|
3542
|
+
errorMessage.title = t('createPost.message.requiredTitle');
|
|
3543
|
+
hasError = true;
|
|
3544
|
+
}
|
|
3545
|
+
if (description && description.split(' ').length < 10) {
|
|
3546
|
+
errorMessage.description = t('createPost.message.lengthDescription', {
|
|
3547
|
+
currentLength: description.split(' ').length,
|
|
3548
|
+
});
|
|
3549
|
+
hasError = true;
|
|
3550
|
+
}
|
|
3551
|
+
if (titleValue && titleValue.length < 5) {
|
|
3552
|
+
errorMessage.title = t('createPost.message.lengthTitle.characters');
|
|
3553
|
+
hasError = true;
|
|
3554
|
+
}
|
|
3555
|
+
if (imageFiles && imageFiles.length > 10) {
|
|
3556
|
+
errorMessage.photos = t('createPost.message.photoMaxium');
|
|
3557
|
+
hasError = true;
|
|
3558
|
+
}
|
|
3559
|
+
if (imageFiles && imageFiles.length) {
|
|
3560
|
+
let inValidSizeFile = false;
|
|
3561
|
+
const indexInValid = [];
|
|
3562
|
+
imageFiles.forEach((file, index) => {
|
|
3563
|
+
if ((file === null || file === void 0 ? void 0 : file.size) > MAX_SIZE_FILE_UPLOAD) {
|
|
3564
|
+
inValidSizeFile = true;
|
|
3565
|
+
indexInValid.push(index);
|
|
3566
|
+
}
|
|
3567
|
+
});
|
|
3568
|
+
if (inValidSizeFile) {
|
|
3569
|
+
errorMessage.photos = t('createPost.message.photoSize');
|
|
3570
|
+
hasError = true;
|
|
3571
|
+
}
|
|
3572
|
+
setIndexImageError(indexInValid);
|
|
3573
|
+
}
|
|
3574
|
+
else {
|
|
3575
|
+
setIndexImageError([]);
|
|
3576
|
+
}
|
|
3577
|
+
if (invalidUrls && invalidUrls.length) {
|
|
3578
|
+
errorMessage.video = 'Invalid video url';
|
|
3579
|
+
hasError = true;
|
|
3580
|
+
}
|
|
3581
|
+
setError(errorMessage);
|
|
3582
|
+
return hasError;
|
|
3583
|
+
};
|
|
3584
|
+
const removeKeyError = (deleteKey) => {
|
|
3585
|
+
if (error[deleteKey]) {
|
|
3586
|
+
const _a = Object.assign({}, error), _b = `${deleteKey}`, value = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
3587
|
+
setError(rest);
|
|
3588
|
+
console.log(value);
|
|
3589
|
+
}
|
|
3590
|
+
};
|
|
3591
|
+
const submitPost = (uncategorized) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3592
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3593
|
+
const isError = validationPost();
|
|
3594
|
+
if (isError)
|
|
3595
|
+
return;
|
|
3596
|
+
const bodyFormData = yield getPostFormData({
|
|
3597
|
+
title: titleValue,
|
|
3598
|
+
description: descriptionValue,
|
|
3599
|
+
communityId: uncategorized
|
|
3600
|
+
? uncategorizedId
|
|
3601
|
+
: String((currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.id) || ''),
|
|
3602
|
+
imageFiles,
|
|
3603
|
+
previewUrl,
|
|
3604
|
+
topicIds: uncategorized
|
|
3605
|
+
? []
|
|
3606
|
+
: selectedTopics === null || selectedTopics === void 0 ? void 0 : selectedTopics.map((topic) => String(topic.id || '')).filter(Boolean),
|
|
3607
|
+
locale,
|
|
3608
|
+
sanitizeFunction,
|
|
3609
|
+
categoryCommunityId: String((currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.mappedCategoryId) || ''),
|
|
3610
|
+
categoryTopicIds: selectedTopics === null || selectedTopics === void 0 ? void 0 : selectedTopics.map((topic) => String((topic === null || topic === void 0 ? void 0 : topic.mappedCategoryId) || '')).filter(Boolean),
|
|
3611
|
+
isAnonymous: (postActionValue === null || postActionValue === void 0 ? void 0 : postActionValue.value) === 'anonymous' ? 1 : 0,
|
|
3612
|
+
isAskDoctor: isAskDoctor ? 1 : 0,
|
|
3613
|
+
introUrl: '',
|
|
3614
|
+
});
|
|
3615
|
+
if (articleId) {
|
|
3616
|
+
bodyFormData.append('article_id', articleId);
|
|
3617
|
+
}
|
|
3618
|
+
let res;
|
|
3619
|
+
if (isInEditMode) {
|
|
3620
|
+
if (editPostData === null || editPostData === void 0 ? void 0 : editPostData.id) {
|
|
3621
|
+
res = yield editPost({
|
|
3622
|
+
id: editPostData.id,
|
|
3623
|
+
formData: bodyFormData,
|
|
3624
|
+
locale,
|
|
3625
|
+
});
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
else {
|
|
3629
|
+
res = yield createPost({
|
|
3630
|
+
formData: bodyFormData,
|
|
3631
|
+
locale,
|
|
3632
|
+
isArticleComment: !(currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.id) && !!(currentCommunity === null || currentCommunity === void 0 ? void 0 : currentCommunity.mappedCategoryId),
|
|
3633
|
+
});
|
|
3634
|
+
}
|
|
3635
|
+
const resData = res === null || res === void 0 ? void 0 : res.data;
|
|
3636
|
+
if ((resData === null || resData === void 0 ? void 0 : resData.id) && !((_b = (_a = res === null || res === void 0 ? void 0 : res.messages) === null || _a === void 0 ? void 0 : _a.moderation) === null || _b === void 0 ? void 0 : _b.type)) {
|
|
3637
|
+
const params = `action=${editPostData ? 'editPost' : 'createPost'}&askDoctor=${(resData === null || resData === void 0 ? void 0 : resData.is_question) ? 'true' : 'false'}`;
|
|
3638
|
+
const postHref = `${getCurrentBaseUrl(locale)}${togetherBasePath}/${(_c = resData === null || resData === void 0 ? void 0 : resData.community) === null || _c === void 0 ? void 0 : _c.slug}/${resData === null || resData === void 0 ? void 0 : resData.slug}/?${params}`;
|
|
3639
|
+
window.location.href = postHref;
|
|
3640
|
+
}
|
|
3641
|
+
else {
|
|
3642
|
+
if (((_e = (_d = res === null || res === void 0 ? void 0 : res.messages) === null || _d === void 0 ? void 0 : _d.moderation) === null || _e === void 0 ? void 0 : _e.type) === 'banned') {
|
|
3643
|
+
pushNotifications({
|
|
3644
|
+
title: t('notification.post.blocked.title'),
|
|
3645
|
+
message: t('notification.post.blocked.message'),
|
|
3646
|
+
type: 'danger',
|
|
3647
|
+
});
|
|
3648
|
+
if (res.messages.moderation.words) {
|
|
3649
|
+
setBannedWords(res.messages.moderation.words);
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
else if (((_g = (_f = res === null || res === void 0 ? void 0 : res.messages) === null || _f === void 0 ? void 0 : _f.moderation) === null || _g === void 0 ? void 0 : _g.type) === 'suspect') {
|
|
3653
|
+
pushNotifications({
|
|
3654
|
+
title: t('notification.post.suspect.title'),
|
|
3655
|
+
message: t('notification.post.suspect.message'),
|
|
3656
|
+
type: 'warning',
|
|
3657
|
+
});
|
|
3658
|
+
onClose && onClose();
|
|
3659
|
+
}
|
|
3660
|
+
else if ((_j = (_h = res === null || res === void 0 ? void 0 : res.messages) === null || _h === void 0 ? void 0 : _h.find) === null || _j === void 0 ? void 0 : _j.call(_h, (m) => { var _a; return !!((_a = m === null || m === void 0 ? void 0 : m.includes) === null || _a === void 0 ? void 0 : _a.call(m, 'suspend')); })) {
|
|
3661
|
+
pushNotifications({
|
|
3662
|
+
message: t('notification.suspend.message'),
|
|
3663
|
+
type: 'danger',
|
|
3664
|
+
});
|
|
3665
|
+
onClose && onClose();
|
|
3666
|
+
}
|
|
3667
|
+
else {
|
|
3668
|
+
pushNotifications({
|
|
3669
|
+
message: ((_k = res === null || res === void 0 ? void 0 : res.messages) === null || _k === void 0 ? void 0 : _k[0]) || t('notification.failure'),
|
|
3670
|
+
type: 'danger',
|
|
3671
|
+
});
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
});
|
|
3675
|
+
const getFirstOrderErroKey = (orderKey) => {
|
|
3676
|
+
const result = orderKey.find((key) => {
|
|
3677
|
+
if (error.hasOwnProperty(key) && error[key]) {
|
|
3678
|
+
return true;
|
|
3679
|
+
}
|
|
3680
|
+
return false;
|
|
3681
|
+
});
|
|
3682
|
+
if (!result)
|
|
3683
|
+
return '';
|
|
3684
|
+
return ErrorFieldKey[result];
|
|
3685
|
+
};
|
|
3686
|
+
const handleScrollToError = (selectorKey) => {
|
|
3687
|
+
if ((containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) && selectorKey) {
|
|
3688
|
+
const errorFieldElm = document.querySelector(`.${selectorKey}`);
|
|
3689
|
+
if (errorFieldElm && containerRef.current) {
|
|
3690
|
+
const elm = containerRef.current;
|
|
3691
|
+
if (elm) {
|
|
3692
|
+
elm.scrollTo({
|
|
3693
|
+
top: errorFieldElm.offsetTop - 40,
|
|
3694
|
+
behavior: 'smooth',
|
|
3695
|
+
});
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
};
|
|
3700
|
+
const onSubmitContinuePost = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
3701
|
+
var _l;
|
|
3702
|
+
const isError = validationPost();
|
|
3703
|
+
if (isError) {
|
|
3704
|
+
const keyElmToScroll = getFirstOrderErroKey(orderErrorFieldKey);
|
|
3705
|
+
handleScrollToError(keyElmToScroll);
|
|
3706
|
+
return;
|
|
3707
|
+
}
|
|
3708
|
+
setStepPost('step_community');
|
|
3709
|
+
// Current just apply ai suggest community for Vietnam site
|
|
3710
|
+
if (locale === LOCALE.Vietnam && !isMarryBaby && !isInEditMode) {
|
|
3711
|
+
try {
|
|
3712
|
+
setIsLoadingSuggest(true);
|
|
3713
|
+
const res = yield callApiWithAuth(getChatbotAiApiPath(PATHS.CHATBOT.GET_SUGGEST_COMMUNITY), 'POST', {
|
|
3714
|
+
data: {
|
|
3715
|
+
title: titleValue,
|
|
3716
|
+
description: descriptionValue,
|
|
3717
|
+
},
|
|
3718
|
+
headers: {
|
|
3719
|
+
'Content-Type': 'application/json',
|
|
3720
|
+
},
|
|
3721
|
+
});
|
|
3722
|
+
if (!res)
|
|
3723
|
+
throw new Error();
|
|
3724
|
+
if (res === null || res === void 0 ? void 0 : res.community) {
|
|
3725
|
+
// Check community is exist list communities
|
|
3726
|
+
const suggestResult = communitiesList.find((item) => String(item.id) === String(res === null || res === void 0 ? void 0 : res.community.id));
|
|
3727
|
+
if (suggestResult) {
|
|
3728
|
+
setCommunityValue({
|
|
3729
|
+
label: suggestResult.name,
|
|
3730
|
+
value: String(suggestResult.id),
|
|
3731
|
+
});
|
|
3732
|
+
if ((res === null || res === void 0 ? void 0 : res.topic) && (res === null || res === void 0 ? void 0 : res.topic.length)) {
|
|
3733
|
+
const listTopicId = res.topic.map((item) => item.id);
|
|
3734
|
+
const resTopic = yield callApiWithAuth(getApiPath(PATHS.TOPIC.LIST, {
|
|
3735
|
+
_locale: locale,
|
|
3736
|
+
topic_in: listTopicId.join(),
|
|
3737
|
+
pageSize: 100,
|
|
3738
|
+
}), 'GET');
|
|
3739
|
+
const topicsApi = (_l = resTopic === null || resTopic === void 0 ? void 0 : resTopic.data) === null || _l === void 0 ? void 0 : _l.topics;
|
|
3740
|
+
const topicSuggested = topicsApi
|
|
3741
|
+
? topicsApi.map((item) => formatTopic(item))
|
|
3742
|
+
: [];
|
|
3743
|
+
setSelectedTopics(topicSuggested);
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
catch (err) {
|
|
3749
|
+
console.log('err');
|
|
3750
|
+
}
|
|
3751
|
+
finally {
|
|
3752
|
+
setIsLoadingSuggest(false);
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
});
|
|
3756
|
+
console.log('topicsList: ', topicsList);
|
|
3757
|
+
return (React__default.createElement(StyledCreateNewPost, { className: `${className} create-post-popup-frame`, style: style },
|
|
3758
|
+
React__default.createElement("div", { className: "input-group-container", ref: containerRef },
|
|
3759
|
+
React__default.createElement(StyledFormGroupInner, null,
|
|
3760
|
+
React__default.createElement("div", { className: "input-group" },
|
|
3761
|
+
React__default.createElement(StylePostAction, null,
|
|
3762
|
+
React__default.createElement("div", { className: `avatar ${postActionValue.value === 'anonymous'
|
|
3763
|
+
? 'avatar-anonymous'
|
|
3764
|
+
: ''}` }, postActionValue.value === 'anonymous' ? (React__default.createElement("img", { alt: "avatar-icon", src: AvatarAnonymous, style: {
|
|
3765
|
+
width: '100%',
|
|
3766
|
+
height: '100%',
|
|
3767
|
+
objectFit: 'contain',
|
|
3768
|
+
marginLeft: 'auto',
|
|
3769
|
+
} })) : (userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) ? (React__default.createElement("img", { alt: "avatar-icon", src: userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar, style: {
|
|
3770
|
+
width: '100%',
|
|
3771
|
+
height: '100%',
|
|
3772
|
+
objectFit: 'contain',
|
|
3773
|
+
marginLeft: 'auto',
|
|
3774
|
+
} })) : (React__default.createElement(CardAuthor, { showDetailPopup: false, avatar: "", avatarProps: { size: 40 }, name: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name, userId: userInfo === null || userInfo === void 0 ? void 0 : userInfo.userId, className: "author-avatar" }))),
|
|
3775
|
+
React__default.createElement("div", { className: "post-action-form" },
|
|
3776
|
+
React__default.createElement("div", { className: "post-action-by" }, (postActionValue === null || postActionValue === void 0 ? void 0 : postActionValue.value) === 'anonymous'
|
|
3777
|
+
? t('cardPost.anonymous')
|
|
3778
|
+
: userInfo === null || userInfo === void 0 ? void 0 : userInfo.name),
|
|
3779
|
+
React__default.createElement(Dropdown, { disabled: isInEditMode, options: postActionType, id: "post-action-type", size: "sm", className: "dropdown-post-action", placeholder: t('community.choose'), value: postActionValue, onChange: (option) => {
|
|
3780
|
+
setPostActionValue({
|
|
3781
|
+
label: option.label,
|
|
3782
|
+
value: String(option.value),
|
|
3783
|
+
});
|
|
3784
|
+
}, placeholderIcon: React__default.createElement("div", { className: "post-action-result" }, postActionValue.value === 'public' ? (React__default.createElement("img", { alt: "public-icon", src: IconPublic, style: {
|
|
3785
|
+
width: '100%',
|
|
3786
|
+
height: '100%',
|
|
3787
|
+
objectFit: 'contain',
|
|
3788
|
+
marginLeft: 'auto',
|
|
3789
|
+
} })) : (React__default.createElement("img", { alt: "anonymous-icon", src: IconAnonymous, style: {
|
|
3790
|
+
width: '100%',
|
|
3791
|
+
height: '100%',
|
|
3792
|
+
objectFit: 'contain',
|
|
3793
|
+
marginLeft: 'auto',
|
|
3794
|
+
} }))), style: {
|
|
3795
|
+
zIndex: 10,
|
|
3796
|
+
width: 'calc(100% + 20px)',
|
|
3797
|
+
} })))),
|
|
3798
|
+
React__default.createElement(CreatePostTitle, { className: "input-group", bannedWords: bannedWords, value: titleValue, error: error, placeholder: isAskDoctor
|
|
3799
|
+
? t('createPost.post.askDoctor.title')
|
|
3800
|
+
: t('createPost.post.title'), onChange: setTitleValue }),
|
|
3801
|
+
specialCharErr && (React__default.createElement(StyledError, null,
|
|
3802
|
+
React__default.createElement(Info, { isSolid: true, color: theme.colors.red700, size: 14 }),
|
|
3803
|
+
React__default.createElement(Text, { size: "p3", as: "span", color: theme.colors.red700 }, t('createPost.popup.specialCharErr')))),
|
|
3804
|
+
React__default.createElement("div", { className: "input-group" },
|
|
3805
|
+
React__default.createElement(CreatePostDescription, { bannedWords: bannedWords, value: descriptionValue, placeholder: isAskDoctor
|
|
3806
|
+
? t('createPost.post.askDoctor.description')
|
|
3807
|
+
: t('createPost.post.description'), onChange: (v) => {
|
|
3808
|
+
setDescriptionValue(v);
|
|
3809
|
+
removeKeyError('description');
|
|
3810
|
+
}, onPreviewUrlChange: setPreviewUrl, onInvalidUrlsChange: setInvalidUrls, onImageFilesChange: setImageFiles, imageFiles: imageFiles, className: `${error && (error === null || error === void 0 ? void 0 : error.description) ? 'error-description' : ''}`, footerEditor: React__default.createElement(React__default.Fragment, null,
|
|
3811
|
+
React__default.createElement(StyledIsQuestionWrapper, { className: `${error && (error === null || error === void 0 ? void 0 : error.description) ? 'error-description' : ''}` },
|
|
3812
|
+
React__default.createElement(StyledIsQuestion, { color: theme.colors.primaryBase },
|
|
3813
|
+
React__default.createElement("div", { className: "switch-label" },
|
|
3814
|
+
React__default.createElement(Ask, { isMarryBaby: isMarryBaby, size: isMarryBaby ? 32 : 24, color: theme.colors.primaryBase, className: "label-icon" }),
|
|
3815
|
+
React__default.createElement("div", { className: "wrapper-text" },
|
|
3816
|
+
React__default.createElement("div", { className: "label-txt" }, t('createPost.askDoctor.description')))),
|
|
3817
|
+
React__default.createElement(Switch, { checked: isAskDoctor, label: "", className: "switch-btn", size: "md", onChange: (v) => {
|
|
3818
|
+
setIsAskDoctor(v.target.checked);
|
|
3819
|
+
} }))),
|
|
3820
|
+
error && (error === null || error === void 0 ? void 0 : error.description) && (React__default.createElement(StyledError, { style: { margin: '4px 0 0' } },
|
|
3821
|
+
React__default.createElement(Text, { size: "p5", as: "span", color: theme.colors.red600 }, error.description)))) })),
|
|
3822
|
+
stepPost === 'step_community' && (React__default.createElement(CreatePostCommunity, { communitiesList: communitiesList, currentCommunity: currentCommunity, selectedTopics: selectedTopics, communityValue: communityValue, defaultCommunity: forceSelectCommunity, error: error, isFullscreen: false, isMarryBaby: isMarryBaby, isInEditMode: isInEditMode, isLoadingSuggest: isLoadingSuggest, setSelectedTopics: setSelectedTopics, setCommunityValue: setCommunityValue, removeKeyError: removeKeyError, setStepPost: setStepPost, onSubmitPost: submitPost })),
|
|
3823
|
+
imageSrcs.length > 0 && (React__default.createElement(PostPhotosReview, { imageFiles: imageFiles, error: error, indexImageError: indexImageError, setIndexImageError: setIndexImageError, setImageFiles: setImageFiles, removeKeyError: removeKeyError })))),
|
|
3824
|
+
React__default.createElement(StyleActionFooter, null,
|
|
3825
|
+
React__default.createElement(CreatePostPhotos, { imageFiles: imageFiles, setImageFiles: (data) => {
|
|
3826
|
+
setImageFiles(data);
|
|
3827
|
+
validationUploadPhoto(data);
|
|
3828
|
+
} }),
|
|
3829
|
+
React__default.createElement("div", null,
|
|
3830
|
+
React__default.createElement(Button, { className: "submit-btn pointer-event-child-none", size: "lg", "data-event-category": "Ask Doctor", "data-event-action": "Submit Question", "data-event-label": window.location.href, onClick: onSubmitContinuePost, loading: isLoadingSuggest, disabled: isLoadingSuggest }, t('onboarding.button.continue'))))));
|
|
3831
|
+
};
|
|
3832
|
+
|
|
3833
|
+
const StyledTopicSelectList = styled.div `
|
|
3834
|
+
display: flex;
|
|
3835
|
+
width: 100%;
|
|
3836
|
+
flex-wrap: wrap;
|
|
3837
|
+
margin-top: 1rem;
|
|
3838
|
+
|
|
3839
|
+
.tag-item {
|
|
3840
|
+
min-height: 32px;
|
|
3841
|
+
padding: 5px 12px;
|
|
3842
|
+
border: 1px solid ${theme.colors.neutral100};
|
|
3843
|
+
margin-right: 1rem;
|
|
3844
|
+
margin-bottom: 8px;
|
|
3845
|
+
border-radius: 1rem;
|
|
3846
|
+
color: ${theme.colors.gray800};
|
|
3847
|
+
cursor: pointer;
|
|
3848
|
+
font-size: 13px;
|
|
3849
|
+
line-height: 22px;
|
|
3850
|
+
transition: all 0.2s;
|
|
3851
|
+
|
|
3852
|
+
&.--active {
|
|
3853
|
+
border-color: ${theme.colors.primary50};
|
|
3854
|
+
background: ${theme.colors.primary50};
|
|
3855
|
+
color: ${theme.colors.primaryBase};
|
|
3856
|
+
}
|
|
3857
|
+
&[data-disabled='true'] {
|
|
3858
|
+
background: ${theme.colors.gray100};
|
|
3859
|
+
color: ${theme.colors.gray800};
|
|
3860
|
+
}
|
|
3861
|
+
}
|
|
3862
|
+
.topic-spinner {
|
|
3863
|
+
margin-right: auto;
|
|
3864
|
+
margin-left: auto;
|
|
3865
|
+
& > button {
|
|
3866
|
+
width: 24px;
|
|
3867
|
+
height: 24px;
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
&[data-is-marrybaby='true'] {
|
|
3871
|
+
.tag-item {
|
|
3872
|
+
border-color: transparent;
|
|
3873
|
+
background: #f3f3f3;
|
|
3874
|
+
color: #3e3f58;
|
|
3875
|
+
&.--active {
|
|
3876
|
+
border-color: #b6cdff;
|
|
3877
|
+
background: #e0e9fb;
|
|
3878
|
+
color: #3e3f58;
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
`;
|
|
3883
|
+
|
|
3884
|
+
const TopicSelectList = ({ className, style, topics: topicsProp, communityId, onChange, isLoading, disabled, forceTopics, selectedTopics: selectedTopicsProp, noFetch, dataEventCategory, dataEventAction, dataEventLabel, }) => {
|
|
3885
|
+
const { data: { locale, env: { isMarryBaby }, }, } = useContext(TogetherComponentGlobalContext);
|
|
3886
|
+
const [topics, setTopics] = useState(topicsProp ? [...topicsProp] : []);
|
|
3887
|
+
const [selectedTopics, setSelectedTopics] = useState(selectedTopicsProp ? [...selectedTopicsProp] : []);
|
|
3888
|
+
const [isLoadingTopics, setIsLoadingTopics] = useState(false);
|
|
3889
|
+
const topicsPropRef = useRef(topicsProp);
|
|
3890
|
+
topicsPropRef.current = topicsProp;
|
|
3891
|
+
useEffect(() => {
|
|
3892
|
+
var _a;
|
|
3893
|
+
if (communityId && !noFetch && !((_a = topicsPropRef.current) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
3894
|
+
setTopics([]);
|
|
3895
|
+
setIsLoadingTopics(true);
|
|
3896
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
3897
|
+
var _b;
|
|
3898
|
+
try {
|
|
3899
|
+
const res = yield callApi(getApiPath(PATHS.TOPIC.LIST, {
|
|
3900
|
+
communityId: communityId,
|
|
3901
|
+
_locale: locale,
|
|
3902
|
+
}), 'GET');
|
|
3903
|
+
const topicRes = (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.topics;
|
|
3904
|
+
if (Array.isArray(topicRes)) {
|
|
3905
|
+
setTopics(() => (topicRes === null || topicRes === void 0 ? void 0 : topicRes.map(formatTopic).sort((t1, t2) => (t1.order || 0) - (t2.order || 0))) || []);
|
|
3906
|
+
}
|
|
3907
|
+
}
|
|
3908
|
+
catch (e) {
|
|
3909
|
+
console.log(e);
|
|
3910
|
+
setIsLoadingTopics(false);
|
|
3911
|
+
}
|
|
3912
|
+
setIsLoadingTopics(false);
|
|
3913
|
+
}))();
|
|
3914
|
+
}
|
|
3915
|
+
}, [communityId, noFetch]);
|
|
3916
|
+
const topicsPropString = topicsProp === null || topicsProp === void 0 ? void 0 : topicsProp.map((t) => t.id).join('-');
|
|
3917
|
+
const topicsStateString = topics === null || topics === void 0 ? void 0 : topics.map((t) => t.id).join('-');
|
|
3918
|
+
const forceTopicsPropString = forceTopics === null || forceTopics === void 0 ? void 0 : forceTopics.map((t) => t.id).join('-');
|
|
3919
|
+
useEffect(() => {
|
|
3920
|
+
if (topicsProp &&
|
|
3921
|
+
typeof topicsPropString !== 'undefined' &&
|
|
3922
|
+
topicsPropString !== topicsStateString) {
|
|
3923
|
+
setTopics(topicsProp);
|
|
3924
|
+
}
|
|
3925
|
+
}, [topicsProp, topicsPropString, topicsStateString]);
|
|
3926
|
+
const topicsWithoutForced = useMemo(() => topics.filter((t) => !(forceTopics === null || forceTopics === void 0 ? void 0 : forceTopics.some((ft) => (ft.id && ft.id === t.id) ||
|
|
3927
|
+
(ft.mappedCategoryId &&
|
|
3928
|
+
ft.mappedCategoryId === t.mappedCategoryId)))), [topicsStateString, forceTopicsPropString]);
|
|
3929
|
+
return (React__default.createElement(StyledTopicSelectList, { "data-is-marrybaby": isMarryBaby, className: className, style: style },
|
|
3930
|
+
forceTopics.map((topic) => (React__default.createElement(TopicItem, { key: `${topic.id}-${topic.mappedCategoryId}`, topic: topic, disabled: true, selected: true, dataEventAction: dataEventAction, dataEventCategory: dataEventCategory, dataEventLabel: dataEventLabel }))),
|
|
3931
|
+
topicsWithoutForced.map((topic) => (React__default.createElement(TopicItem, { key: `${topic.id}-${topic.mappedCategoryId}`, topic: topic, disabled: disabled, selected: (selectedTopicsProp || selectedTopics).some((t) => (t.id && t.id === topic.id) ||
|
|
3932
|
+
(t.mappedCategoryId &&
|
|
3933
|
+
t.mappedCategoryId === topic.mappedCategoryId)), onClick: () => {
|
|
3934
|
+
const _selected = selectedTopicsProp || selectedTopics;
|
|
3935
|
+
const foundIndex = _selected.findIndex((_selected) => (_selected.id && _selected.id === topic.id) ||
|
|
3936
|
+
(_selected.mappedCategoryId &&
|
|
3937
|
+
_selected.mappedCategoryId === topic.mappedCategoryId));
|
|
3938
|
+
if (foundIndex !== -1) {
|
|
3939
|
+
_selected.splice(foundIndex, 1);
|
|
3940
|
+
}
|
|
3941
|
+
else {
|
|
3942
|
+
_selected.push(topic);
|
|
3943
|
+
}
|
|
3944
|
+
if (onChange && selectedTopicsProp) {
|
|
3945
|
+
onChange(_selected.slice());
|
|
3946
|
+
}
|
|
3947
|
+
else {
|
|
3948
|
+
onChange && onChange(_selected.slice());
|
|
3949
|
+
setSelectedTopics(_selected.slice());
|
|
3950
|
+
}
|
|
3951
|
+
}, dataEventAction: dataEventAction, dataEventCategory: dataEventCategory, dataEventLabel: dataEventLabel }))),
|
|
3952
|
+
(isLoading || isLoadingTopics) && React__default.createElement(Loading$1, { className: "topic-spinner" })));
|
|
3953
|
+
};
|
|
3954
|
+
const TopicItem = (_a) => {
|
|
3955
|
+
var { topic, disabled, selected, onClick } = _a, rest = __rest(_a, ["topic", "disabled", "selected", "onClick"]);
|
|
3956
|
+
return (React__default.createElement("div", Object.assign({ className: 'tag-item' + (selected ? ' --active' : ''), "data-disabled": disabled, onClick: !disabled ? onClick : undefined }, rest), topic.name));
|
|
3957
|
+
};
|
|
3958
|
+
|
|
3959
|
+
var styles = {"skipBtn":"KsWg8i6","alertHeading":"_9tS0EUN","alertDesc":"kyyRKlb","alertAction":"-Uqqka-"};
|
|
3960
|
+
|
|
3961
|
+
const SkipQuestionOfExpertBtn = (_a) => {
|
|
3962
|
+
var { post, onSkip, btnText, currentPageUrl } = _a, rest = __rest(_a, ["post", "onSkip", "btnText", "currentPageUrl"]);
|
|
3963
|
+
const { t } = useTranslations();
|
|
3964
|
+
const { data: { locale }, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
3965
|
+
const [showAlert, setShowAlert] = useState(false);
|
|
3966
|
+
const [loading, setLoading] = useState(false);
|
|
3967
|
+
const _theme = useMantineTheme();
|
|
3968
|
+
const handleSkip = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
3969
|
+
var _b;
|
|
3970
|
+
setLoading(true);
|
|
3971
|
+
const res = yield callApiWithAuth(getApiPath(PATHS.USER.SKIP_QUESTION, {
|
|
3972
|
+
_locale: locale,
|
|
3973
|
+
id: post === null || post === void 0 ? void 0 : post.id,
|
|
3974
|
+
}), 'PUT');
|
|
3975
|
+
if ((res === null || res === void 0 ? void 0 : res.status) === 1) {
|
|
3976
|
+
onSkip === null || onSkip === void 0 ? void 0 : onSkip({ id: (post === null || post === void 0 ? void 0 : post.id) || '', communityId: ((_b = post === null || post === void 0 ? void 0 : post.community) === null || _b === void 0 ? void 0 : _b.id) || '' });
|
|
3977
|
+
setShowAlert(false);
|
|
3978
|
+
pushNotifications({
|
|
3979
|
+
title: '',
|
|
3980
|
+
message: 'Skip success',
|
|
3981
|
+
type: 'success',
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
else {
|
|
3985
|
+
pushNotifications({
|
|
3986
|
+
title: '',
|
|
3987
|
+
message: res === null || res === void 0 ? void 0 : res.messages,
|
|
3988
|
+
type: 'danger',
|
|
3989
|
+
});
|
|
3990
|
+
}
|
|
3991
|
+
setLoading(false);
|
|
3992
|
+
}), []);
|
|
3993
|
+
return (React__default.createElement(Popover, { width: 327, withArrow: true, shadow: "md", opened: showAlert },
|
|
3994
|
+
React__default.createElement(Popover.Target, null,
|
|
3995
|
+
React__default.createElement("div", Object.assign({ className: `${styles.skipBtn} ${(rest === null || rest === void 0 ? void 0 : rest.className) || ''}`, onClick: () => setShowAlert(true) }, rest), btnText || t('profilePanel.questionNotClear'))),
|
|
3996
|
+
React__default.createElement(Popover.Dropdown, null,
|
|
3997
|
+
React__default.createElement("div", null,
|
|
3998
|
+
React__default.createElement("div", { className: styles.alertHeading }, t('profilePanel.skipQuestion.heading')),
|
|
3999
|
+
React__default.createElement("div", { className: styles.alertDesc }, t('profilePanel.skipQuestion.content')),
|
|
4000
|
+
React__default.createElement("div", { className: styles.alertAction },
|
|
4001
|
+
React__default.createElement(Button, { size: "md", variant: "secondary", leftIcon: React__default.createElement(Close, { color: _theme.fn.primaryColor(), size: 24 }), onClick: () => setShowAlert(false), styles: () => ({
|
|
4002
|
+
leftIcon: {
|
|
4003
|
+
marginRight: 0,
|
|
4004
|
+
},
|
|
4005
|
+
}) }),
|
|
4006
|
+
React__default.createElement(Button, { variant: "primary", size: "md", leftIcon: React__default.createElement(Check, { color: 'white', size: 24 }), onClick: handleSkip, loading: loading, "data-event-category": "Together", "data-event-action": "Unclear Question Click", "data-event-label": currentPageUrl, styles: () => ({
|
|
4007
|
+
leftIcon: {
|
|
4008
|
+
marginRight: 0,
|
|
4009
|
+
},
|
|
4010
|
+
}) }))))));
|
|
4011
|
+
};
|
|
4012
|
+
|
|
4013
|
+
export { CreateNewPostContent as C, SkipQuestionOfExpertBtn as S, TopicSelectList as T, CreateNewPostContentV2 as a, CreatePostDescription$1 as b, CreatePostTitle$1 as c };
|