@selfcommunity/react-ui 0.11.0-alpha.5 → 0.11.0-alpha.51

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.
Files changed (147) hide show
  1. package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
  2. package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
  3. package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
  4. package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
  5. package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +9 -1
  6. package/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +1 -1
  7. package/lib/cjs/components/CreateEventButton/CreateEventButton.js +1 -1
  8. package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
  9. package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
  10. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
  11. package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +17 -11
  12. package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +10 -2
  13. package/lib/cjs/components/Editor/Editor.js +9 -9
  14. package/lib/cjs/components/Editor/nodes/HashtagNode.js +2 -0
  15. package/lib/cjs/components/Editor/nodes/MentionNode.js +2 -0
  16. package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
  17. package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.js +34 -0
  18. package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
  19. package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.js +2 -3
  20. package/lib/cjs/components/Event/Event.js +6 -3
  21. package/lib/cjs/components/EventForm/EventAddress.js +1 -1
  22. package/lib/cjs/components/EventForm/EventForm.js +17 -8
  23. package/lib/cjs/components/EventFormDialog/EventFormDialog.d.ts +1 -1
  24. package/lib/cjs/components/EventFormDialog/EventFormDialog.js +3 -3
  25. package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
  26. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +11 -11
  27. package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +8 -8
  28. package/lib/cjs/components/EventMembersWidget/types.d.ts +4 -5
  29. package/lib/cjs/components/EventMembersWidget/types.js +7 -7
  30. package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +1 -1
  31. package/lib/cjs/components/Events/Events.d.ts +11 -0
  32. package/lib/cjs/components/Events/Events.js +21 -10
  33. package/lib/cjs/components/Events/OngoingEventsFilter.d.ts +8 -0
  34. package/lib/cjs/components/Events/OngoingEventsFilter.js +24 -0
  35. package/lib/cjs/components/FeedObject/Activities/Activities.js +1 -1
  36. package/lib/cjs/components/GroupForm/GroupForm.js +2 -2
  37. package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
  38. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
  39. package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +65 -6
  40. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
  41. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
  42. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
  43. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
  44. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
  45. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
  46. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +106 -0
  47. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
  48. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +37 -0
  49. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  50. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  51. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
  52. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
  53. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +62 -5
  54. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
  55. package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
  56. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
  57. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +2 -2
  58. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
  59. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
  60. package/lib/cjs/components/Notification/Event/Event.js +20 -2
  61. package/lib/cjs/components/SearchDialog/SearchDialog.d.ts +4 -1
  62. package/lib/cjs/components/SearchDialog/SearchDialog.js +2 -2
  63. package/lib/cjs/constants/LiveStream.d.ts +1 -0
  64. package/lib/cjs/constants/LiveStream.js +2 -1
  65. package/lib/cjs/shared/EventActionsMenu/index.js +5 -1
  66. package/lib/cjs/shared/UpScalingTierBadge/index.js +9 -0
  67. package/lib/cjs/utils/buttonCounters.d.ts +1 -0
  68. package/lib/cjs/utils/buttonCounters.js +4 -3
  69. package/lib/cjs/utils/contribution.js +1 -2
  70. package/lib/cjs/utils/events.d.ts +1 -0
  71. package/lib/cjs/utils/events.js +6 -1
  72. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
  73. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
  74. package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
  75. package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
  76. package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +10 -2
  77. package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +1 -1
  78. package/lib/esm/components/CreateEventButton/CreateEventButton.js +1 -1
  79. package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
  80. package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
  81. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
  82. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +17 -11
  83. package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +12 -4
  84. package/lib/esm/components/Editor/Editor.js +8 -8
  85. package/lib/esm/components/Editor/nodes/HashtagNode.js +2 -0
  86. package/lib/esm/components/Editor/nodes/MentionNode.js +2 -0
  87. package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
  88. package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.js +30 -0
  89. package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
  90. package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.js +1 -1
  91. package/lib/esm/components/Event/Event.js +6 -3
  92. package/lib/esm/components/EventForm/EventAddress.js +1 -1
  93. package/lib/esm/components/EventForm/EventForm.js +18 -9
  94. package/lib/esm/components/EventFormDialog/EventFormDialog.d.ts +1 -1
  95. package/lib/esm/components/EventFormDialog/EventFormDialog.js +3 -3
  96. package/lib/esm/components/EventHeader/EventHeader.js +1 -1
  97. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +12 -12
  98. package/lib/esm/components/EventMembersWidget/TabContentComponent.js +9 -9
  99. package/lib/esm/components/EventMembersWidget/types.d.ts +4 -5
  100. package/lib/esm/components/EventMembersWidget/types.js +6 -6
  101. package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +1 -1
  102. package/lib/esm/components/Events/Events.d.ts +11 -0
  103. package/lib/esm/components/Events/Events.js +22 -11
  104. package/lib/esm/components/Events/OngoingEventsFilter.d.ts +8 -0
  105. package/lib/esm/components/Events/OngoingEventsFilter.js +21 -0
  106. package/lib/esm/components/FeedObject/Activities/Activities.js +1 -1
  107. package/lib/esm/components/GroupForm/GroupForm.js +2 -2
  108. package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
  109. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
  110. package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +67 -8
  111. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
  112. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
  113. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
  114. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
  115. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
  116. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
  117. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +103 -0
  118. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
  119. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +34 -0
  120. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  121. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  122. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
  123. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
  124. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +66 -9
  125. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
  126. package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
  127. package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
  128. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +2 -2
  129. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
  130. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
  131. package/lib/esm/components/Notification/Event/Event.js +22 -4
  132. package/lib/esm/components/SearchDialog/SearchDialog.d.ts +4 -1
  133. package/lib/esm/components/SearchDialog/SearchDialog.js +2 -2
  134. package/lib/esm/constants/LiveStream.d.ts +1 -0
  135. package/lib/esm/constants/LiveStream.js +1 -0
  136. package/lib/esm/shared/EventActionsMenu/index.js +6 -2
  137. package/lib/esm/shared/UpScalingTierBadge/index.js +9 -0
  138. package/lib/esm/utils/buttonCounters.d.ts +1 -0
  139. package/lib/esm/utils/buttonCounters.js +3 -2
  140. package/lib/esm/utils/contribution.js +1 -2
  141. package/lib/esm/utils/events.d.ts +1 -0
  142. package/lib/esm/utils/events.js +4 -0
  143. package/lib/umd/239.js +2 -0
  144. package/lib/umd/react-ui.js +1 -1
  145. package/package.json +14 -13
  146. package/lib/umd/653.js +0 -2
  147. /package/lib/umd/{653.js.LICENSE.txt → 239.js.LICENSE.txt} +0 -0
