@selfcommunity/react-ui 0.10.5-payments.168 → 0.10.5-payments.175
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/lib/cjs/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/cjs/components/BuyButton/BuyButton.js +4 -4
- package/lib/cjs/components/CategoryFollowButton/CategoryFollowButton.js +1 -0
- package/lib/cjs/components/Course/Course.js +17 -6
- package/lib/cjs/components/CourseContentMenu/CourseContentMenu.d.ts +5 -0
- package/lib/cjs/components/CourseContentMenu/CourseContentMenu.js +2 -2
- package/lib/cjs/components/CourseDashboard/Header.js +13 -25
- package/lib/cjs/components/CourseDashboard/Student.js +41 -15
- package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +9 -7
- package/lib/cjs/components/CourseDashboard/Teacher/Students.d.ts +2 -1
- package/lib/cjs/components/CourseDashboard/Teacher/Students.js +7 -3
- package/lib/cjs/components/CourseDashboard/Teacher.js +3 -2
- package/lib/cjs/components/CourseForm/CourseForm.d.ts +5 -0
- package/lib/cjs/components/CourseForm/CourseForm.js +57 -31
- package/lib/cjs/components/CourseForm/Edit.js +7 -3
- package/lib/cjs/components/CourseForm/UploadCourseCover.d.ts +3 -8
- package/lib/cjs/components/CourseForm/UploadCourseCover.js +3 -38
- package/lib/cjs/components/CourseFormDialog/CourseFormDialog.js +12 -2
- package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.js +9 -7
- package/lib/cjs/components/Courses/Courses.d.ts +0 -1
- package/lib/cjs/components/Courses/Courses.js +31 -30
- package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
- package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +8 -4
- package/lib/cjs/components/CreatePaymentProductForm/CreatePaymentProductForm.js +49 -13
- package/lib/cjs/components/EditCourse/Customize.js +2 -2
- package/lib/cjs/components/EditCourse/EditCourse.js +29 -27
- package/lib/cjs/components/EditCourse/Lessons/LessonRow.d.ts +4 -4
- package/lib/cjs/components/EditCourse/Lessons/LessonRow.js +14 -23
- package/lib/cjs/components/EditCourse/Lessons/SectionRow.d.ts +4 -4
- package/lib/cjs/components/EditCourse/Lessons/SectionRow.js +16 -16
- package/lib/cjs/components/EditCourse/Lessons/Skeleton.js +1 -2
- package/lib/cjs/components/EditCourse/Lessons.d.ts +3 -1
- package/lib/cjs/components/EditCourse/Lessons.js +56 -34
- package/lib/cjs/components/EditCourse/Options.js +3 -2
- package/lib/cjs/components/EditCourse/Requests.d.ts +5 -2
- package/lib/cjs/components/EditCourse/Requests.js +13 -8
- package/lib/cjs/components/EditCourse/Status.d.ts +3 -0
- package/lib/cjs/components/EditCourse/Status.js +18 -9
- package/lib/cjs/components/EditCourse/Users.d.ts +3 -1
- package/lib/cjs/components/EditCourse/Users.js +32 -11
- package/lib/cjs/components/EditCourse/hooks.d.ts +1 -1
- package/lib/cjs/components/EditCourse/hooks.js +3 -3
- package/lib/cjs/components/EditCourse/types.d.ts +14 -0
- package/lib/cjs/components/EditCourse/types.js +6 -1
- package/lib/cjs/components/Editor/Editor.d.ts +5 -0
- package/lib/cjs/components/Editor/Editor.js +3 -3
- package/lib/cjs/components/Editor/plugins/EmojiPlugin.d.ts +3 -1
- package/lib/cjs/components/Editor/plugins/EmojiPlugin.js +4 -10
- package/lib/cjs/components/EventForm/EventForm.js +10 -6
- package/lib/cjs/components/EventFormDialog/EventFormDialog.d.ts +1 -1
- package/lib/cjs/components/EventFormDialog/EventFormDialog.js +9 -3
- package/lib/cjs/components/GroupForm/GroupForm.js +15 -9
- package/lib/cjs/components/LessonCommentObject/LessonCommentObject.js +2 -7
- package/lib/cjs/components/LessonCommentObjects/LessonCommentObjects.js +14 -5
- package/lib/cjs/components/LessonDrawer/LessonDrawer.d.ts +5 -0
- package/lib/cjs/components/LessonDrawer/LessonDrawer.js +2 -2
- package/lib/cjs/components/LessonObject/LessonObject.js +6 -1
- package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.js +41 -11
- package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerContent.js +1 -1
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/cjs/components/Notification/Course/Course.d.ts +15 -0
- package/lib/cjs/components/Notification/Course/Course.js +89 -0
- package/lib/cjs/components/Notification/Course/index.d.ts +3 -0
- package/lib/cjs/components/Notification/Course/index.js +5 -0
- package/lib/cjs/components/Notification/Course/utils.d.ts +5 -0
- package/lib/cjs/components/Notification/Course/utils.js +44 -0
- package/lib/cjs/components/Notification/Event/Event.js +10 -0
- package/lib/cjs/components/Notification/Notification.js +9 -0
- package/lib/cjs/components/PaywallsConfigurator/PaywallsConfigurator.js +42 -129
- package/lib/cjs/components/SnippetNotifications/SnippetNotifications.js +9 -0
- package/lib/cjs/components/ToastNotifications/ToastNotifications.js +9 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/UserAddPaymentMethodDialog.d.ts +41 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/UserAddPaymentMethodDialog.js +94 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/constants.d.ts +1 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/constants.js +4 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/index.d.ts +3 -0
- package/lib/cjs/components/UserAddPaymentMethodDialog/index.js +5 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/UserAddPaymentMethodForm.d.ts +40 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/UserAddPaymentMethodForm.js +143 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/constants.d.ts +1 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/constants.js +4 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/index.d.ts +3 -0
- package/lib/cjs/components/UserAddPaymentMethodForm/index.js +5 -0
- package/lib/cjs/components/UserBillingInfo/Skeleton.d.ts +25 -0
- package/lib/cjs/components/UserBillingInfo/Skeleton.js +14 -0
- package/lib/cjs/components/UserBillingInfo/UserBillingInfo.d.ts +35 -0
- package/lib/cjs/components/UserBillingInfo/UserBillingInfo.js +492 -0
- package/lib/cjs/components/UserBillingInfo/constants.d.ts +1 -0
- package/lib/cjs/components/UserBillingInfo/constants.js +4 -0
- package/lib/cjs/components/UserBillingInfo/index.d.ts +4 -0
- package/lib/cjs/components/UserBillingInfo/index.js +8 -0
- package/lib/cjs/components/UserBillingInfo/reducer.d.ts +77 -0
- package/lib/cjs/components/UserBillingInfo/reducer.js +96 -0
- package/lib/cjs/components/UserChangeAddressDialog/UserChangeAddressDialog.d.ts +44 -0
- package/lib/cjs/components/UserChangeAddressDialog/UserChangeAddressDialog.js +85 -0
- package/lib/cjs/components/UserChangeAddressDialog/constants.d.ts +1 -0
- package/lib/cjs/components/UserChangeAddressDialog/constants.js +4 -0
- package/lib/cjs/components/UserChangeAddressDialog/index.d.ts +3 -0
- package/lib/cjs/components/UserChangeAddressDialog/index.js +5 -0
- package/lib/cjs/components/UserPaymentMethods/Skeleton.d.ts +15 -22
- package/lib/cjs/components/UserPaymentMethods/Skeleton.js +17 -4
- package/lib/cjs/components/UserPaymentMethods/UserPaymentMethods.d.ts +6 -31
- package/lib/cjs/components/UserPaymentMethods/UserPaymentMethods.js +264 -29
- package/lib/cjs/components/UserPaymentMethodsPortal/Skeleton.d.ts +22 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/Skeleton.js +38 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/UserPaymentMethodsPortal.d.ts +44 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/UserPaymentMethodsPortal.js +104 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/constants.d.ts +1 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/constants.js +4 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/index.d.ts +4 -0
- package/lib/cjs/components/UserPaymentMethodsPortal/index.js +8 -0
- package/lib/cjs/constants/Billing.d.ts +10 -0
- package/lib/cjs/constants/Billing.js +60 -0
- package/lib/cjs/constants/Country.d.ts +5 -0
- package/lib/cjs/constants/Country.js +271 -0
- package/lib/cjs/constants/Course.d.ts +1 -1
- package/lib/cjs/constants/Course.js +1 -1
- package/lib/cjs/constants/Payments.d.ts +4 -0
- package/lib/cjs/constants/Payments.js +7 -0
- package/lib/cjs/constants/PubSub.d.ts +3 -1
- package/lib/cjs/constants/PubSub.js +2 -0
- package/lib/cjs/index.d.ts +8 -2
- package/lib/cjs/index.js +23 -9
- package/lib/cjs/shared/AccordionLessons/AccordionLessons.d.ts +2 -1
- package/lib/cjs/shared/AccordionLessons/AccordionLessons.js +20 -4
- package/lib/cjs/shared/AddUsersButton/AddUsersButton.d.ts +0 -5
- package/lib/cjs/shared/AddUsersButton/AddUsersButton.js +9 -8
- package/lib/cjs/shared/CourseTypePopover/CourseTypePopover.d.ts +9 -0
- package/lib/cjs/shared/CourseTypePopover/CourseTypePopover.js +48 -0
- package/lib/cjs/shared/CourseTypePopover/index.d.ts +3 -0
- package/lib/cjs/shared/CourseTypePopover/index.js +5 -0
- package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.d.ts +5 -1
- package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +82 -32
- package/lib/cjs/shared/CourseUsersTable/RemoveButton.d.ts +10 -0
- package/lib/cjs/shared/CourseUsersTable/RemoveButton.js +51 -0
- package/lib/cjs/shared/CourseUsersTable/RequestButton.d.ts +3 -2
- package/lib/cjs/shared/CourseUsersTable/RequestButton.js +14 -10
- package/lib/cjs/shared/CourseUsersTable/SeeProgressButton.js +4 -1
- package/lib/cjs/types/course.d.ts +20 -0
- package/lib/cjs/types/course.js +7 -1
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.js +5 -1
- package/lib/cjs/types/payment.d.ts +25 -0
- package/lib/cjs/types/payment.js +29 -0
- package/lib/cjs/utils/address.d.ts +10 -0
- package/lib/cjs/utils/address.js +24 -0
- package/lib/cjs/utils/course.d.ts +4 -6
- package/lib/cjs/utils/course.js +13 -15
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/esm/components/BuyButton/BuyButton.js +4 -4
- package/lib/esm/components/CategoryFollowButton/CategoryFollowButton.js +1 -0
- package/lib/esm/components/Course/Course.js +18 -7
- package/lib/esm/components/CourseContentMenu/CourseContentMenu.d.ts +5 -0
- package/lib/esm/components/CourseContentMenu/CourseContentMenu.js +2 -2
- package/lib/esm/components/CourseDashboard/Header.js +13 -26
- package/lib/esm/components/CourseDashboard/Student.js +42 -16
- package/lib/esm/components/CourseDashboard/Teacher/Comments.js +10 -8
- package/lib/esm/components/CourseDashboard/Teacher/Students.d.ts +2 -1
- package/lib/esm/components/CourseDashboard/Teacher/Students.js +8 -4
- package/lib/esm/components/CourseDashboard/Teacher.js +3 -2
- package/lib/esm/components/CourseForm/CourseForm.d.ts +5 -0
- package/lib/esm/components/CourseForm/CourseForm.js +62 -36
- package/lib/esm/components/CourseForm/Edit.js +8 -4
- package/lib/esm/components/CourseForm/UploadCourseCover.d.ts +3 -8
- package/lib/esm/components/CourseForm/UploadCourseCover.js +4 -39
- package/lib/esm/components/CourseFormDialog/CourseFormDialog.js +13 -3
- package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.js +9 -7
- package/lib/esm/components/Courses/Courses.d.ts +0 -1
- package/lib/esm/components/Courses/Courses.js +31 -30
- package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
- package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +8 -4
- package/lib/esm/components/CreatePaymentProductForm/CreatePaymentProductForm.js +51 -15
- package/lib/esm/components/EditCourse/Customize.js +2 -2
- package/lib/esm/components/EditCourse/EditCourse.js +30 -28
- package/lib/esm/components/EditCourse/Lessons/LessonRow.d.ts +4 -4
- package/lib/esm/components/EditCourse/Lessons/LessonRow.js +16 -25
- package/lib/esm/components/EditCourse/Lessons/SectionRow.d.ts +4 -4
- package/lib/esm/components/EditCourse/Lessons/SectionRow.js +21 -21
- package/lib/esm/components/EditCourse/Lessons/Skeleton.js +2 -3
- package/lib/esm/components/EditCourse/Lessons.d.ts +3 -1
- package/lib/esm/components/EditCourse/Lessons.js +53 -31
- package/lib/esm/components/EditCourse/Options.js +5 -4
- package/lib/esm/components/EditCourse/Requests.d.ts +5 -2
- package/lib/esm/components/EditCourse/Requests.js +15 -10
- package/lib/esm/components/EditCourse/Status.d.ts +3 -0
- package/lib/esm/components/EditCourse/Status.js +18 -10
- package/lib/esm/components/EditCourse/Users.d.ts +3 -1
- package/lib/esm/components/EditCourse/Users.js +33 -12
- package/lib/esm/components/EditCourse/hooks.d.ts +1 -1
- package/lib/esm/components/EditCourse/hooks.js +1 -1
- package/lib/esm/components/EditCourse/types.d.ts +14 -0
- package/lib/esm/components/EditCourse/types.js +5 -0
- package/lib/esm/components/Editor/Editor.d.ts +5 -0
- package/lib/esm/components/Editor/Editor.js +4 -4
- package/lib/esm/components/Editor/plugins/EmojiPlugin.d.ts +3 -1
- package/lib/esm/components/Editor/plugins/EmojiPlugin.js +4 -10
- package/lib/esm/components/EventForm/EventForm.js +10 -6
- package/lib/esm/components/EventFormDialog/EventFormDialog.d.ts +1 -1
- package/lib/esm/components/EventFormDialog/EventFormDialog.js +9 -3
- package/lib/esm/components/GroupForm/GroupForm.js +15 -9
- package/lib/esm/components/LessonCommentObject/LessonCommentObject.js +2 -7
- package/lib/esm/components/LessonCommentObjects/LessonCommentObjects.js +16 -7
- package/lib/esm/components/LessonDrawer/LessonDrawer.d.ts +5 -0
- package/lib/esm/components/LessonDrawer/LessonDrawer.js +2 -2
- package/lib/esm/components/LessonObject/LessonObject.js +7 -2
- package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.js +42 -12
- package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerContent.js +1 -1
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/esm/components/Notification/Course/Course.d.ts +15 -0
- package/lib/esm/components/Notification/Course/Course.js +86 -0
- package/lib/esm/components/Notification/Course/index.d.ts +3 -0
- package/lib/esm/components/Notification/Course/index.js +2 -0
- package/lib/esm/components/Notification/Course/utils.d.ts +5 -0
- package/lib/esm/components/Notification/Course/utils.js +39 -0
- package/lib/esm/components/Notification/Event/Event.js +10 -0
- package/lib/esm/components/Notification/Notification.js +9 -0
- package/lib/esm/components/PaywallsConfigurator/PaywallsConfigurator.js +43 -130
- package/lib/esm/components/SnippetNotifications/SnippetNotifications.js +9 -0
- package/lib/esm/components/ToastNotifications/ToastNotifications.js +9 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/UserAddPaymentMethodDialog.d.ts +41 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/UserAddPaymentMethodDialog.js +91 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/constants.d.ts +1 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/constants.js +1 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/index.d.ts +3 -0
- package/lib/esm/components/UserAddPaymentMethodDialog/index.js +2 -0
- package/lib/esm/components/UserAddPaymentMethodForm/UserAddPaymentMethodForm.d.ts +40 -0
- package/lib/esm/components/UserAddPaymentMethodForm/UserAddPaymentMethodForm.js +140 -0
- package/lib/esm/components/UserAddPaymentMethodForm/constants.d.ts +1 -0
- package/lib/esm/components/UserAddPaymentMethodForm/constants.js +1 -0
- package/lib/esm/components/UserAddPaymentMethodForm/index.d.ts +3 -0
- package/lib/esm/components/UserAddPaymentMethodForm/index.js +2 -0
- package/lib/esm/components/UserBillingInfo/Skeleton.d.ts +25 -0
- package/lib/esm/components/UserBillingInfo/Skeleton.js +10 -0
- package/lib/esm/components/UserBillingInfo/UserBillingInfo.d.ts +35 -0
- package/lib/esm/components/UserBillingInfo/UserBillingInfo.js +490 -0
- package/lib/esm/components/UserBillingInfo/constants.d.ts +1 -0
- package/lib/esm/components/UserBillingInfo/constants.js +1 -0
- package/lib/esm/components/UserBillingInfo/index.d.ts +4 -0
- package/lib/esm/components/UserBillingInfo/index.js +4 -0
- package/lib/esm/components/UserBillingInfo/reducer.d.ts +77 -0
- package/lib/esm/components/UserBillingInfo/reducer.js +91 -0
- package/lib/esm/components/UserChangeAddressDialog/UserChangeAddressDialog.d.ts +44 -0
- package/lib/esm/components/UserChangeAddressDialog/UserChangeAddressDialog.js +82 -0
- package/lib/esm/components/UserChangeAddressDialog/constants.d.ts +1 -0
- package/lib/esm/components/UserChangeAddressDialog/constants.js +1 -0
- package/lib/esm/components/UserChangeAddressDialog/index.d.ts +3 -0
- package/lib/esm/components/UserChangeAddressDialog/index.js +2 -0
- package/lib/esm/components/UserPaymentMethods/Skeleton.d.ts +15 -22
- package/lib/esm/components/UserPaymentMethods/Skeleton.js +19 -6
- package/lib/esm/components/UserPaymentMethods/UserPaymentMethods.d.ts +6 -31
- package/lib/esm/components/UserPaymentMethods/UserPaymentMethods.js +268 -32
- package/lib/esm/components/UserPaymentMethodsPortal/Skeleton.d.ts +22 -0
- package/lib/esm/components/UserPaymentMethodsPortal/Skeleton.js +36 -0
- package/lib/esm/components/UserPaymentMethodsPortal/UserPaymentMethodsPortal.d.ts +44 -0
- package/lib/esm/components/UserPaymentMethodsPortal/UserPaymentMethodsPortal.js +101 -0
- package/lib/esm/components/UserPaymentMethodsPortal/constants.d.ts +1 -0
- package/lib/esm/components/UserPaymentMethodsPortal/constants.js +1 -0
- package/lib/esm/components/UserPaymentMethodsPortal/index.d.ts +4 -0
- package/lib/esm/components/UserPaymentMethodsPortal/index.js +4 -0
- package/lib/esm/constants/Billing.d.ts +10 -0
- package/lib/esm/constants/Billing.js +57 -0
- package/lib/esm/constants/Country.d.ts +5 -0
- package/lib/esm/constants/Country.js +268 -0
- package/lib/esm/constants/Course.d.ts +1 -1
- package/lib/esm/constants/Course.js +1 -1
- package/lib/esm/constants/Payments.d.ts +4 -0
- package/lib/esm/constants/Payments.js +4 -0
- package/lib/esm/constants/PubSub.d.ts +3 -1
- package/lib/esm/constants/PubSub.js +2 -0
- package/lib/esm/index.d.ts +8 -2
- package/lib/esm/index.js +11 -5
- package/lib/esm/shared/AccordionLessons/AccordionLessons.d.ts +2 -1
- package/lib/esm/shared/AccordionLessons/AccordionLessons.js +24 -8
- package/lib/esm/shared/AddUsersButton/AddUsersButton.d.ts +0 -5
- package/lib/esm/shared/AddUsersButton/AddUsersButton.js +9 -8
- package/lib/esm/shared/CourseTypePopover/CourseTypePopover.d.ts +9 -0
- package/lib/esm/shared/CourseTypePopover/CourseTypePopover.js +45 -0
- package/lib/esm/shared/CourseTypePopover/index.d.ts +3 -0
- package/lib/esm/shared/CourseTypePopover/index.js +2 -0
- package/lib/esm/shared/CourseUsersTable/CourseUsersTable.d.ts +5 -1
- package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +85 -35
- package/lib/esm/shared/CourseUsersTable/RemoveButton.d.ts +10 -0
- package/lib/esm/shared/CourseUsersTable/RemoveButton.js +48 -0
- package/lib/esm/shared/CourseUsersTable/RequestButton.d.ts +3 -2
- package/lib/esm/shared/CourseUsersTable/RequestButton.js +16 -12
- package/lib/esm/shared/CourseUsersTable/SeeProgressButton.js +4 -1
- package/lib/esm/types/course.d.ts +20 -0
- package/lib/esm/types/course.js +6 -0
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/esm/types/index.js +2 -1
- package/lib/esm/types/payment.d.ts +25 -0
- package/lib/esm/types/payment.js +26 -0
- package/lib/esm/utils/address.d.ts +10 -0
- package/lib/esm/utils/address.js +19 -0
- package/lib/esm/utils/course.d.ts +4 -6
- package/lib/esm/utils/course.js +11 -13
- package/lib/umd/465.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +9 -10
- package/lib/umd/401.js +0 -20
- /package/lib/umd/{401.js.LICENSE.txt → 465.js.LICENSE.txt} +0 -0
|
@@ -103,7 +103,7 @@ function BottomNavigation(inProps) {
|
|
|
103
103
|
((groupsEnabled && !eventsEnabled) || (!groupsEnabled && eventsEnabled)) &&
|
|
104
104
|
!exploreStreamEnabled ? ((0, jsx_runtime_1.jsx)(material_1.BottomNavigationAction, { className: (0, classnames_1.default)(classes.composer, classes.action), component: ComposerIconButton_1.default, disableRipple: true }, "composer")) : null,
|
|
105
105
|
coursesEnabled && (scUserContext.user || contentAvailable) ? ((0, jsx_runtime_1.jsx)(material_1.BottomNavigationAction, { className: classes.action, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSES_ROUTE_NAME, {}), value: scRoutingContext.url(react_core_1.SCRoutes.COURSES_ROUTE_NAME, {}), icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "courses" }) }, "courses")) : null,
|
|
106
|
-
groupsEnabled &&
|
|
106
|
+
groupsEnabled && scUserContext.user ? ((0, jsx_runtime_1.jsx)(material_1.BottomNavigationAction, { className: classes.action, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), value: scRoutingContext.url(react_core_1.SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "groups" }) }, "groups")) : null,
|
|
107
107
|
(!postOnlyStaffEnabled || (react_core_1.UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
|
|
108
108
|
groupsEnabled &&
|
|
109
109
|
eventsEnabled &&
|
|
@@ -122,8 +122,8 @@ function BuyButton(inProps) {
|
|
|
122
122
|
case types_1.SCContentType.CATEGORY:
|
|
123
123
|
// Get status category followed
|
|
124
124
|
api_services_1.CategoryApiClient.getSpecificCategory(contentId ? contentId : content.id).then((data) => {
|
|
125
|
-
if (data.followed) {
|
|
126
|
-
setBtnLabel((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.buyButton.
|
|
125
|
+
if (data.followed || data.payment_order) {
|
|
126
|
+
setBtnLabel((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.buyButton.purchased", id: "ui.buyButton.purchased" }));
|
|
127
127
|
}
|
|
128
128
|
if (data.paywalls) {
|
|
129
129
|
setProducts(data.paywalls);
|
|
@@ -131,7 +131,7 @@ function BuyButton(inProps) {
|
|
|
131
131
|
if (data.payment_order) {
|
|
132
132
|
setPaymentOrder(data.payment_order);
|
|
133
133
|
}
|
|
134
|
-
setPurchased(data.followed);
|
|
134
|
+
setPurchased(Boolean(data.followed || data.payment_order));
|
|
135
135
|
});
|
|
136
136
|
break;
|
|
137
137
|
case types_1.SCContentType.GROUP:
|
|
@@ -158,7 +158,7 @@ function BuyButton(inProps) {
|
|
|
158
158
|
var _a;
|
|
159
159
|
if (scUserContext.user && ((_a = data === null || data === void 0 ? void 0 : data.managed_by) === null || _a === void 0 ? void 0 : _a.id) !== scUserContext.user.id) {
|
|
160
160
|
if (data.subscription_status === types_1.SCCourseJoinStatusType.JOINED) {
|
|
161
|
-
setBtnLabel((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.buyButton.
|
|
161
|
+
setBtnLabel((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.buyButton.purchased", id: "ui.buyButton.purchased" }));
|
|
162
162
|
}
|
|
163
163
|
if (data.paywalls) {
|
|
164
164
|
setProducts(data.paywalls);
|
|
@@ -112,6 +112,7 @@ function CategoryFollowButton(inProps) {
|
|
|
112
112
|
scUserContext.user &&
|
|
113
113
|
isPaymentsEnabled &&
|
|
114
114
|
((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
115
|
+
!scCategory.payment_order &&
|
|
115
116
|
(!followed || scCategoriesManager.isLoading(scCategory))) {
|
|
116
117
|
return (0, jsx_runtime_1.jsx)(BuyButton_1.default, { contentType: types_1.SCContentType.CATEGORY, content: scCategory, disabled: disableBuyContentIfPaidContent });
|
|
117
118
|
}
|
|
@@ -110,6 +110,9 @@ function Course(inProps) {
|
|
|
110
110
|
const { id = `course_object_${props.courseId ? props.courseId : props.course ? props.course.id : ''}`, courseId = null, course = null, className = null, template = course_1.SCCourseTemplateType.PREVIEW, actions, CourseParticipantsButtonComponentProps = {}, CourseSkeletonComponentProps = {}, cacheStrategy, userProfileSnippet } = props, rest = tslib_1.__rest(props, ["id", "courseId", "course", "className", "template", "actions", "CourseParticipantsButtonComponentProps", "CourseSkeletonComponentProps", "cacheStrategy", "userProfileSnippet"]);
|
|
111
111
|
// STATE
|
|
112
112
|
const { scCourse } = (0, react_core_1.useSCFetchCourse)(Object.assign({ id: courseId, course }, (cacheStrategy && { cacheStrategy })));
|
|
113
|
+
const theme = (0, material_1.useTheme)();
|
|
114
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.between('xs', 'md'));
|
|
115
|
+
const MAX_VISIBLE_CATEGORIES = isMobile ? 3 : 1;
|
|
113
116
|
// CONTEXT
|
|
114
117
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
115
118
|
const isCourseAdmin = (0, react_1.useMemo)(() => scCourse && (scCourse.join_status === types_1.SCCourseJoinStatusType.CREATOR || scCourse.join_status === types_1.SCCourseJoinStatusType.MANAGER), [scCourse]);
|
|
@@ -137,6 +140,9 @@ function Course(inProps) {
|
|
|
137
140
|
else if ((0, course_2.isCourseCompleted)(scCourse)) {
|
|
138
141
|
return (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.course.status.completed", id: "ui.course.status.completed" });
|
|
139
142
|
}
|
|
143
|
+
else if (scCourse.join_status === types_1.SCCourseJoinStatusType.JOINED) {
|
|
144
|
+
return (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.course.status.joined", id: "ui.course.status.joined" });
|
|
145
|
+
}
|
|
140
146
|
else if ((0, course_2.isCourseNew)(scCourse)) {
|
|
141
147
|
return (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.course.status.new", id: "ui.course.status.new" });
|
|
142
148
|
}
|
|
@@ -147,24 +153,29 @@ function Course(inProps) {
|
|
|
147
153
|
*/
|
|
148
154
|
let contentObj;
|
|
149
155
|
if (template === course_1.SCCourseTemplateType.PREVIEW) {
|
|
150
|
-
contentObj = ((0, jsx_runtime_1.jsxs)(PreviewRoot, Object.assign({ className: classes.previewRoot }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.previewImageWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: scCourse.image_medium, alt: scCourse.name, className: classes.previewImage }), (isCourseAdmin || (0, course_2.isCourseCompleted)(scCourse) || (0, course_2.isCourseNew)(scCourse)) && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", color: (0, course_2.isCourseCompleted)(scCourse) || (isCourseAdmin && scCourse.privacy)
|
|
156
|
+
contentObj = ((0, jsx_runtime_1.jsxs)(PreviewRoot, Object.assign({ className: classes.previewRoot }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.previewImageWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: scCourse.image_medium, alt: scCourse.name, className: classes.previewImage }), (isCourseAdmin || (0, course_2.isCourseCompleted)(scCourse) || (0, course_2.isCourseNew)(scCourse) || scCourse.join_status === types_1.SCCourseJoinStatusType.JOINED) && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", color: (0, course_2.isCourseCompleted)(scCourse) || (isCourseAdmin && scCourse.privacy)
|
|
151
157
|
? 'primary'
|
|
152
158
|
: isCourseAdmin && !scCourse.privacy
|
|
153
159
|
? 'default'
|
|
154
|
-
:
|
|
160
|
+
: scCourse.join_status === types_1.SCCourseJoinStatusType.JOINED
|
|
161
|
+
? 'warning'
|
|
162
|
+
: 'secondary', label: chipLabel, className: classes.chip })), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!((_a = scCourse.created_by) === null || _a === void 0 ? void 0 : _a.deleted) && {
|
|
155
163
|
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
156
164
|
}), { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !((_b = scCourse.created_by) === null || _b === void 0 ? void 0 : _b.community_badge), smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scCourse.name, src: (_c = scCourse.created_by) === null || _c === void 0 ? void 0 : _c.avatar, className: classes.previewAvatar }) })) }))] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.previewContent }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ className: classes.previewCreator }, (!((_d = scCourse.created_by) === null || _d === void 0 ? void 0 : _d.deleted) && {
|
|
157
165
|
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
158
|
-
}), { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (_e = scCourse.created_by) === null || _e === void 0 ? void 0 : _e.username })) })), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse), className: classes.previewNameWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", className: classes.previewName }, { children: scCourse.name })) })), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.previewInfo }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }),
|
|
166
|
+
}), { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (_e = scCourse.created_by) === null || _e === void 0 ? void 0 : _e.username })) })), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse), className: classes.previewNameWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", className: classes.previewName }, { children: scCourse.name })) })), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.previewInfo }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.previewCategory }, { children: [scCourse.categories.slice(0, MAX_VISIBLE_CATEGORIES).map((category) => ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: category.name }, category.id))), scCourse.categories.length > MAX_VISIBLE_CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scCourse.categories.slice(MAX_VISIBLE_CATEGORIES).map((cat) => ((0, jsx_runtime_1.jsx)(material_1.Box, { children: cat.name }, cat.id))) }) }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: `+${scCourse.categories.length - MAX_VISIBLE_CATEGORIES}`, sx: { cursor: 'pointer' } }) })))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.previewProgress }, { children: renderProgress() }))] })), actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.previewActions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) })) })))] })));
|
|
159
167
|
}
|
|
160
168
|
else {
|
|
161
|
-
contentObj = ((0, jsx_runtime_1.jsx)(SnippetRoot, { elevation: 0, className: classes.snippetRoot, image: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.snippetImage }, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { variant: "square", alt: scCourse.name, src: scCourse.image_medium, className: userProfileSnippet ? classes.snippetAvatarUserProfile : classes.snippetAvatar }), !userProfileSnippet &&
|
|
169
|
+
contentObj = ((0, jsx_runtime_1.jsx)(SnippetRoot, { ButtonBaseProps: { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse) }, elevation: 0, className: classes.snippetRoot, image: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.snippetImage }, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { variant: "square", alt: scCourse.name, src: scCourse.image_medium, className: userProfileSnippet ? classes.snippetAvatarUserProfile : classes.snippetAvatar }), !userProfileSnippet &&
|
|
170
|
+
(isCourseAdmin || (0, course_2.isCourseCompleted)(scCourse) || (0, course_2.isCourseNew)(scCourse) || scCourse.join_status === types_1.SCCourseJoinStatusType.JOINED) && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", color: (0, course_2.isCourseCompleted)(scCourse) || (isCourseAdmin && scCourse.privacy)
|
|
162
171
|
? 'primary'
|
|
163
172
|
: isCourseAdmin && !scCourse.privacy
|
|
164
173
|
? 'default'
|
|
165
|
-
:
|
|
174
|
+
: scCourse.join_status === types_1.SCCourseJoinStatusType.JOINED
|
|
175
|
+
? 'warning'
|
|
176
|
+
: 'secondary', label: chipLabel, className: classes.chip }))] })), primary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!userProfileSnippet && ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!((_f = scCourse.created_by) === null || _f === void 0 ? void 0 : _f.deleted) && {
|
|
166
177
|
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
167
|
-
}), { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: (_g = scCourse.created_by) === null || _g === void 0 ? void 0 : _g.username })) }))), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: scCourse.name })) }))] }), secondary: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: userProfileSnippet ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !scCourse.hide_member_count && ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.userProfileSnippet.students", defaultMessage: "ui.course.userProfileSnippet.students", values: { students: scCourse.member_count } })) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }),
|
|
178
|
+
}), { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: (_g = scCourse.created_by) === null || _g === void 0 ? void 0 : _g.username })) }))), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: scCourse.name })) }))] }), secondary: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: userProfileSnippet ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !scCourse.hide_member_count && ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.userProfileSnippet.students", defaultMessage: "ui.course.userProfileSnippet.students", values: { students: scCourse.member_count } })) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` })] })) }), actions: actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) }))) }));
|
|
168
179
|
}
|
|
169
180
|
/**
|
|
170
181
|
* Renders root object
|
|
@@ -12,6 +12,11 @@ export interface CourseContentMenuProps {
|
|
|
12
12
|
* Callback fired on lesson item click
|
|
13
13
|
*/
|
|
14
14
|
onLessonClick: (lesson: SCCourseLessonType, section: SCCourseSectionType) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The preview mode
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
previewMode: boolean;
|
|
15
20
|
/**
|
|
16
21
|
* Any other properties
|
|
17
22
|
*/
|
|
@@ -29,7 +29,7 @@ function CourseContentMenu(inProps) {
|
|
|
29
29
|
props: inProps,
|
|
30
30
|
name: constants_1.PREFIX
|
|
31
31
|
});
|
|
32
|
-
const { className = null, lesson, course, onLessonClick } = props, rest = tslib_1.__rest(props, ["className", "lesson", "course", "onLessonClick"]);
|
|
32
|
+
const { className = null, lesson, course, onLessonClick, previewMode } = props, rest = tslib_1.__rest(props, ["className", "lesson", "course", "onLessonClick", "previewMode"]);
|
|
33
33
|
//STATE
|
|
34
34
|
const [expandedSections, setExpandedSections] = (0, react_1.useState)((lesson === null || lesson === void 0 ? void 0 : lesson.section_id) ? [lesson.section_id] : []);
|
|
35
35
|
//HANDLERS
|
|
@@ -42,6 +42,6 @@ function CourseContentMenu(inProps) {
|
|
|
42
42
|
if (!course) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: course.sections.map((section) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: () => handleToggle(section.id), className: classes.listItem, disableRipple: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, Object.assign({ className: classes.listItemIcon }, { children: expandedSections.includes(section.id) ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_less" }) : (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_more" }) })), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: section.name })] })), (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ in: expandedSections.includes(section.id), timeout: "auto", unmountOnExit: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ component: "div", disablePadding: true }, { children: section.lessons.map((_lesson) => ((0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ className: classes.item, onClick: () => onLessonClick(_lesson, section), selected: _lesson.
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: course.sections.map((section) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: () => handleToggle(section.id), className: classes.listItem, disableRipple: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, Object.assign({ className: classes.listItemIcon }, { children: expandedSections.includes(section.id) ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_less" }) : (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_more" }) })), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: section.name })] })), (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ in: expandedSections.includes(section.id), timeout: "auto", unmountOnExit: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ component: "div", disablePadding: true }, { children: section.lessons.map((_lesson) => ((0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ className: classes.item, onClick: () => onLessonClick(_lesson, section), selected: _lesson.id === lesson.id, disabled: _lesson.locked }, { children: [course.join_status !== types_1.SCCourseJoinStatusType.CREATOR && !previewMode && ((0, jsx_runtime_1.jsx)(material_1.ListItemIcon, Object.assign({ className: classes.itemIcon }, { children: _lesson.completion_status === types_1.SCCourseLessonCompletionStatusType.COMPLETED ? ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.iconComplete }, { children: "circle_checked" }))) : _lesson.locked ? ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" })) : ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.iconIncomplete }, { children: "fiber_manual_record" }))) }))), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: _lesson.name })] }), _lesson.id))) })) }))] }, section.id))) })));
|
|
46
46
|
}
|
|
47
47
|
exports.default = CourseContentMenu;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
5
|
const material_1 = require("@mui/material");
|
|
5
6
|
const types_1 = require("@selfcommunity/types");
|
|
@@ -8,12 +9,16 @@ const constants_1 = require("./constants");
|
|
|
8
9
|
const react_1 = require("react");
|
|
9
10
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
10
11
|
const types_2 = require("../../types");
|
|
12
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
13
|
+
const CourseTypePopover_1 = tslib_1.__importDefault(require("../../shared/CourseTypePopover"));
|
|
11
14
|
const classes = {
|
|
12
15
|
header: `${constants_1.PREFIX}-header`,
|
|
13
16
|
img: `${constants_1.PREFIX}-header-img`,
|
|
14
17
|
outerWrapper: `${constants_1.PREFIX}-header-outer-wrapper`,
|
|
15
18
|
innerWrapper: `${constants_1.PREFIX}-header-inner-wrapper`,
|
|
16
|
-
iconWrapper: `${constants_1.PREFIX}-header-icon-wrapper
|
|
19
|
+
iconWrapper: `${constants_1.PREFIX}-header-icon-wrapper`,
|
|
20
|
+
buttonPopover: `${constants_1.PREFIX}-header-button-popover`,
|
|
21
|
+
contrastColor: `${constants_1.PREFIX}-contrast-color`
|
|
17
22
|
};
|
|
18
23
|
function getUrlEditDashboard(course) {
|
|
19
24
|
return {
|
|
@@ -27,30 +32,13 @@ function HeaderCourseDashboard(props) {
|
|
|
27
32
|
const { course, hasAction = false } = props;
|
|
28
33
|
// CONTEXTS
|
|
29
34
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
30
|
-
//
|
|
35
|
+
// INTL
|
|
31
36
|
const intl = (0, react_intl_1.useIntl)();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
key: 'privacy',
|
|
39
|
-
underId: `ui.course.privacy.${underId}`
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: 'ui.course.type',
|
|
43
|
-
icon: 'courses',
|
|
44
|
-
key: 'typeOfCourse',
|
|
45
|
-
underId: `ui.course.type.${course.type}`
|
|
46
|
-
}
|
|
47
|
-
];
|
|
48
|
-
}, [course]);
|
|
49
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.header }, { children: [(0, jsx_runtime_1.jsx)("img", { src: course.image_bigger, alt: course.image_bigger, className: classes.img }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3" }, { children: course.name })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.outerWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.innerWrapper }, { children: iconData.map((data, i) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.iconWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: data.icon })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: data.id, defaultMessage: data.id, values: {
|
|
50
|
-
[`${data.key}`]: intl.formatMessage({
|
|
51
|
-
id: data.underId,
|
|
52
|
-
defaultMessage: data.underId
|
|
53
|
-
})
|
|
54
|
-
} }) }))] }), i))) })), hasAction && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_EDIT_ROUTE_NAME, getUrlEditDashboard(course)), size: "small", color: "primary", variant: "contained" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.teacher.btn.label", defaultMessage: "ui.course.dashboard.teacher.btn.label" }) })) })))] }))] })));
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.header }, { children: [(0, jsx_runtime_1.jsx)("img", { src: course.image_bigger, alt: course.image_bigger, className: classes.img }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3", className: classes.contrastColor }, { children: course.name })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.outerWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.innerWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: (0, classnames_1.default)(classes.iconWrapper, classes.contrastColor) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "public" })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.label", defaultMessage: "ui.course.label", values: {
|
|
38
|
+
privacy: intl.formatMessage({
|
|
39
|
+
id: `ui.course.privacy.${course.privacy === types_1.SCCoursePrivacyType.DRAFT ? 'draft' : course.privacy}`,
|
|
40
|
+
defaultMessage: `ui.course.privacy.${course.privacy === types_1.SCCoursePrivacyType.DRAFT ? 'draft' : course.privacy}`
|
|
41
|
+
})
|
|
42
|
+
} }) }))] })), (0, jsx_runtime_1.jsx)(CourseTypePopover_1.default, { course: course })] })), hasAction && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_EDIT_ROUTE_NAME, getUrlEditDashboard(course)), size: "small", color: "primary", variant: "contained" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.teacher.btn.label", defaultMessage: "ui.course.dashboard.teacher.btn.label" }) })) })))] }))] })));
|
|
55
43
|
}
|
|
56
44
|
exports.default = (0, react_1.memo)(HeaderCourseDashboard);
|
|
@@ -40,6 +40,7 @@ const classes = {
|
|
|
40
40
|
actionsWrapper: `${constants_1.PREFIX}-actions-wrapper`,
|
|
41
41
|
user: `${constants_1.PREFIX}-user`,
|
|
42
42
|
avatar: `${constants_1.PREFIX}-avatar`,
|
|
43
|
+
description: `${constants_1.PREFIX}-description`,
|
|
43
44
|
progress: `${constants_1.PREFIX}-progress`,
|
|
44
45
|
lessonsSections: `${constants_1.PREFIX}-lessons-sections`,
|
|
45
46
|
circle: `${constants_1.PREFIX}-circle`,
|
|
@@ -47,26 +48,29 @@ const classes = {
|
|
|
47
48
|
margin: `${constants_1.PREFIX}-margin`,
|
|
48
49
|
box: `${constants_1.PREFIX}-box`,
|
|
49
50
|
percentageWrapper: `${constants_1.PREFIX}-percentage-wrapper`,
|
|
50
|
-
completedWrapper: `${constants_1.PREFIX}-completed-wrapper
|
|
51
|
+
completedWrapper: `${constants_1.PREFIX}-completed-wrapper`,
|
|
52
|
+
contrastColor: `${constants_1.PREFIX}-contrast-color`
|
|
51
53
|
};
|
|
52
54
|
function getUrlNextLesson(course) {
|
|
55
|
+
var _a, _b, _c;
|
|
53
56
|
const data = {
|
|
54
57
|
id: course.id,
|
|
55
58
|
slug: course.slug
|
|
56
59
|
};
|
|
57
60
|
if (course.user_completion_rate === 100) {
|
|
58
61
|
Object.assign(data, {
|
|
59
|
-
section_id: course.sections[0].id,
|
|
60
|
-
lesson_id: course.sections[0].lessons[0].id
|
|
62
|
+
section_id: (_a = course.sections) === null || _a === void 0 ? void 0 : _a[0].id,
|
|
63
|
+
lesson_id: (_b = course.sections) === null || _b === void 0 ? void 0 : _b[0].lessons[0].id
|
|
61
64
|
});
|
|
62
65
|
return data;
|
|
63
66
|
}
|
|
64
|
-
course.sections.some((section) => {
|
|
65
|
-
|
|
67
|
+
(_c = course.sections) === null || _c === void 0 ? void 0 : _c.some((section) => {
|
|
68
|
+
var _a;
|
|
69
|
+
const isNextLessonInThisSection = section.num_lessons_completed < section.num_lessons && !section.locked;
|
|
66
70
|
if (isNextLessonInThisSection) {
|
|
67
71
|
Object.assign(data, {
|
|
68
72
|
section_id: section.id,
|
|
69
|
-
lesson_id: section.lessons.find((lesson) => lesson.completion_status === types_1.SCCourseLessonCompletionStatusType.UNCOMPLETED).id
|
|
73
|
+
lesson_id: (_a = section.lessons.find((lesson) => lesson.completion_status === types_1.SCCourseLessonCompletionStatusType.UNCOMPLETED)) === null || _a === void 0 ? void 0 : _a.id
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
76
|
return isNextLessonInThisSection;
|
|
@@ -74,7 +78,11 @@ function getUrlNextLesson(course) {
|
|
|
74
78
|
return data;
|
|
75
79
|
}
|
|
76
80
|
function getIsNextLessonLocked(course) {
|
|
77
|
-
|
|
81
|
+
var _a;
|
|
82
|
+
if (course.join_status === null) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
return (_a = course.sections) === null || _a === void 0 ? void 0 : _a.every((section) => {
|
|
78
86
|
var _a, _b;
|
|
79
87
|
return (section.num_lessons_completed < section.num_lessons &&
|
|
80
88
|
((_b = (_a = section.lessons) === null || _a === void 0 ? void 0 : _a.find((lesson) => lesson.completion_status === types_1.SCCourseLessonCompletionStatusType.UNCOMPLETED)) === null || _b === void 0 ? void 0 : _b.locked));
|
|
@@ -97,6 +105,8 @@ function Student(inProps) {
|
|
|
97
105
|
const [loadingRequest, setLoadingRequest] = (0, react_1.useState)(false);
|
|
98
106
|
// CONTEXTS
|
|
99
107
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
108
|
+
const scContext = (0, react_core_1.useSCContext)();
|
|
109
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
100
110
|
// HOOKS
|
|
101
111
|
const { scCourse, setSCCourse } = (0, react_core_1.useSCFetchCourse)({ id: courseId, course });
|
|
102
112
|
const intl = (0, react_intl_1.useIntl)();
|
|
@@ -113,21 +123,33 @@ function Student(inProps) {
|
|
|
113
123
|
const handleRequest = (0, react_1.useCallback)(() => {
|
|
114
124
|
setLoadingRequest(true);
|
|
115
125
|
let request;
|
|
116
|
-
let updatedCourse;
|
|
117
126
|
if (sentRequest) {
|
|
118
127
|
request = api_services_1.CourseService.leaveOrRemoveCourseRequest(scCourse.id);
|
|
119
|
-
updatedCourse = Object.assign(Object.assign({}, scCourse), { join_status: null });
|
|
120
128
|
}
|
|
121
129
|
else {
|
|
122
130
|
request = api_services_1.CourseService.joinOrAcceptInviteToCourse(scCourse.id);
|
|
123
|
-
updatedCourse = Object.assign(Object.assign({}, scCourse), { join_status: scCourse.privacy === types_1.SCCoursePrivacyType.PRIVATE ? types_1.SCCourseJoinStatusType.REQUESTED : types_1.SCCourseJoinStatusType.JOINED });
|
|
124
131
|
}
|
|
125
132
|
request
|
|
126
|
-
.then(() => {
|
|
133
|
+
.then((data) => {
|
|
134
|
+
let updatedCourse;
|
|
135
|
+
if (data) {
|
|
136
|
+
updatedCourse = data;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
updatedCourse = Object.assign(Object.assign({}, scCourse), { join_status: null });
|
|
140
|
+
}
|
|
127
141
|
setSCCourse(updatedCourse);
|
|
128
142
|
setSentRequest((prev) => !prev);
|
|
129
143
|
setLoadingRequest(false);
|
|
130
|
-
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id:
|
|
144
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: updatedCourse.join_status === types_1.SCCourseJoinStatusType.REQUESTED
|
|
145
|
+
? SNACKBAR_MESSAGES.request
|
|
146
|
+
: updatedCourse.join_status === types_1.SCCourseJoinStatusType.JOINED
|
|
147
|
+
? SNACKBAR_MESSAGES.enroll
|
|
148
|
+
: SNACKBAR_MESSAGES.cancel, defaultMessage: updatedCourse.join_status === types_1.SCCourseJoinStatusType.REQUESTED
|
|
149
|
+
? SNACKBAR_MESSAGES.request
|
|
150
|
+
: updatedCourse.join_status === types_1.SCCourseJoinStatusType.JOINED
|
|
151
|
+
? SNACKBAR_MESSAGES.enroll
|
|
152
|
+
: SNACKBAR_MESSAGES.cancel }), {
|
|
131
153
|
variant: 'success',
|
|
132
154
|
autoHideDuration: 3000
|
|
133
155
|
});
|
|
@@ -140,6 +162,9 @@ function Student(inProps) {
|
|
|
140
162
|
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
141
163
|
});
|
|
142
164
|
}, [scCourse, sentRequest, setLoadingRequest]);
|
|
165
|
+
const handleAnonymousAction = (0, react_1.useCallback)(() => {
|
|
166
|
+
scContext.settings.handleAnonymousAction();
|
|
167
|
+
}, [scContext.settings.handleAnonymousAction]);
|
|
143
168
|
// MEMOS
|
|
144
169
|
const actionButton = (0, react_1.useMemo)(() => {
|
|
145
170
|
var _a, _b;
|
|
@@ -155,7 +180,7 @@ function Student(inProps) {
|
|
|
155
180
|
? BUTTON_MESSAGES.start
|
|
156
181
|
: scCourse.user_completion_rate === 100
|
|
157
182
|
? BUTTON_MESSAGES.review
|
|
158
|
-
: BUTTON_MESSAGES.continue, to: scCourse.join_status !== null ? scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlNextLesson(scCourse)) : undefined, disabled: scCourse.join_status !== null ? getIsNextLessonLocked(scCourse) : undefined, color: scCourse.user_completion_rate === 100 ? 'inherit' : undefined, variant: scCourse.user_completion_rate === 100 ? 'outlined' : undefined, loading: scCourse.join_status === null ? loadingRequest : undefined, onClick: scCourse.join_status === null ? handleRequest : undefined })), scCourse.privacy === types_1.SCCoursePrivacyType.PRIVATE &&
|
|
183
|
+
: BUTTON_MESSAGES.continue, to: scCourse.join_status !== null ? scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlNextLesson(scCourse)) : undefined, disabled: scCourse.join_status !== null ? getIsNextLessonLocked(scCourse) : undefined, color: scCourse.user_completion_rate === 100 ? 'inherit' : undefined, variant: scCourse.user_completion_rate === 100 ? 'outlined' : undefined, loading: scCourse.join_status === null ? loadingRequest : undefined, onClick: !scUserContext.user ? handleAnonymousAction : scCourse.join_status === null ? handleRequest : undefined })), scCourse.privacy === types_1.SCCoursePrivacyType.PRIVATE &&
|
|
159
184
|
(scCourse.join_status === null || scCourse.join_status === types_1.SCCourseJoinStatusType.REQUESTED) && ((0, jsx_runtime_1.jsx)(ActionButton_1.default, { labelId: sentRequest ? BUTTON_MESSAGES.cancel : BUTTON_MESSAGES.request, color: "inherit", variant: "outlined", loading: loadingRequest, onClick: handleRequest }))] })));
|
|
160
185
|
}, [scCourse, sentRequest, loadingRequest, handleRequest]);
|
|
161
186
|
if (!scCourse) {
|
|
@@ -170,9 +195,10 @@ function Student(inProps) {
|
|
|
170
195
|
scCourse.join_status === types_1.SCCourseJoinStatusType.MANAGER ||
|
|
171
196
|
scCourse.join_status === types_1.SCCourseJoinStatusType.JOINED)) ||
|
|
172
197
|
scCourse.privacy === types_1.SCCoursePrivacyType.OPEN ||
|
|
173
|
-
scCourse.privacy === types_1.SCCoursePrivacyType.DRAFT) &&
|
|
198
|
+
scCourse.privacy === types_1.SCCoursePrivacyType.DRAFT) &&
|
|
199
|
+
scCourse.description && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", className: (0, classnames_1.default)(classes.margin, classes.contrastColor) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.student.description", defaultMessage: "ui.course.dashboard.student.description" }) })), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.box }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.description }, { children: scCourse.description })) }))] })), (((scCourse.privacy === types_1.SCCoursePrivacyType.PRIVATE || scCourse.privacy === types_1.SCCoursePrivacyType.SECRET) &&
|
|
174
200
|
(scCourse.join_status === types_1.SCCourseJoinStatusType.MANAGER || scCourse.join_status === types_1.SCCourseJoinStatusType.JOINED)) ||
|
|
175
|
-
(scCourse.privacy === types_1.SCCoursePrivacyType.OPEN && scCourse.join_status !== types_1.SCCourseJoinStatusType.CREATOR)) && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", className: classes.margin }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.student.progress", defaultMessage: "ui.course.dashboard.student.
|
|
201
|
+
(scCourse.privacy === types_1.SCCoursePrivacyType.OPEN && scCourse.join_status !== types_1.SCCourseJoinStatusType.CREATOR)) && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [scCourse.join_status !== null && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", className: (0, classnames_1.default)(classes.margin, classes.contrastColor) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.student.progress", defaultMessage: "ui.course.dashboard.student.progress" }) })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.box }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.percentageWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.student.progress.described", defaultMessage: "ui.course.dashboard.student.progress.described", values: { progress: scCourse.num_lessons_completed, end: scCourse.num_lessons } }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.student.progress.percentage", defaultMessage: "ui.course.dashboard.student.progress.percentage", values: { percentage: scCourse.user_completion_rate } }) }))] })), (0, jsx_runtime_1.jsx)(material_1.LinearProgress, { className: classes.progress, variant: "determinate", value: scCourse.user_completion_rate })] }))] })), scCourse.user_completion_rate === 100 && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: (0, classnames_1.default)(classes.completedWrapper, classes.margin) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.student.completed", defaultMessage: "ui.course.dashboard.student.completed" }) })), (0, jsx_runtime_1.jsx)("img", { src: clapping_1.CLAPPING, alt: intl.formatMessage({ id: 'ui.course.dashboard.student.completed', defaultMessage: 'ui.course.dashboard.student.completed' }), width: 32, height: 32 })] }))), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", className: (0, classnames_1.default)(classes.margin, classes.contrastColor) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.student.contents", defaultMessage: "ui.course.dashboard.student.contents" }) })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.lessonsSections }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
|
|
176
202
|
sectionsNumber: scCourse.num_sections
|
|
177
203
|
} }) })), (0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.circle }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
|
|
178
204
|
lessonsNumber: scCourse.num_lessons
|
|
@@ -12,6 +12,7 @@ const Pagination_1 = require("../../../constants/Pagination");
|
|
|
12
12
|
const widget_1 = require("../../../utils/widget");
|
|
13
13
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
14
14
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
15
|
+
const course_1 = require("../../../utils/course");
|
|
15
16
|
const classes = {
|
|
16
17
|
container: `${constants_1.PREFIX}-comments-container`,
|
|
17
18
|
outerWrapper: `${constants_1.PREFIX}-outer-wrapper`,
|
|
@@ -20,7 +21,8 @@ const classes = {
|
|
|
20
21
|
avatar: `${constants_1.PREFIX}-avatar`,
|
|
21
22
|
userInfo: `${constants_1.PREFIX}-user-info`,
|
|
22
23
|
circle: `${constants_1.PREFIX}-circle`,
|
|
23
|
-
button: `${constants_1.PREFIX}-button
|
|
24
|
+
button: `${constants_1.PREFIX}-button`,
|
|
25
|
+
contrastColor: `${constants_1.PREFIX}-contrast-color`
|
|
24
26
|
};
|
|
25
27
|
function CommentSkeleton({ id }) {
|
|
26
28
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.outerWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "text", width: "90px", height: "21px" }), (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.innerWrapper }, { children: [Array.from(new Array(id)).map((_, i) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "circular", className: classes.avatar }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userInfo }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "text", width: "90px", height: "21px" }), (0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.circle }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "text", width: "90px", height: "21px" })] })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "text", width: "180px", height: "21px" })] })] }), i))), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "rounded", width: "112px", height: "36px", className: classes.button })] }))] })));
|
|
@@ -39,7 +41,7 @@ function Comments(props) {
|
|
|
39
41
|
cacheStrategy: utils_1.CacheStrategies.CACHE_FIRST,
|
|
40
42
|
visibleItems: endpointQueryParams.limit
|
|
41
43
|
}, widget_1.stateWidgetInitializer);
|
|
42
|
-
const [
|
|
44
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
43
45
|
// CONTEXTS
|
|
44
46
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
45
47
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
@@ -69,7 +71,7 @@ function Comments(props) {
|
|
|
69
71
|
}, [scUserContext.user, _init]);
|
|
70
72
|
// HANDLERS
|
|
71
73
|
const handleNext = (0, react_1.useCallback)(() => {
|
|
72
|
-
|
|
74
|
+
setIsLoading(true);
|
|
73
75
|
dispatch({ type: widget_1.actionWidgetTypes.LOADING_NEXT });
|
|
74
76
|
api_services_1.http
|
|
75
77
|
.request({
|
|
@@ -78,12 +80,12 @@ function Comments(props) {
|
|
|
78
80
|
})
|
|
79
81
|
.then((res) => {
|
|
80
82
|
dispatch({ type: widget_1.actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: res.data });
|
|
81
|
-
|
|
83
|
+
setIsLoading(false);
|
|
82
84
|
})
|
|
83
85
|
.catch((error) => {
|
|
84
86
|
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
85
87
|
});
|
|
86
|
-
}, [state.next, dispatch,
|
|
88
|
+
}, [state.next, dispatch, setIsLoading]);
|
|
87
89
|
// MEMOS
|
|
88
90
|
const renderComments = (0, react_1.useMemo)(() => {
|
|
89
91
|
const map = new Map();
|
|
@@ -96,11 +98,11 @@ function Comments(props) {
|
|
|
96
98
|
map.set(name, [...map.get(name), comment]);
|
|
97
99
|
}
|
|
98
100
|
});
|
|
99
|
-
return Array.from(map.entries()).map(([name, comments]) => ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.outerWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: name })), (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.innerWrapper }, { children: [comments.map((comment) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { src: comment.created_by.avatar, alt: comment.created_by.username, className: classes.avatar }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userInfo }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: comment.created_by.username })), (0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.circle }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children:
|
|
101
|
+
return Array.from(map.entries()).map(([name, comments]) => ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.outerWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: name })), (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.innerWrapper }, { children: [comments.map((comment) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { src: comment.created_by.avatar, alt: comment.created_by.username, className: classes.avatar }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userInfo }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: comment.created_by.username })), (0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.circle }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedDate, { value: comment.created_at }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", component: "div", dangerouslySetInnerHTML: { __html: comment.html } })] })] }), comment.id))), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_COMMENTS_ROUTE_NAME, (0, course_1.getUrlLesson)(comments[0].extras.course, comments[0].extras.lesson, comments[0].extras.section)), size: "small", variant: "outlined", color: "inherit", className: classes.button }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label", defaultMessage: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label" }) })) }))] }))] }), name)));
|
|
100
102
|
}, [state.results]);
|
|
101
103
|
if (!state.initialized) {
|
|
102
104
|
return (0, jsx_runtime_1.jsx)(CommentsSkeleton, {});
|
|
103
105
|
}
|
|
104
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.container }, { children: state.count > 0 ? ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.number", defaultMessage: "ui.course.dashboard.teacher.tab.comments.number", values: { commentsNumber: state.count } }) })), renderComments,
|
|
106
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.container }, { children: state.count > 0 ? ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.number", defaultMessage: "ui.course.dashboard.teacher.tab.comments.number", values: { commentsNumber: state.count } }) })), renderComments, isLoading && (0, jsx_runtime_1.jsx)(CommentSkeleton, { id: 1 }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ size: "small", variant: "outlined", color: "inherit", loading: isLoading, disabled: !state.next, onClick: handleNext }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.btn.label", defaultMessage: "ui.course.dashboard.teacher.tab.comments.btn.label" }) })) }))] })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.empty", defaultMessage: "ui.course.dashboard.teacher.tab.comments.empty" }) }))) })));
|
|
105
107
|
}
|
|
106
108
|
exports.default = (0, react_1.memo)(Comments);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SCCourseType } from '@selfcommunity/types';
|
|
3
|
+
import { CourseDashboardUsersParams } from '@selfcommunity/api-services';
|
|
3
4
|
interface StudentsProps {
|
|
4
5
|
course: SCCourseType;
|
|
5
|
-
endpointQueryParams?:
|
|
6
|
+
endpointQueryParams?: CourseDashboardUsersParams;
|
|
6
7
|
}
|
|
7
8
|
declare function Students(props: StudentsProps): JSX.Element;
|
|
8
9
|
declare const _default: import("react").MemoExoticComponent<typeof Students>;
|
|
@@ -10,6 +10,7 @@ const api_services_1 = require("@selfcommunity/api-services");
|
|
|
10
10
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
11
11
|
const widget_1 = require("../../../utils/widget");
|
|
12
12
|
const Pagination_1 = require("../../../constants/Pagination");
|
|
13
|
+
const course_1 = require("../../../types/course");
|
|
13
14
|
const headerCells = [
|
|
14
15
|
{
|
|
15
16
|
id: 'ui.course.dashboard.teacher.tab.students.table.header.name'
|
|
@@ -32,8 +33,8 @@ function Students(props) {
|
|
|
32
33
|
const [state, dispatch] = (0, react_1.useReducer)(widget_1.dataWidgetReducer, {
|
|
33
34
|
isLoadingNext: false,
|
|
34
35
|
next: null,
|
|
35
|
-
cacheKey: react_core_1.SCCache.getWidgetStateCacheKey(react_core_1.SCCache.
|
|
36
|
-
cacheStrategy: utils_1.CacheStrategies.
|
|
36
|
+
cacheKey: react_core_1.SCCache.getWidgetStateCacheKey(react_core_1.SCCache.STUDENTS_PARTECIPANTS_COURSES_STATE_CACHE_PREFIX_KEY, course.id),
|
|
37
|
+
cacheStrategy: utils_1.CacheStrategies.NETWORK_ONLY,
|
|
37
38
|
visibleItems: endpointQueryParams.limit
|
|
38
39
|
}, widget_1.stateWidgetInitializer);
|
|
39
40
|
// HOOKS
|
|
@@ -62,6 +63,9 @@ function Students(props) {
|
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
}, [scUserContext.user, _init]);
|
|
65
|
-
return ((0, jsx_runtime_1.jsx)(CourseUsersTable_1.default, {
|
|
66
|
+
return ((0, jsx_runtime_1.jsx)(CourseUsersTable_1.default, { state: state, dispatch: dispatch, course: course, endpointSearch: {
|
|
67
|
+
url: () => api_services_1.Endpoints.GetCourseDashboardUsers.url({ id: course.id }),
|
|
68
|
+
method: api_services_1.Endpoints.GetCourseDashboardUsers.method
|
|
69
|
+
}, headerCells: headerCells, mode: course_1.SCCourseUsersTableModeType.DASHBOARD, emptyStatusTitle: "ui.courseUsersTable.empty.users.title", emptyStatusDescription: "ui.courseUsersTable.empty.users.description" }));
|
|
66
70
|
}
|
|
67
71
|
exports.default = (0, react_1.memo)(Students);
|
|
@@ -21,7 +21,8 @@ const classes = {
|
|
|
21
21
|
infoWrapper: `${constants_1.PREFIX}-info-wrapper`,
|
|
22
22
|
tabList: `${constants_1.PREFIX}-tab-list`,
|
|
23
23
|
tab: `${constants_1.PREFIX}-tab`,
|
|
24
|
-
tabPanel: `${constants_1.PREFIX}-tab-panel
|
|
24
|
+
tabPanel: `${constants_1.PREFIX}-tab-panel`,
|
|
25
|
+
contrastColor: `${constants_1.PREFIX}-contrast-color`
|
|
25
26
|
};
|
|
26
27
|
const TAB_DATA = [
|
|
27
28
|
{
|
|
@@ -56,6 +57,6 @@ function Teacher(inProps) {
|
|
|
56
57
|
if (!scCourse) {
|
|
57
58
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
58
59
|
}
|
|
59
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsx)(Header_1.default, { course: scCourse, hasAction: true }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.infoWrapper }, { children: [(0, jsx_runtime_1.jsx)(Info_1.default, { title: "ui.course.dashboard.teacher.info.students", course: scCourse, position: types_1.InfoPositionType.FIRST }), (0, jsx_runtime_1.jsx)(Info_1.default, { title: "ui.course.dashboard.teacher.info.completion", course: scCourse, position: types_1.InfoPositionType.SECOND })] })), (0, jsx_runtime_1.jsxs)(lab_1.TabContext, Object.assign({ value: tabValue }, { children: [(0, jsx_runtime_1.jsx)(lab_1.TabList, Object.assign({ className: classes.tabList, onChange: handleTabChange, textColor: "primary", indicatorColor: "primary", variant: "standard", centered: true }, { children: TAB_DATA.map((data, i) => ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: data.label, defaultMessage: data.label }) })), value: data.value, className: classes.tab }, i))) })), (0, jsx_runtime_1.jsx)(lab_1.TabPanel, Object.assign({ className: classes.tabPanel, value: types_1.TabContentType.STUDENTS }, { children: (0, jsx_runtime_1.jsx)(Students_1.default, { course: scCourse }) })), (0, jsx_runtime_1.jsx)(lab_1.TabPanel, Object.assign({ className: classes.tabPanel, value: types_1.TabContentType.COMMENTS }, { children: (0, jsx_runtime_1.jsx)(Comments_1.default, { course: scCourse }) }))] }))] })));
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsx)(Header_1.default, { course: scCourse, hasAction: true }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.infoWrapper }, { children: [(0, jsx_runtime_1.jsx)(Info_1.default, { title: "ui.course.dashboard.teacher.info.students", course: scCourse, position: types_1.InfoPositionType.FIRST }), (0, jsx_runtime_1.jsx)(Info_1.default, { title: "ui.course.dashboard.teacher.info.completion", course: scCourse, position: types_1.InfoPositionType.SECOND })] })), (0, jsx_runtime_1.jsxs)(lab_1.TabContext, Object.assign({ value: tabValue }, { children: [(0, jsx_runtime_1.jsx)(lab_1.TabList, Object.assign({ className: classes.tabList, onChange: handleTabChange, textColor: "primary", indicatorColor: "primary", variant: "standard", centered: true }, { children: TAB_DATA.map((data, i) => ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: data.label, defaultMessage: data.label }) })), value: data.value, className: (0, classnames_1.default)(classes.tab, classes.contrastColor) }, i))) })), (0, jsx_runtime_1.jsx)(lab_1.TabPanel, Object.assign({ className: classes.tabPanel, value: types_1.TabContentType.STUDENTS }, { children: (0, jsx_runtime_1.jsx)(Students_1.default, { course: scCourse }) })), (0, jsx_runtime_1.jsx)(lab_1.TabPanel, Object.assign({ className: classes.tabPanel, value: types_1.TabContentType.COMMENTS }, { children: (0, jsx_runtime_1.jsx)(Comments_1.default, { course: scCourse }) }))] }))] })));
|
|
60
61
|
}
|
|
61
62
|
exports.default = (0, react_1.memo)(Teacher);
|
|
@@ -22,6 +22,11 @@ export interface CourseFormProps extends BoxProps {
|
|
|
22
22
|
* @default `SCCourseFormStepType.GENERAL`
|
|
23
23
|
*/
|
|
24
24
|
step?: SCCourseFormStepType;
|
|
25
|
+
/**
|
|
26
|
+
* On step change callback function
|
|
27
|
+
* @default null
|
|
28
|
+
*/
|
|
29
|
+
onStepChange?: (step: SCCourseFormStepType, type: SCCourseType) => void;
|
|
25
30
|
/**
|
|
26
31
|
* On error callback function
|
|
27
32
|
* @default null
|