@@ -26,7 +26,9 @@ export interface NavigationMenuDrawerProps extends DrawerProps {
26
26
  * Custom Drawer footer content
27
27
  * @default null
28
28
  */
29
- drawerFooterContent?: React.ReactNode;
29
+ drawerFooterContent?: React.ReactNode | ((props: {
30
+ handleCloseMenuDrawer: (event: any, reason: 'backdropClick' | 'escapeKeyDown') => void;
31
+ }) => React.ReactNode);
30
32
  /**
31
33
  * Props to spread to ScrollContainer component
32
34
  * This lib use 'react-custom-scrollbars' component to perform scrollbars
@@ -1,6 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useMemo } from 'react';
3
+ import React from 'react';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { Box, Divider, Drawer, Icon, IconButton, List } from '@mui/material';
6
6
  import classNames from 'classnames';
@@ -9,7 +9,6 @@ import ScrollContainer from '../../shared/ScrollContainer';
9
9
  import DefaultDrawerContent from './DefaultDrawerContent';
10
10
  import DefaultHeaderContent from './DefaultHeaderContent';
11
11
  import CreateLiveStreamButton from '../CreateLiveStreamButton';
12
- import { useSCUser } from '@selfcommunity/react-core';
13
12
  const PREFIX = 'SCNavigationMenuDrawer';
14
13
  const classes = {
15
14
  root: `${PREFIX}-root`,
@@ -28,14 +27,22 @@ const Root = styled(Drawer, {
28
27
  overridesResolver: (props, styles) => styles.root
29
28
  })(({ theme }) => ({}));
30
29
  export default function NavigationMenuDrawer(inProps) {
31
- var _a;
32
30
  // PROPS
33
31
  const props = useThemeProps({
34
32
  props: inProps,
35
33
  name: PREFIX
36
34
  });
37
35
  const { className = null, showDrawerHeader = true, drawerHeaderContent = _jsx(DefaultHeaderContent, {}), drawerContent = _jsx(DefaultDrawerContent, {}), showDrawerFooterContent = true, drawerFooterContent = null, ScrollContainerProps = { hideTracksWhenNotNeeded: true }, CreateLiveStreamButtonComponentProps = {}, open, onClose } = props, rest = __rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "showDrawerFooterContent", "drawerFooterContent", "ScrollContainerProps", "CreateLiveStreamButtonComponentProps", "open", "onClose"]);
38
- const scUserContext = useSCUser();
39
- const canCreateLiveStream = useMemo(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
40
- return (_jsxs(Root, Object.assign({ anchor: "left", className: classNames(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsx(Divider, {})] })), _jsx(ScrollContainer, Object.assign({}, ScrollContainerProps, { children: _jsx(List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && (_jsx(_Fragment, { children: _jsx(Box, Object.assign({ className: classes.drawerFooter }, { children: drawerFooterContent ? (drawerFooterContent) : (_jsx(Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: _jsx(CreateLiveStreamButton, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))) })) }))] })));
36
+ const footerContent = (() => {
37
+ if (typeof drawerFooterContent === 'function') {
38
+ return drawerFooterContent({ handleCloseMenuDrawer: onClose });
39
+ }
40
+ if (React.isValidElement(drawerFooterContent)) {
41
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
+ // @ts-ignore
43
+ return React.cloneElement(drawerFooterContent, { handleCloseMenuDrawer: onClose });
44
+ }
45
+ return drawerFooterContent;
46
+ })();
47
+ return (_jsxs(Root, Object.assign({ anchor: "left", className: classNames(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsx(Divider, {})] })), _jsx(ScrollContainer, Object.assign({}, ScrollContainerProps, { children: _jsx(List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) })), showDrawerFooterContent && (_jsx(_Fragment, { children: _jsx(Box, Object.assign({ component: "div", className: classes.drawerFooter }, { children: footerContent || (_jsx(Box, Object.assign({ className: classes.drawerFooterLiveStream }, { children: _jsx(CreateLiveStreamButton, Object.assign({ color: "primary", className: classes.drawerFooterLiveStreamButton, fullWidth: true }, CreateLiveStreamButtonComponentProps)) }))) })) }))] })));
41
48
  }
@@ -17,7 +17,7 @@ export interface NavigationToolbarProps extends ToolbarProps {
17
17
  /**
18
18
  * Searchbar props
19
19
  */
20
- SearchAutocompleteProps?: SearchAutocompleteProps;
20
+ SearchAutocompleteComponentProps?: SearchAutocompleteProps;
21
21
  /**
22
22
  * The navigation path
23
23
  */
@@ -96,7 +96,7 @@ export default function NavigationToolbar(inProps) {
96
96
  props: inProps,
97
97
  name: PREFIX
98
98
  });
99
- const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = __rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
99
+ const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteComponentProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = __rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteComponentProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
100
100
  // CONTEXT
101
101
  const scUserContext = useSCUser();
102
102
  const scRoutingContext = useSCRouting();
@@ -146,7 +146,7 @@ export default function NavigationToolbar(inProps) {
146
146
  }), "aria-label": "Groups", to: scRoutingContext.url(SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "groups" }) }))), eventsEnabled && (scUserContext.user || preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY]) && (_jsx(IconButton, Object.assign({ className: classNames(classes.events, {
147
147
  [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}))
148
148
  }), "aria-label": "Events", to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "CalendarIcon" }) })))] })));
149
- return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsx(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: _jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[SCPreferences.ADDONS_CLOSED_COMMUNITY] && (_jsx(Button, Object.assign({ color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && (_jsx(_Fragment, { children: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? (_jsx(Tooltip, Object.assign({ title: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: _jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? (_jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteProps))) : (_jsx(Box, { className: classes.search })), startActions, scUserContext.user ? (_jsxs(_Fragment, { children: [showComposer && _jsx(ComposerIconButton, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), _jsx(Tooltip, Object.assign({ title: scUserContext.user.username }, { children: _jsx(IconButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: _jsx(Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), _jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classNames(classes.notification, {
149
+ return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsx(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: _jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[SCPreferences.ADDONS_CLOSED_COMMUNITY] && (_jsx(Button, Object.assign({ color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && (_jsx(_Fragment, { children: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? (_jsx(Tooltip, Object.assign({ title: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: _jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? (_jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteComponentProps))) : (_jsx(Box, { className: classes.search })), startActions, scUserContext.user ? (_jsxs(_Fragment, { children: [showComposer && _jsx(ComposerIconButton, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), _jsx(Tooltip, Object.assign({ title: scUserContext.user.username }, { children: _jsx(IconButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: _jsx(Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), _jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classNames(classes.notification, {
150
150
  [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}))
151
151
  }), "aria-label": "Notification", onClick: handleOpenNotificationMenu }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) })), Boolean(anchorNotification) && (_jsx(NotificationMenu, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open: true, onClose: handleCloseNotificationMenu, onClick: handleCloseNotificationMenu, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, NotificationMenuProps)))] }), privateMessagingEnabled && (_jsx(IconButton, Object.assign({ className: classNames(classes.messages, {
152
152
  [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}))
@@ -16,7 +16,7 @@ export interface NavigationToolbarMobileProps extends ToolbarProps {
16
16
  /**
17
17
  * Props spread to SearchAutocomplete component
18
18
  */
19
- SearchAutocompleteProps?: SearchAutocompleteProps;
19
+ SearchAutocompleteComponentProps?: SearchAutocompleteProps;
20
20
  /**
21
21
  * Actions to be inserted before composer IconButton
22
22
  */
@@ -69,7 +69,7 @@ export default function NavigationToolbarMobile(inProps) {
69
69
  props: inProps,
70
70
  name: PREFIX
71
71
  });
72
- const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, ComposerIconButtonProps = {} } = props, rest = __rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent", "ComposerIconButtonProps"]);
72
+ const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteComponentProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, ComposerIconButtonProps = {} } = props, rest = __rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteComponentProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent", "ComposerIconButtonProps"]);
73
73
  // CONTEXT
74
74
  const scUserContext = useSCUser();
75
75
  const scRoutingContext = useSCRouting();
@@ -96,10 +96,10 @@ export default function NavigationToolbarMobile(inProps) {
96
96
  // HANDLERS
97
97
  const handleOpenSearch = useCallback(() => {
98
98
  setSearchOpen(true);
99
- }, []);
99
+ }, [setSearchOpen]);
100
100
  const handleCloseSearch = useCallback(() => {
101
101
  setSearchOpen(false);
102
- }, []);
102
+ }, [setSearchOpen]);
103
103
  // RENDER
104
104
  if (scUserContext.loading) {
105
105
  return _jsx(NavigationToolbarMobileSkeleton, {});
@@ -107,7 +107,7 @@ export default function NavigationToolbarMobile(inProps) {
107
107
  const _children = children || (_jsxs(_Fragment, { children: [_jsx(NavigationMenuIconButtonComponent, {}), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classNames(className, classes.logo, {
108
108
  [classes.logoFlex]: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value
109
109
  }) }, { children: !preserveDesktopLogo ? (_jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO_MOBILE].value, alt: "logo" })) : (_jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO].value, alt: "logo" })) })), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED].value && (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value, className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE].value, alt: "custom_item" }) })))] }));
110
- return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_children, startActions, (contentAvailable || scUserContext.user) && !disableSearch && (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classes.search, onClick: handleOpenSearch }, { children: _jsx(Icon, { children: "search" }) })), _jsx(SearchDialog, { className: classes.searchDialog, fullScreen: true, open: searchOpen, SearchAutocompleteProps: Object.assign(Object.assign({}, SearchAutocompleteProps), { onClear: handleCloseSearch }) })] })), endActions, (!postOnlyStaffEnabled || (UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
110
+ return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_children, startActions, (contentAvailable || scUserContext.user) && !disableSearch && (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classes.search, onClick: handleOpenSearch }, { children: _jsx(Icon, { children: "search" }) })), _jsx(SearchDialog, { className: classes.searchDialog, fullScreen: true, open: searchOpen, SearchAutocompleteComponentProps: Object.assign(Object.assign({}, SearchAutocompleteComponentProps), { onClear: handleCloseSearch }) })] })), endActions, (!postOnlyStaffEnabled || (UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
111
111
  (scUserContext.user || contentAvailable) &&
112
112
  exploreStreamEnabled && _jsx(ComposerIconButton, Object.assign({}, ComposerIconButtonProps)), scUserContext.user && (groupsEnabled || eventsEnabled) && (_jsx(IconButton, Object.assign({ className: classes.notifications, component: Link, to: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}) }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) }))), scUserContext.user ? (_jsx(NavigationSettingsIconButtonComponent, { className: classes.settings })) : (_jsx(Button, Object.assign({ className: classes.login, color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNIN_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.login", defaultMessage: "ui.appBar.navigation.login" }) })))] })));
113
113
  }
@@ -3,8 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useState } from 'react';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { Avatar, Box, Icon, Stack, Typography } from '@mui/material';
6
- import { Link, SCRoutes, useSCRouting } from '@selfcommunity/react-core';
7
- import { SCEventLocationType } from '@selfcommunity/types';
6
+ import { Link, SCRoutes, useSCRouting, useSCUser } from '@selfcommunity/react-core';
7
+ import { SCEventLocationType, SCNotificationTypologyType } from '@selfcommunity/types';
8
8
  import { FormattedMessage, useIntl } from 'react-intl';
9
9
  import DateTimeAgo from '../../../shared/DateTimeAgo';
10
10
  import classNames from 'classnames';
@@ -15,6 +15,7 @@ import UserDeletedSnackBar from '../../../shared/UserDeletedSnackBar';
15
15
  import UserAvatar from '../../../shared/UserAvatar';
16
16
  import { PREFIX } from '../constants';
17
17
  import { default as EventItem } from '../../Event';
18
+ import { EventService } from '@selfcommunity/api-services';
18
19
  const classes = {
19
20
  root: `${PREFIX}-event-root`,
20
21
  avatar: `${PREFIX}-avatar`,
@@ -38,12 +39,24 @@ export default function EventNotification(props) {
38
39
  const { notificationObject, id = `n_${props.notificationObject['sid']}`, className, template = SCNotificationObjectTemplateType.DETAIL } = props, rest = __rest(props, ["notificationObject", "id", "className", "template"]);
39
40
  // CONTEXT
40
41
  const scRoutingContext = useSCRouting();
42
+ const scUserContext = useSCUser();
43
+ const scEventsManager = scUserContext.managers.events;
41
44
  // STATE
42
45
  const [openAlert, setOpenAlert] = useState(false);
46
+ const [loading, setLoading] = useState(false);
47
+ const [disabled, setDisabled] = useState(!notificationObject.is_new);
43
48
  // CONST
44
49
  const isSnippetTemplate = template === SCNotificationObjectTemplateType.SNIPPET;
45
50
  const isToastTemplate = template === SCNotificationObjectTemplateType.TOAST;
46
51
  const intl = useIntl();
52
+ //HANDLERS
53
+ const acceptRequest = (event) => {
54
+ setLoading(true);
55
+ EventService.inviteOrAcceptEventRequest(event.id, { users: [notificationObject.user.id] }).then(() => {
56
+ setLoading(false);
57
+ setDisabled(true);
58
+ });
59
+ };
47
60
  // RENDER
48
61
  if (isSnippetTemplate || isToastTemplate) {
49
62
  return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, `${PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: _jsx(Link, Object.assign({}, (!notificationObject.user.deleted && {
@@ -64,7 +77,7 @@ export default function EventNotification(props) {
64
77
  month: 'long'
65
78
  }),
66
79
  hour: intl.formatDate(notificationObject.event.start_date, { hour: 'numeric', minute: 'numeric' })
67
- } }) })), _jsxs(Typography, Object.assign({ component: "p", variant: "body2" }, { children: [_jsx(FormattedMessage, { id: `ui.notification.event.privacy.${notificationObject.event.privacy}`, defaultMessage: `ui.notification.event.privacy.${notificationObject.event.privacy}` }), ' ', "-", ' ', notificationObject.event.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: `ui.notification.event.address.live.label`, defaultMessage: `ui.notification.event.address.live.label` })) : (_jsx(FormattedMessage, { id: `ui.notification.event.address.online.label`, defaultMessage: `ui.notification.event.address.online.label` }))] }))] }), footer: isToastTemplate ? (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at }), _jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: _jsx(FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" }) })) }))] }))) : (_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
80
+ } }) })), _jsxs(Typography, Object.assign({ component: "p", variant: "body2" }, { children: [_jsx(FormattedMessage, { id: `ui.notification.event.privacy.${notificationObject.event.privacy}`, defaultMessage: `ui.notification.event.privacy.${notificationObject.event.privacy}` }), ' ', "-", ' ', notificationObject.event.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: `ui.notification.event.address.live.label`, defaultMessage: `ui.notification.event.address.live.label` })) : (_jsx(FormattedMessage, { id: `ui.notification.event.address.online.label`, defaultMessage: `ui.notification.event.address.online.label` }))] }))] }), footer: isToastTemplate ? (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at }), _jsx(Typography, Object.assign({ color: "primary" }, { children: notificationObject.type === SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT ? (_jsx(LoadingButton, Object.assign({ disabled: disabled, loading: loading || scEventsManager.isLoading(notificationObject.event), color: 'primary', variant: "text", size: "small", onClick: () => acceptRequest(notificationObject.event) }, { children: disabled ? (_jsx(FormattedMessage, { id: "ui.notification.event.button.accepted", defaultMessage: "ui.notification.event.button.accepted" })) : (_jsx(FormattedMessage, { id: "ui.notification.event.button.accept", defaultMessage: "ui.notification.event.button.accept" })) }))) : (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: _jsx(FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" }) }))) }))] }))) : (_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
68
81
  }
69
82
  return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, `${PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: _jsx(Link, Object.assign({}, (!notificationObject.user.deleted && {
70
83
  to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
@@ -76,5 +89,10 @@ export default function EventNotification(props) {
76
89
  icon: (...chunks) => _jsx(Icon, { children: chunks }),
77
90
  event: notificationObject.event.name,
78
91
  link: (...chunks) => _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: chunks }))
79
- } }), _jsx(EventItem, { event: notificationObject.event, actions: _jsx(_Fragment, {}), elevation: 0 })] }), actions: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }), _jsx(LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: _jsx(FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" }) }))] })) }, rest)), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
92
+ } }), _jsx(EventItem, { event: notificationObject.event, actions: _jsx(_Fragment, {}), elevation: 0 })] }), actions: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }), _jsx(LoadingButton, Object.assign({ disabled: disabled, loading: loading || scEventsManager.isLoading(notificationObject.event), color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton } }, (notificationObject.type !== SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT && {
93
+ component: Link,
94
+ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, notificationObject.event)
95
+ }), { onClick: notificationObject.type === SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT
96
+ ? () => acceptRequest(notificationObject.event)
97
+ : null }, { children: notificationObject.type === SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT ? (_jsx(_Fragment, { children: disabled ? (_jsx(FormattedMessage, { id: "ui.notification.event.button.accepted", defaultMessage: "ui.notification.event.button.accepted" })) : (_jsx(FormattedMessage, { id: "ui.notification.event.button.accept", defaultMessage: "ui.notification.event.button.accept" })) })) : (_jsx(FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" })) }))] })) }, rest)), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
80
98
  }
@@ -6,7 +6,10 @@ export interface SearchDialogProps extends DialogProps {
6
6
  * @default null
7
7
  */
8
8
  className?: string;
9
- SearchAutocompleteProps: SearchAutocompleteProps;
9
+ /**
10
+ * Overrides props for the SearchAutocomplete component.
11
+ */
12
+ SearchAutocompleteComponentProps: SearchAutocompleteProps;
10
13
  /**
11
14
  * Other props
12
15
  */
@@ -28,6 +28,6 @@ export default function Search(inProps) {
28
28
  props: inProps,
29
29
  name: PREFIX
30
30
  });
31
- const { className, SearchAutocompleteProps = { autoFocus: true } } = props, rest = __rest(props, ["className", "SearchAutocompleteProps"]);
32
- return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(DialogContent, { children: _jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: false, open: true, disablePortal: true }, SearchAutocompleteProps)) }) })));
31
+ const { className, SearchAutocompleteComponentProps = { autoFocus: true } } = props, rest = __rest(props, ["className", "SearchAutocompleteComponentProps"]);
32
+ return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(DialogContent, { children: _jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: false, open: true, disablePortal: true }, SearchAutocompleteComponentProps)) }) })));
33
33
  }
@@ -1,3 +1,4 @@
1
1
  export declare const LIVE_STREAM_TITLE_MAX_LENGTH = 100;
2
2
  export declare const LIVE_STREAM_SLUG_MAX_LENGTH = 50;
3
3
  export declare const LIVE_STREAM_DESCRIPTION_MAX_LENGTH = 500;
4
+ export declare const CHOICE_VIDEO_BLUR_EFFECT = "lk-video-blur";
@@ -1,3 +1,4 @@
1
1
  export const LIVE_STREAM_TITLE_MAX_LENGTH = 100;
2
2
  export const LIVE_STREAM_SLUG_MAX_LENGTH = 50;
3
3
  export const LIVE_STREAM_DESCRIPTION_MAX_LENGTH = 500;
4
+ export const CHOICE_VIDEO_BLUR_EFFECT = 'lk-video-blur';
@@ -16,7 +16,7 @@ import EventForm from '../../components/EventForm';
16
16
  import { ADD_EVENT_TO_CALENDAR, CANCEL_EVENT, GET_EVENT_LINK } from '../../constants/EventActionsMenu';
17
17
  import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
18
18
  import ConfirmDialog from '../../shared/ConfirmDialog/ConfirmDialog';
19
- import { checkEventFinished } from '../../utils/events';
19
+ import { checkEventFinished, formatDateForGC } from '../../utils/events';
20
20
  const PREFIX = 'SCEventActionsMenu';
21
21
  const classes = {
22
22
  root: `${PREFIX}-root`,
@@ -118,8 +118,12 @@ export default function EventActionsMenu(inProps) {
118
118
  });
119
119
  }
120
120
  const createGoogleCalendarLink = (event) => {
121
+ var _a;
121
122
  const baseUrl = 'https://www.google.com/calendar/render?action=TEMPLATE';
122
- return `${baseUrl}&text=${encodeURIComponent(event.name)}&details=${encodeURIComponent(event.description)}&location=${encodeURIComponent(event.geolocation)}&dates=${event.start_date}/${event.end_date}`;
123
+ const startDate = formatDateForGC(event.start_date);
124
+ const endDate = formatDateForGC(event.end_date);
125
+ const details = `${event.description ? event.description + '\n\n' : ''}${event.link ? 'Link: ' + event.link : ''}`;
126
+ return `${baseUrl}&text=${encodeURIComponent(event.name)}&details=${encodeURIComponent(details)}&location=${encodeURIComponent((_a = event.geolocation) !== null && _a !== void 0 ? _a : '')}&dates=${startDate}/${endDate}`;
123
127
  };
124
128
  /**
125
129
  * Handles actions
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { styled } from '@mui/material/styles';
4
4
  import { useThemeProps } from '@mui/system';
5
5
  import { FormattedMessage } from 'react-intl';
6
+ import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
6
7
  import { Chip, Tooltip } from '@mui/material';
7
8
  import { useMemo } from 'react';
8
9
  import { SCCommunitySubscriptionTier } from '@selfcommunity/types';
@@ -28,6 +29,11 @@ export default function UpScalingTierBadge(inProps) {
28
29
  name: PREFIX
29
30
  });
30
31
  const { className, desiredTier = SCCommunitySubscriptionTier.GO } = props, rest = __rest(props, ["className", "desiredTier"]);
32
+ const { preferences } = useSCPreferences();
33
+ const isEnterpriseTier = useMemo(() => preferences &&
34
+ SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
35
+ preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
36
+ preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.ENTERPRISE, [preferences]);
31
37
  const tooltipMsg = useMemo(() => {
32
38
  let _msg = _jsx(FormattedMessage, { id: "ui.upScalingTierBadge.goFeature", defaultMessage: "ui.upScalingTierBadge.goFeature" });
33
39
  switch (desiredTier) {
@@ -56,5 +62,8 @@ export default function UpScalingTierBadge(inProps) {
56
62
  }
57
63
  return _label;
58
64
  }, [desiredTier]);
65
+ if (desiredTier === SCCommunitySubscriptionTier.ENTERPRISE && isEnterpriseTier) {
66
+ return null;
67
+ }
59
68
  return (_jsx(Root, Object.assign({ classes: { root: classNames(className, classes.root) }, title: tooltipMsg, placement: "top" }, rest, { children: _jsx(Badge, { color: "secondary", size: "small", label: badgeLabel, className: classes.badge }) })));
60
69
  }
@@ -1 +1,2 @@
1
+ export declare const DEFAULT_COUNTERS_LIMIT = 3;
1
2
  export declare function numberFormatter(num: number): JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import { Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const DEFAULT_COUNTERS_LIMIT = 3;
2
3
  export function numberFormatter(num) {
3
- const surplus = num - 3;
4
+ const surplus = num === DEFAULT_COUNTERS_LIMIT ? 1 : num < DEFAULT_COUNTERS_LIMIT ? num : num - DEFAULT_COUNTERS_LIMIT;
4
5
  if (surplus > 999999) {
5
6
  return _jsxs(_Fragment, { children: ["+", (Math.abs(surplus) / 1000000).toFixed(1), "M"] });
6
7
  }
7
- else if (num > 999) {
8
+ else if (surplus > 999) {
8
9
  return _jsxs(_Fragment, { children: ["+", (Math.abs(surplus) / 1000).toFixed(1), "K"] });
9
10
  }
10
11
  return _jsxs(_Fragment, { children: ["+", surplus] });
@@ -51,8 +51,7 @@ export function getContributionSnippet(obj) {
51
51
  * @param handleUrl Func that handle urls
52
52
  */
53
53
  export function getContributionHtml(html, handleUrl) {
54
- const _html = html.replace(/<p\b[^>]*>(.*?)<\/p>/g, (match, content) => content);
55
- return _html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_-]+)<\/mention>/gi, (match, id, username) => {
54
+ return html.replace(/<mention.*? id="([0-9]+)"{1}.*?>@([a-z\d_-]+)<\/mention>/gi, (match, id, username) => {
56
55
  return `<a href='${handleUrl(SCRoutes.USER_PROFILE_ROUTE_NAME, { id, username })}'>@${username}</a>`;
57
56
  });
58
57
  }
@@ -1,2 +1,3 @@
1
1
  import { SCEventType } from '@selfcommunity/types';
2
2
  export declare function checkEventFinished(event: SCEventType | null): boolean;
3
+ export declare function formatDateForGC(eventDate: string): string;
@@ -4,3 +4,7 @@ export function checkEventFinished(event) {
4
4
  }
5
5
  return false;
6
6
  }
7
+ export function formatDateForGC(eventDate) {
8
+ const date = new Date(eventDate);
9
+ return date.toISOString().replace(/[-:]/g, '').split('.')[0] + 'Z';
10
+ }