@selfcommunity/react-ui 0.11.0-alpha.4 → 0.11.0-alpha.40

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 (131) 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 +10 -2
  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/CreateLiveStreamDialog/CreateLiveStreamDialog.js +11 -9
  9. package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +21 -12
  10. package/lib/cjs/components/Editor/Editor.js +9 -9
  11. package/lib/cjs/components/Editor/nodes/HashtagNode.js +2 -0
  12. package/lib/cjs/components/Editor/nodes/MentionNode.js +2 -0
  13. package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
  14. package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.js +34 -0
  15. package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
  16. package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.js +2 -3
  17. package/lib/cjs/components/Editor/plugins/ToolbarPlugin.js +1 -1
  18. package/lib/cjs/components/Event/Event.js +6 -3
  19. package/lib/cjs/components/EventForm/EventForm.js +7 -5
  20. package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
  21. package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +2 -2
  22. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +11 -11
  23. package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +9 -9
  24. package/lib/cjs/components/EventMembersWidget/types.d.ts +4 -5
  25. package/lib/cjs/components/EventMembersWidget/types.js +7 -7
  26. package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +5 -5
  27. package/lib/cjs/components/Events/Events.d.ts +11 -0
  28. package/lib/cjs/components/Events/Events.js +21 -10
  29. package/lib/cjs/components/Events/OngoingEventsFilter.d.ts +8 -0
  30. package/lib/cjs/components/Events/OngoingEventsFilter.js +24 -0
  31. package/lib/cjs/components/FeedObject/Activities/Activities.js +1 -1
  32. package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
  33. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
  34. package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +65 -6
  35. package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
  36. package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
  37. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
  38. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
  39. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
  40. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
  41. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +106 -0
  42. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
  43. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +37 -0
  44. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  45. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  46. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
  47. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
  48. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +60 -5
  49. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
  50. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +2 -2
  51. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
  52. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
  53. package/lib/cjs/components/SearchDialog/SearchDialog.d.ts +4 -1
  54. package/lib/cjs/components/SearchDialog/SearchDialog.js +2 -2
  55. package/lib/cjs/constants/LiveStream.d.ts +1 -0
  56. package/lib/cjs/constants/LiveStream.js +2 -1
  57. package/lib/cjs/shared/EventActionsMenu/index.js +5 -1
  58. package/lib/cjs/shared/UpScalingTierBadge/index.js +9 -0
  59. package/lib/cjs/utils/buttonCounters.d.ts +1 -0
  60. package/lib/cjs/utils/buttonCounters.js +4 -3
  61. package/lib/cjs/utils/contribution.js +1 -2
  62. package/lib/cjs/utils/events.d.ts +1 -0
  63. package/lib/cjs/utils/events.js +6 -1
  64. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
  65. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
  66. package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
  67. package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
  68. package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +11 -3
  69. package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +1 -1
  70. package/lib/esm/components/CreateEventButton/CreateEventButton.js +1 -1
  71. package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +11 -9
  72. package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +23 -14
  73. package/lib/esm/components/Editor/Editor.js +8 -8
  74. package/lib/esm/components/Editor/nodes/HashtagNode.js +2 -0
  75. package/lib/esm/components/Editor/nodes/MentionNode.js +2 -0
  76. package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
  77. package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.js +30 -0
  78. package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
  79. package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.js +1 -1
  80. package/lib/esm/components/Editor/plugins/ToolbarPlugin.js +1 -1
  81. package/lib/esm/components/Event/Event.js +6 -3
  82. package/lib/esm/components/EventForm/EventForm.js +8 -6
  83. package/lib/esm/components/EventHeader/EventHeader.js +1 -1
  84. package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +2 -2
  85. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +12 -12
  86. package/lib/esm/components/EventMembersWidget/TabContentComponent.js +10 -10
  87. package/lib/esm/components/EventMembersWidget/types.d.ts +4 -5
  88. package/lib/esm/components/EventMembersWidget/types.js +6 -6
  89. package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +5 -5
  90. package/lib/esm/components/Events/Events.d.ts +11 -0
  91. package/lib/esm/components/Events/Events.js +22 -11
  92. package/lib/esm/components/Events/OngoingEventsFilter.d.ts +8 -0
  93. package/lib/esm/components/Events/OngoingEventsFilter.js +21 -0
  94. package/lib/esm/components/FeedObject/Activities/Activities.js +1 -1
  95. package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
  96. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
  97. package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +67 -8
  98. package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
  99. package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
  100. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
  101. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
  102. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
  103. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
  104. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +103 -0
  105. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
  106. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +34 -0
  107. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
  108. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
  109. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
  110. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
  111. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +64 -9
  112. package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
  113. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +2 -2
  114. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
  115. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
  116. package/lib/esm/components/SearchDialog/SearchDialog.d.ts +4 -1
  117. package/lib/esm/components/SearchDialog/SearchDialog.js +2 -2
  118. package/lib/esm/constants/LiveStream.d.ts +1 -0
  119. package/lib/esm/constants/LiveStream.js +1 -0
  120. package/lib/esm/shared/EventActionsMenu/index.js +6 -2
  121. package/lib/esm/shared/UpScalingTierBadge/index.js +9 -0
  122. package/lib/esm/utils/buttonCounters.d.ts +1 -0
  123. package/lib/esm/utils/buttonCounters.js +3 -2
  124. package/lib/esm/utils/contribution.js +1 -2
  125. package/lib/esm/utils/events.d.ts +1 -0
  126. package/lib/esm/utils/events.js +4 -0
  127. package/lib/umd/336.js +2 -0
  128. package/lib/umd/react-ui.js +1 -1
  129. package/package.json +11 -10
  130. package/lib/umd/653.js +0 -2
  131. /package/lib/umd/{653.js.LICENSE.txt → 336.js.LICENSE.txt} +0 -0
@@ -22,6 +22,11 @@ export interface CategoryAutocompleteProps extends Pick<AutocompleteProps<SCCate
22
22
  * @param value
23
23
  */
24
24
  onChange?: (value: any) => void;
25
+ /**
26
+ * Feed API Query Params
27
+ * @default [{'limit': 10, 'offset': 0}]
28
+ */
29
+ endpointQueryParams?: Record<string, string | number | boolean>;
25
30
  }
26
31
  /**
27
32
  * > API documentation for the Community-JS Category Autocomplete component. Learn about the available props and the CSS API.
@@ -51,17 +51,17 @@ const CategoryAutocomplete = (inProps) => {
51
51
  name: PREFIX
52
52
  });
53
53
  // Props
54
- const { onChange, multiple = false, defaultValue = multiple ? [] : null, limitCountCategories = 0, checkboxSelect = false, disabled = false, TextFieldProps = {
54
+ const { onChange, multiple = false, defaultValue = multiple ? [] : null, limitCountCategories = 0, checkboxSelect = false, disabled = false, endpointQueryParams = {}, TextFieldProps = {
55
55
  variant: 'outlined',
56
56
  label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.categoryAutocomplete.label", defaultMessage: "ui.categoryAutocomplete.label" })
57
- } } = props, rest = tslib_1.__rest(props, ["onChange", "multiple", "defaultValue", "limitCountCategories", "checkboxSelect", "disabled", "TextFieldProps"]);
57
+ } } = props, rest = tslib_1.__rest(props, ["onChange", "multiple", "defaultValue", "limitCountCategories", "checkboxSelect", "disabled", "endpointQueryParams", "TextFieldProps"]);
58
58
  // State
59
59
  const [open, setOpen] = (0, react_1.useState)(false);
60
60
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
61
61
  // @ts-ignore
62
62
  const [value, setValue] = (0, react_1.useState)(typeof defaultValue === 'string' ? null : defaultValue);
63
63
  // HOOKS
64
- const { categories, isLoading } = (0, react_core_1.useSCFetchCategories)();
64
+ const { categories, isLoading } = (0, react_core_1.useSCFetchCategories)({ endpointQueryParams });
65
65
  (0, react_1.useEffect)(() => {
66
66
  if (value === null) {
67
67
  return;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { BoxProps } from '@mui/material';
3
- import { SCCategoryType } from '@selfcommunity/types/src/index';
3
+ import { SCCategoryType } from '@selfcommunity/types';
4
4
  import { ComposerLayerProps } from '../../../../types/composer';
5
5
  export interface CategoryLayerProps extends Omit<BoxProps, 'defaultValue'>, ComposerLayerProps {
6
6
  defaultValue: SCCategoryType[];
@@ -6,6 +6,7 @@ const react_1 = tslib_1.__importStar(require("react"));
6
6
  const react_intl_1 = require("react-intl");
7
7
  const material_1 = require("@mui/material");
8
8
  const styles_1 = require("@mui/material/styles");
9
+ const react_core_1 = require("@selfcommunity/react-core");
9
10
  const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
10
11
  const CategoryAutocomplete_1 = tslib_1.__importDefault(require("../../../CategoryAutocomplete"));
11
12
  const DialogContent_1 = tslib_1.__importDefault(require("@mui/material/DialogContent"));
@@ -25,9 +26,11 @@ const CategoryLayer = react_1.default.forwardRef((props, ref) => {
25
26
  const { className, onClose, onSave, defaultValue = [] } = props, rest = tslib_1.__rest(props, ["className", "onClose", "onSave", "defaultValue"]);
26
27
  // STATE
27
28
  const [value, setValue] = (0, react_1.useState)(defaultValue);
29
+ // CONTEXT
30
+ const scUserContext = (0, react_core_1.useSCUser)();
28
31
  // HANDLERS
29
32
  const handleSave = (0, react_1.useCallback)(() => onSave(value), [value, onSave]);
30
33
  const handleChange = (0, react_1.useCallback)((categories) => setValue(categories), []);
31
- return (0, jsx_runtime_1.jsxs)(Root, Object.assign({ ref: ref, className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.DialogTitle, Object.assign({ className: classes.title }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "arrow_back" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.layer.category.title", defaultMessage: "ui.composer.layer.category.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: "secondary", variant: "contained", onClick: handleSave }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.layer.save", defaultMessage: "ui.composer.layer.save" }) }))] })), (0, jsx_runtime_1.jsx)(DialogContent_1.default, Object.assign({ className: classes.content }, { children: (0, jsx_runtime_1.jsx)(CategoryAutocomplete_1.default, { multiple: true, onChange: handleChange, defaultValue: defaultValue }) }))] }));
34
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ ref: ref, className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.DialogTitle, Object.assign({ className: classes.title }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "arrow_back" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.layer.category.title", defaultMessage: "ui.composer.layer.category.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: "secondary", variant: "contained", onClick: handleSave }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composer.layer.save", defaultMessage: "ui.composer.layer.save" }) }))] })), (0, jsx_runtime_1.jsx)(DialogContent_1.default, Object.assign({ className: classes.content }, { children: (0, jsx_runtime_1.jsx)(CategoryAutocomplete_1.default, Object.assign({ multiple: true, onChange: handleChange, defaultValue: defaultValue }, (!react_core_1.UserUtils.isStaff(scUserContext.user) && { endpointQueryParams: { can_create_content: true } }))) }))] })));
32
35
  });
33
36
  exports.default = CategoryLayer;
@@ -13,6 +13,7 @@ const EventFormDialog_1 = tslib_1.__importDefault(require("../EventFormDialog"))
13
13
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
14
14
  const GroupForm_1 = tslib_1.__importDefault(require("../GroupForm"));
15
15
  const CreateLiveStreamDialog_1 = tslib_1.__importDefault(require("../CreateLiveStreamDialog"));
16
+ const types_1 = require("@selfcommunity/types");
16
17
  const PREFIX = 'SCComposerIconButton';
17
18
  const classes = {
18
19
  root: `${PREFIX}-root`,
@@ -83,10 +84,17 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
83
84
  // HOOKS
84
85
  const theme = (0, material_1.useTheme)();
85
86
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
87
+ const { preferences } = (0, react_core_1.useSCPreferences)();
86
88
  // MEMOS
87
89
  const canCreateGroup = (0, react_1.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_group; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
88
90
  const canCreateEvent = (0, react_1.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_event; }, [(_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission]);
89
- const canCreateLiveStream = (0, react_1.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; }, [(_c = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _c === void 0 ? void 0 : _c.permission]);
91
+ const canCreateLive = (0, react_1.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; }, [(_c = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _c === void 0 ? void 0 : _c.permission]);
92
+ const isCommunityOwner = (0, react_1.useMemo)(() => { var _a; return ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) === 1; }, [scUserContext.user]);
93
+ const isFreeTrialTier = (0, react_1.useMemo)(() => preferences &&
94
+ react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
95
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
96
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === types_1.SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
97
+ const canCreateLiveStream = (0, react_1.useMemo)(() => (isFreeTrialTier && isCommunityOwner && canCreateLive) || (!isFreeTrialTier && canCreateLive), [isFreeTrialTier, isCommunityOwner, canCreateLive]);
90
98
  const renderContent = (0, react_1.useMemo)(() => {
91
99
  return ((0, jsx_runtime_1.jsx)(material_1.MenuList, { children: listItem.map((item, i) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ onClick: item.onClick }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: item.icon })) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: item.text, defaultMessage: item.text }) })) })] }), i))) }));
92
100
  }, [listItem]);
@@ -182,5 +190,5 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
182
190
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleClick, ref: (innerRef) => {
183
191
  popperRef.current = innerRef;
184
192
  return ref;
185
- } }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "add_circle_outline" }) })), openComposer && (0, jsx_runtime_1.jsx)(Composer_1.default, Object.assign({ open: openComposer, fullWidth: true, onClose: handleCloseComposer, onSuccess: handleSuccess }, ComposerProps)), openPopper && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.SwipeableDrawer, Object.assign({ open: true, onClose: handleCloseMenu, onOpen: () => null, anchor: "bottom", disableSwipeToOpen: true }, { children: renderContent }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ open: true, anchorEl: popperRef.current, role: undefined, className: classes.menuRoot, onClose: handleCloseMenu }, PopperProps, { children: renderContent }))) })), openCreateGroup && (0, jsx_runtime_1.jsx)(GroupForm_1.default, Object.assign({ open: openCreateGroup, onClose: handleCloseCreateGroup }, GroupFormProps)), openCreateEvent && (0, jsx_runtime_1.jsx)(EventFormDialog_1.default, Object.assign({ open: openCreateEvent, onClose: handleCloseCreateEvent }, EventFormDialogComponentProps)), openCreateLiveStream && ((0, jsx_runtime_1.jsx)(CreateLiveStreamDialog_1.default, Object.assign({ open: openCreateLiveStream, onClose: handleCloseCreateLiveStream }, CreateLiveStreamDialogComponentProps)))] }));
193
+ } }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "add_circle_outline" }) })), openComposer && (0, jsx_runtime_1.jsx)(Composer_1.default, Object.assign({ open: true, fullWidth: true, onClose: handleCloseComposer, onSuccess: handleSuccess }, ComposerProps)), openPopper && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.SwipeableDrawer, Object.assign({ open: true, onClose: handleCloseMenu, onOpen: () => null, anchor: "bottom", disableSwipeToOpen: true }, { children: renderContent }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ open: true, anchorEl: popperRef.current, role: undefined, className: classes.menuRoot, onClose: handleCloseMenu }, PopperProps, { children: renderContent }))) })), openCreateGroup && (0, jsx_runtime_1.jsx)(GroupForm_1.default, Object.assign({ open: true, onClose: handleCloseCreateGroup }, GroupFormProps)), openCreateEvent && (0, jsx_runtime_1.jsx)(EventFormDialog_1.default, Object.assign({ open: true, onClose: handleCloseCreateEvent }, EventFormDialogComponentProps)), openCreateLiveStream && (0, jsx_runtime_1.jsx)(CreateLiveStreamDialog_1.default, Object.assign({ open: true, onClose: handleCloseCreateLiveStream }, CreateLiveStreamDialogComponentProps))] }));
186
194
  });
@@ -7,7 +7,7 @@ export interface CreateEventButtonProps extends ButtonProps {
7
7
  */
8
8
  className?: string;
9
9
  /**
10
- * Props to spread to CreateGroup component
10
+ * Props to spread to CreateEvent component
11
11
  * @default empty object
12
12
  */
13
13
  EventFormDialogComponentProps?: EventFormDialogProps;
@@ -18,7 +18,7 @@ const classes = {
18
18
  const Root = (0, styles_1.styled)(material_1.Button, {
19
19
  name: PREFIX,
20
20
  slot: 'Root',
21
- overridesResolver: (props, styles) => styles.root
21
+ overridesResolver: (_props, styles) => styles.root
22
22
  })(() => ({}));
23
23
  /**
24
24
  *> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
@@ -25,10 +25,11 @@ const classes = {
25
25
  const Root = (0, styles_1.styled)(BaseDialog_1.default, {
26
26
  name: constants_1.PREFIX,
27
27
  slot: 'Root'
28
- })(({ theme }) => ({
28
+ })(() => ({
29
29
  paddingBottom: '0px !important',
30
30
  [`& .${classes.title}`]: {
31
- display: 'flex'
31
+ display: 'flex',
32
+ alignItems: 'center'
32
33
  },
33
34
  [`& .${classes.content}`]: {
34
35
  paddingBottom: 0
@@ -58,7 +59,7 @@ const Transition = react_1.default.forwardRef(function Transition(props, ref) {
58
59
  * @param inProps
59
60
  */
60
61
  function CreateLiveStreamDialog(inProps) {
61
- var _a, _b;
62
+ var _a;
62
63
  //PROPS
63
64
  const props = (0, system_1.useThemeProps)({
64
65
  props: inProps,
@@ -67,11 +68,12 @@ function CreateLiveStreamDialog(inProps) {
67
68
  const { className, open = true, onClose, onSuccess } = props, rest = tslib_1.__rest(props, ["className", "open", "onClose", "onSuccess"]);
68
69
  // CONTEXT
69
70
  const scUserContext = (0, react_core_1.useSCUser)();
70
- const canCreateLiveStream = (0, react_1.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]);
71
- const canCreateEvent = (0, react_1.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_event; }, [(_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission]);
71
+ // PERMISSION
72
+ const canCreateEvent = (0, react_1.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_event; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
72
73
  // STATE
73
74
  const [step, setStep] = (0, react_1.useState)(canCreateEvent ? types_2.CreateLiveStreamStep.SELECT_TYPE : types_2.CreateLiveStreamStep.CREATE_LIVE);
74
75
  const [liveType, setLiveType] = (0, react_1.useState)(canCreateEvent ? null : types_2.LiveStreamType.DIRECT_LIVE);
76
+ const canShowBackButton = (0, react_1.useMemo)(() => step === types_2.CreateLiveStreamStep.CREATE_LIVE && canCreateEvent, [step, canCreateEvent]);
75
77
  // HANDLER
76
78
  const handleLiveTypeSelected = (0, react_1.useCallback)((l) => {
77
79
  setLiveType(l);
@@ -80,24 +82,24 @@ function CreateLiveStreamDialog(inProps) {
80
82
  setLiveType(l);
81
83
  setStep(types_2.CreateLiveStreamStep.CREATE_LIVE);
82
84
  }, []);
83
- const handleBack = (0, react_1.useCallback)((l) => {
85
+ const handleBack = (0, react_1.useCallback)(() => {
84
86
  setStep(types_2.CreateLiveStreamStep.SELECT_TYPE);
85
87
  }, []);
86
88
  const handleSubmit = (0, react_1.useCallback)((e) => {
87
89
  onSuccess && onSuccess(e);
88
- }, []);
90
+ }, [onSuccess]);
89
91
  (0, react_1.useEffect)(() => {
90
92
  if (!canCreateEvent) {
91
93
  setLiveType(types_2.LiveStreamType.DIRECT_LIVE);
92
94
  }
93
95
  }, [canCreateEvent]);
94
96
  // user must be logged
95
- if (!scUserContext.user || !canCreateLiveStream) {
97
+ if (!scUserContext.user) {
96
98
  return null;
97
99
  }
98
100
  /**
99
101
  * Renders root object
100
102
  */
101
- return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: 'md', title: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.title, component: 'span' }, { children: [Boolean(step === types_2.CreateLiveStreamStep.CREATE_LIVE && canCreateEvent) && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "arrow_back" }) }, { children: "Back" }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: 'span' }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: 'paper', onClose: onClose, className: (0, classnames_1.default)(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [step === types_2.CreateLiveStreamStep.SELECT_TYPE && ((0, jsx_runtime_1.jsx)(LiveStreamSelector_1.default, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === types_2.CreateLiveStreamStep.CREATE_LIVE && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: liveType === types_2.LiveStreamType.EVENT_LIVE ? ((0, jsx_runtime_1.jsx)(EventForm_1.default, { EventAddressComponentProps: { locations: [types_1.SCEventLocationType.LIVESTREAM] }, onSuccess: handleSubmit })) : ((0, jsx_runtime_1.jsx)(LiveStreamForm_1.default, { onSuccess: handleSubmit })) }))] })) })));
103
+ return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: "md", title: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.title, component: "span" }, { children: [canShowBackButton && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "arrow_back" }) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createLivestreamDialog.button.back", defaultMessage: "ui.createLivestreamDialog.button.back" }) }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "span" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: "body", onClose: !canShowBackButton ? onClose : undefined, className: (0, classnames_1.default)(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.content }, { children: [step === types_2.CreateLiveStreamStep.SELECT_TYPE && ((0, jsx_runtime_1.jsx)(LiveStreamSelector_1.default, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === types_2.CreateLiveStreamStep.CREATE_LIVE && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: liveType === types_2.LiveStreamType.EVENT_LIVE ? ((0, jsx_runtime_1.jsx)(EventForm_1.default, { EventAddressComponentProps: { locations: [types_1.SCEventLocationType.LIVESTREAM] }, onSuccess: handleSubmit })) : ((0, jsx_runtime_1.jsx)(LiveStreamForm_1.default, { onSuccess: handleSubmit })) }))] })) })));
102
104
  }
103
105
  exports.default = CreateLiveStreamDialog;
@@ -6,7 +6,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("react");
7
7
  const styles_1 = require("@mui/material/styles");
8
8
  const material_1 = require("@mui/material");
9
- const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
10
9
  const system_1 = require("@mui/system");
11
10
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
12
11
  const types_1 = require("../types");
@@ -35,7 +34,12 @@ const OptionCard = (0, styles_1.styled)(material_1.Paper, {
35
34
  name: exports.PREFIX,
36
35
  slot: 'optionCardRoot',
37
36
  shouldForwardProp: (prop) => prop !== 'selected'
38
- })(({ theme, selected }) => ({}));
37
+ })(({ theme, selected }) => ({
38
+ '& h6': {
39
+ fontWeight: 'bold',
40
+ textTransform: 'uppercase'
41
+ }
42
+ }));
39
43
  const FeatureItem = (0, styles_1.styled)(material_1.Box, {
40
44
  name: exports.PREFIX,
41
45
  slot: 'featureItemRoot'
@@ -80,6 +84,14 @@ function LiveStreamSelector(inProps) {
80
84
  react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
81
85
  preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
82
86
  preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === types_2.SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
87
+ const isEnterpriseTier = (0, react_1.useMemo)(() => preferences &&
88
+ react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
89
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
90
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === types_2.SCCommunitySubscriptionTier.ENTERPRISE, [preferences]);
91
+ const isStage = (0, react_1.useMemo)(() => preferences &&
92
+ react_core_1.SCPreferences.STATIC_ENVIRONMENT in preferences &&
93
+ preferences[react_core_1.SCPreferences.STATIC_ENVIRONMENT].value === types_2.SCCommunityEnvironment.STAGE, [preferences]);
94
+ const communityStackId = (0, react_1.useMemo)(() => preferences && react_core_1.SCPreferences.STATIC_ENVIRONMENT in preferences && preferences[react_core_1.SCPreferences.STATIC_STACKID].value, [preferences]);
83
95
  const intl = (0, react_intl_1.useIntl)();
84
96
  const options = [
85
97
  {
@@ -99,8 +111,7 @@ function LiveStreamSelector(inProps) {
99
111
  id: 'ui.liveStreamForm.selector.scheduleLiveEventItem3',
100
112
  defaultMessage: 'ui.liveStreamForm.selector.scheduleLiveEventItem3'
101
113
  })
102
- ],
103
- icons: [(0, jsx_runtime_1.jsx)(Icon_1.default, { children: "chevron_right" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "chevron_right" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "chevron_right" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "chevron_right" })]
114
+ ]
104
115
  },
105
116
  {
106
117
  title: intl.formatMessage({
@@ -122,8 +133,7 @@ function LiveStreamSelector(inProps) {
122
133
  id: 'ui.liveStreamForm.selector.scheduleLiveStreamItem3',
123
134
  defaultMessage: 'ui.liveStreamForm.selector.scheduleLiveStreamItem3'
124
135
  })
125
- ],
126
- icons: [(0, jsx_runtime_1.jsx)(Icon_1.default, { children: "chevron_right" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "chevron_right" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "chevron_right" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "chevron_right" })]
136
+ ]
127
137
  }
128
138
  ];
129
139
  const handleOptionSelect = (type) => {
@@ -155,11 +165,11 @@ function LiveStreamSelector(inProps) {
155
165
  }, []);
156
166
  const warning = (0, react_1.useMemo)(() => {
157
167
  let _message;
158
- if (isFreeTrialTier && isCommunityOwner) {
168
+ if (isFreeTrialTier && isCommunityOwner && !isEnterpriseTier) {
159
169
  _message = ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.selector.warningSubscriptionRequired", defaultMessage: "ui.liveStreamForm.selector.warningSubscriptionRequired", values: {
160
170
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
161
171
  // @ts-ignore
162
- link: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: constants_2.SELFCOMMUNITY_PRICING[scContext.settings.locale.default] }, { children: chunks }))
172
+ link: (...chunks) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "_blank", to: `${isStage ? constants_2.HUB_STAGE : constants_2.HUB_PROD}dashboard/community/${communityStackId}/subscription` }, { children: chunks })))
163
173
  } }));
164
174
  }
165
175
  else if (timeRemaining !== null && timeRemaining <= constants_1.WARNING_THRESHOLD_EXPIRING_SOON) {
@@ -175,14 +185,13 @@ function LiveStreamSelector(inProps) {
175
185
  }
176
186
  return null;
177
187
  }, [timeRemaining, isFreeTrialTier]);
178
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), maxWidth: "lg", sx: { py: 4 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", component: "h1", align: "center", gutterBottom: true, sx: { mb: 4, fontWeight: 500 } }, { children: "How do you want to go live?" })), warning, (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.options }, { children: options.map((option, index) => ((0, jsx_runtime_1.jsxs)(OptionCard, Object.assign({ selected: selectedOption === option.type, onClick: () => handleOptionSelect(option.type), elevation: 0, role: "button", tabIndex: 0, onKeyDown: (e) => {
188
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), maxWidth: "lg", sx: { py: 4 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", component: "h1", align: "center", gutterBottom: true, sx: { mb: 4, fontWeight: 500 } }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.selector.title", defaultMessage: "ui.liveStreamForm.selector.title" }) })), warning, (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.options }, { children: options.map((option, index) => ((0, jsx_runtime_1.jsxs)(OptionCard, Object.assign({ selected: selectedOption === option.type, onClick: () => handleOptionSelect(option.type), elevation: 0, role: "button", tabIndex: 0, onKeyDown: (e) => {
179
189
  if (e.key === 'Enter' || e.key === ' ') {
180
190
  handleOptionSelect(index);
181
191
  e.preventDefault();
182
192
  }
183
- }, theme: undefined }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", component: "h2", sx: { fontWeight: 500 } }, { children: option.title })), (0, jsx_runtime_1.jsx)(material_1.Radio, { checked: selectedOption === option.type })] }), (0, jsx_runtime_1.jsx)("img", { src: option.image, alt: "logo" }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "ul" }, { children: option.features.map((feature, featureIndex) => {
184
- const _Icon = option.icons[featureIndex];
185
- return ((0, jsx_runtime_1.jsxs)(FeatureItem, Object.assign({ component: "li" }, { children: [_Icon, (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "text.secondary", sx: { flex: 1 } }, { children: feature }))] }), featureIndex));
193
+ } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: option.title })), (0, jsx_runtime_1.jsx)(material_1.Radio, { checked: selectedOption === option.type })] }), (0, jsx_runtime_1.jsx)("img", { src: option.image, alt: "option-image" }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: "ul" }, { children: option.features.map((feature, featureIndex) => {
194
+ return ((0, jsx_runtime_1.jsx)(FeatureItem, Object.assign({ component: "li" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "text.secondary", sx: { flex: 1 } }, { children: feature })) }), featureIndex));
186
195
  }) }))] }), index))) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ disabled: !selectedOption || !timeRemaining || isFreeTrialTier, variant: "contained", onClick: handleNext, color: "secondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.selector.next", defaultMessage: "ui.liveStreamForm.selector.next" }) })) }))] })));
187
196
  }
188
197
  exports.default = LiveStreamSelector;
@@ -11,19 +11,19 @@ const system_1 = require("@mui/system");
11
11
  const nodes_1 = tslib_1.__importDefault(require("./nodes"));
12
12
  const LexicalComposer_1 = require("@lexical/react/LexicalComposer");
13
13
  const LexicalContentEditable_1 = require("@lexical/react/LexicalContentEditable");
14
- const LexicalHistoryPlugin_1 = require("@lexical/react/LexicalHistoryPlugin");
14
+ const ToolbarPlugin_1 = tslib_1.__importDefault(require("./plugins/ToolbarPlugin"));
15
+ const constants_1 = require("./constants");
16
+ const HorizontalRulePlugin_1 = require("./plugins/HorizontalRulePlugin");
15
17
  const LexicalRichTextPlugin_1 = require("./plugins/LexicalRichTextPlugin");
16
- const LexicalErrorBoundary_1 = tslib_1.__importDefault(require("@lexical/react/LexicalErrorBoundary"));
17
- const LexicalHorizontalRulePlugin_1 = require("@lexical/react/LexicalHorizontalRulePlugin");
18
+ const LexicalErrorBoundary_1 = require("@lexical/react/LexicalErrorBoundary");
18
19
  const plugins_1 = require("./plugins");
20
+ const OnBlurPlugin_1 = tslib_1.__importDefault(require("./plugins/OnBlurPlugin"));
21
+ const OnFocusPlugin_1 = tslib_1.__importDefault(require("./plugins/OnFocusPlugin"));
19
22
  const LexicalLinkPlugin_1 = require("@lexical/react/LexicalLinkPlugin");
23
+ const FloatingLinkPlugin_1 = tslib_1.__importDefault(require("./plugins/FloatingLinkPlugin"));
20
24
  const ApiPlugin_1 = tslib_1.__importDefault(require("./plugins/ApiPlugin"));
21
- const ToolbarPlugin_1 = tslib_1.__importDefault(require("./plugins/ToolbarPlugin"));
25
+ const LexicalHistoryPlugin_1 = require("@lexical/react/LexicalHistoryPlugin");
22
26
  const LexicalListPlugin_1 = require("@lexical/react/LexicalListPlugin");
23
- const FloatingLinkPlugin_1 = tslib_1.__importDefault(require("./plugins/FloatingLinkPlugin"));
24
- const OnBlurPlugin_1 = tslib_1.__importDefault(require("./plugins/OnBlurPlugin"));
25
- const OnFocusPlugin_1 = tslib_1.__importDefault(require("./plugins/OnFocusPlugin"));
26
- const constants_1 = require("./constants");
27
27
  const classes = {
28
28
  root: `${constants_1.PREFIX}-root`,
29
29
  focused: `${constants_1.PREFIX}-focused`,
@@ -145,6 +145,6 @@ const Editor = (inProps, ref) => {
145
145
  nodes: [...nodes_1.default],
146
146
  theme: editorTheme
147
147
  }), [editable]);
148
- return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, { [classes.toolbar]: toolbar, [classes.focused]: focused }) }, { children: (0, jsx_runtime_1.jsxs)(LexicalComposer_1.LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [toolbar ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolbarPlugin_1.default, { uploadImage: uploadImage }), (0, jsx_runtime_1.jsx)(LexicalListPlugin_1.ListPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalHorizontalRulePlugin_1.HorizontalRulePlugin, {})] })) : ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actions, direction: "row" }, { children: [uploadImage && (0, jsx_runtime_1.jsx)(plugins_1.ImagePlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.EmojiPlugin, {})] }))), (0, jsx_runtime_1.jsx)(LexicalRichTextPlugin_1.RichTextPlugin, { contentEditable: (0, jsx_runtime_1.jsx)(LexicalContentEditable_1.ContentEditable, { className: classes.content }), placeholder: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.placeholder, onClick: handleFocus }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editor.placeholder", defaultMessage: "ui.editor.placeholder" }) })), ErrorBoundary: LexicalErrorBoundary_1.default }), (0, jsx_runtime_1.jsx)(plugins_1.DefaultHtmlValuePlugin, { defaultValue: defaultValue }), (0, jsx_runtime_1.jsx)(LexicalHistoryPlugin_1.HistoryPlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.OnChangePlugin, { onChange: handleChange }), (0, jsx_runtime_1.jsx)(OnBlurPlugin_1.default, { onBlur: handleHasBlur }), (0, jsx_runtime_1.jsx)(OnFocusPlugin_1.default, { onFocus: handleHasFocus }), (0, jsx_runtime_1.jsx)(plugins_1.AutoLinkPlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.MentionsPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalLinkPlugin_1.LinkPlugin, {}), (0, jsx_runtime_1.jsx)(FloatingLinkPlugin_1.default, {}), (0, jsx_runtime_1.jsx)(ApiPlugin_1.default, { ref: apiRef })] })) })));
148
+ return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, { [classes.toolbar]: toolbar, [classes.focused]: focused }) }, { children: (0, jsx_runtime_1.jsxs)(LexicalComposer_1.LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [toolbar ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolbarPlugin_1.default, { uploadImage: uploadImage }), (0, jsx_runtime_1.jsx)(LexicalListPlugin_1.ListPlugin, {}), (0, jsx_runtime_1.jsx)(HorizontalRulePlugin_1.HorizontalRulePlugin, {})] })) : ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actions, direction: "row" }, { children: [uploadImage && (0, jsx_runtime_1.jsx)(plugins_1.ImagePlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.EmojiPlugin, {})] }))), (0, jsx_runtime_1.jsx)(LexicalRichTextPlugin_1.RichTextPlugin, { contentEditable: (0, jsx_runtime_1.jsx)(LexicalContentEditable_1.ContentEditable, { className: classes.content }), placeholder: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.placeholder, onClick: handleFocus }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editor.placeholder", defaultMessage: "ui.editor.placeholder" }) })), ErrorBoundary: LexicalErrorBoundary_1.LexicalErrorBoundary }), (0, jsx_runtime_1.jsx)(plugins_1.DefaultHtmlValuePlugin, { defaultValue: defaultValue }), (0, jsx_runtime_1.jsx)(LexicalHistoryPlugin_1.HistoryPlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.OnChangePlugin, { onChange: handleChange }), (0, jsx_runtime_1.jsx)(OnBlurPlugin_1.default, { onBlur: handleHasBlur }), (0, jsx_runtime_1.jsx)(OnFocusPlugin_1.default, { onFocus: handleHasFocus }), (0, jsx_runtime_1.jsx)(plugins_1.AutoLinkPlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.MentionsPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalLinkPlugin_1.LinkPlugin, {}), (0, jsx_runtime_1.jsx)(FloatingLinkPlugin_1.default, {}), (0, jsx_runtime_1.jsx)(ApiPlugin_1.default, { ref: apiRef })] })) })));
149
149
  };
150
150
  exports.default = (0, react_1.forwardRef)(Editor);
@@ -36,6 +36,8 @@ class HashtagNode extends lexical_1.TextNode {
36
36
  if (inner === null) {
37
37
  return true;
38
38
  }
39
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
40
+ // @ts-ignore
39
41
  super.updateDOM(prevNode, inner, config);
40
42
  return false;
41
43
  }
@@ -50,6 +50,8 @@ class MentionNode extends lexical_1.TextNode {
50
50
  if (inner === null) {
51
51
  return true;
52
52
  }
53
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
54
+ // @ts-ignore
53
55
  super.updateDOM(prevNode, inner, config);
54
56
  return false;
55
57
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ export declare function HorizontalRulePlugin(): null;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.HorizontalRulePlugin = void 0;
11
+ const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
12
+ const LexicalHorizontalRuleNode_1 = require("@lexical/react/LexicalHorizontalRuleNode");
13
+ const utils_1 = require("@lexical/utils");
14
+ const lexical_1 = require("lexical");
15
+ const react_1 = require("react");
16
+ function HorizontalRulePlugin() {
17
+ const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
18
+ (0, react_1.useEffect)(() => {
19
+ return editor.registerCommand(LexicalHorizontalRuleNode_1.INSERT_HORIZONTAL_RULE_COMMAND, (type) => {
20
+ const selection = (0, lexical_1.$getSelection)();
21
+ if (!(0, lexical_1.$isRangeSelection)(selection)) {
22
+ return false;
23
+ }
24
+ const focusNode = selection.focus.getNode();
25
+ if (focusNode !== null) {
26
+ const horizontalRuleNode = (0, LexicalHorizontalRuleNode_1.$createHorizontalRuleNode)();
27
+ (0, utils_1.$insertNodeToNearestRoot)(horizontalRuleNode);
28
+ }
29
+ return true;
30
+ }, lexical_1.COMMAND_PRIORITY_EDITOR);
31
+ }, [editor]);
32
+ return null;
33
+ }
34
+ exports.HorizontalRulePlugin = HorizontalRulePlugin;
@@ -1,6 +1,6 @@
1
1
  import { ErrorBoundaryType } from '../shared/useDecorators';
2
2
  export declare function RichTextPlugin({ contentEditable, placeholder, ErrorBoundary }: {
3
3
  contentEditable: JSX.Element;
4
- placeholder: ((isEditable: boolean) => null | JSX.Element) | null | JSX.Element;
5
- ErrorBoundary: ErrorBoundaryType;
4
+ placeholder?: ((isEditable: boolean) => null | JSX.Element) | null | JSX.Element;
5
+ ErrorBoundary?: ErrorBoundaryType;
6
6
  }): JSX.Element;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RichTextPlugin = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const jsx_runtime_1 = require("react/jsx-runtime");
6
5
  const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
7
- const useLexicalEditable_1 = tslib_1.__importDefault(require("@lexical/react/useLexicalEditable"));
6
+ const useLexicalEditable_1 = require("@lexical/react/useLexicalEditable");
8
7
  const useDecorators_1 = require("../shared/useDecorators");
9
8
  const useEditorFocus_1 = require("../shared/useEditorFocus");
10
9
  const useCanShowPlaceholder_1 = require("../shared/useCanShowPlaceholder");
@@ -19,7 +18,7 @@ exports.RichTextPlugin = RichTextPlugin;
19
18
  function Placeholder({ content }) {
20
19
  const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
21
20
  const showPlaceholder = (0, useCanShowPlaceholder_1.useCanShowPlaceholder)(editor);
22
- const editable = (0, useLexicalEditable_1.default)();
21
+ const editable = (0, useLexicalEditable_1.useLexicalEditable)();
23
22
  const hasFocus = (0, useEditorFocus_1.useEditorFocus)();
24
23
  if (!showPlaceholder || hasFocus) {
25
24
  return null;
@@ -158,7 +158,7 @@ function ToolbarPlugin(inProps) {
158
158
  setFormats(FORMATS.filter((f) => selection.hasFormat(f)));
159
159
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
160
160
  // @ts-ignore
161
- setAlignment(ALIGNMENTS.find((a) => element.getFormatType() === a) || ALIGNMENTS[0]);
161
+ setAlignment(ALIGNMENTS.find((a) => { var _a; return ((_a = element.getFormatType) === null || _a === void 0 ? void 0 : _a.call(element)) === a; }) || ALIGNMENTS[0]);
162
162
  // Update links
163
163
  const node = (0, editor_1.getSelectedNode)(selection);
164
164
  const parent = node.getParent();
@@ -19,6 +19,7 @@ const User_1 = tslib_1.__importDefault(require("../User"));
19
19
  const Widget_1 = tslib_1.__importDefault(require("../Widget"));
20
20
  const constants_1 = require("./constants");
21
21
  const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
22
+ const events_1 = require("../../utils/events");
22
23
  const classes = {
23
24
  root: `${constants_1.PREFIX}-root`,
24
25
  detailRoot: `${constants_1.PREFIX}-detail-root`,
@@ -46,7 +47,8 @@ const classes = {
46
47
  snippetInProgress: `${constants_1.PREFIX}-snippet-in-progress`,
47
48
  snippetPrimary: `${constants_1.PREFIX}-snippet-primary`,
48
49
  snippetSecondary: `${constants_1.PREFIX}-snippet-secondary`,
49
- snippetActions: `${constants_1.PREFIX}-snippet-actions`
50
+ snippetActions: `${constants_1.PREFIX}-snippet-actions`,
51
+ finishedChip: `${constants_1.PREFIX}-finished-chip`
50
52
  };
51
53
  const Root = (0, styles_1.styled)(Widget_1.default, {
52
54
  name: constants_1.PREFIX,
@@ -110,6 +112,7 @@ function Event(inProps) {
110
112
  // STATE
111
113
  const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event, autoSubscribe: false });
112
114
  const inProgress = (0, react_1.useMemo)(() => scEvent && scEvent.active && scEvent.running, [scEvent]);
115
+ const isEventFinished = (0, react_1.useMemo)(() => (0, events_1.checkEventFinished)(scEvent), [scEvent]);
113
116
  // CONTEXT
114
117
  const scRoutingContext = (0, react_core_1.useSCRouting)();
115
118
  // HOOKS
@@ -128,10 +131,10 @@ function Event(inProps) {
128
131
  contentObj = ((0, jsx_runtime_1.jsxs)(DetailRoot, Object.assign({ className: classes.detailRoot }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.detailImageWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: scEvent.image_medium, alt: scEvent.name, className: classes.detailImage }), !hideInProgress && inProgress && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.detailInProgress })), (0, jsx_runtime_1.jsx)(Calendar_1.default, { day: new Date(scEvent.start_date).getDate() })] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.detailContent }, { children: [scEvent.active ? ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.detailNameWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3", className: classes.detailName }, { children: scEvent.name })) }))) : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.detailNameWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3", className: classes.detailName }, { children: scEvent.name })) }))), (0, jsx_runtime_1.jsx)(EventInfoDetails_1.default, { event: scEvent }), !hideEventPlanner && ((0, jsx_runtime_1.jsx)(User_1.default, { user: scEvent.managed_by, elevation: 0, secondary: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.myEventsWidget.planner", defaultMessage: "ui.myEventsWidget.planner" }) })), actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), className: classes.detailUser })), !hideEventParticipants && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.detailFirstDivider }), (0, jsx_runtime_1.jsx)(EventParticipantsButton_1.default, Object.assign({ event: scEvent }, EventParticipantsButtonComponentProps))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.detailSecondDivider })] })), actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.detailActions }, { children: (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.EVENT_ROUTE_NAME, scEvent) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
129
132
  }
130
133
  else if (template === event_1.SCEventTemplateType.PREVIEW) {
131
- contentObj = ((0, jsx_runtime_1.jsxs)(PreviewRoot, Object.assign({ className: classes.previewRoot }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ position: "relative", className: classes.previewImageWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: scEvent.image_medium, alt: scEvent.name, className: classes.previewImage }), !hideInProgress && inProgress && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.previewInProgress }))] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.previewContent }, { children: [(0, jsx_runtime_1.jsx)(EventInfoDetails_1.default, { event: scEvent, hidePrivacyIcon: true, hasLocationInfo: false, beforePrivacyInfo: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.previewNameWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.previewName }, { children: scEvent.name })) })) }), !hideEventParticipants && (0, jsx_runtime_1.jsx)(EventParticipantsButton_1.default, Object.assign({ event: scEvent, hideCaption: true }, EventParticipantsButtonComponentProps))] })), 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({ size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
134
+ contentObj = ((0, jsx_runtime_1.jsxs)(PreviewRoot, Object.assign({ className: classes.previewRoot }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ position: "relative", className: classes.previewImageWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: scEvent.image_medium, alt: scEvent.name, className: classes.previewImage }), !hideInProgress && inProgress && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.previewInProgress })), isEventFinished && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.event.finished", defaultMessage: "ui.event.finished" }), className: classes.finishedChip }))] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.previewContent }, { children: [(0, jsx_runtime_1.jsx)(EventInfoDetails_1.default, { event: scEvent, hidePrivacyIcon: true, hasLocationInfo: false, beforePrivacyInfo: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.previewNameWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.previewName }, { children: scEvent.name })) })) }), !hideEventParticipants && (0, jsx_runtime_1.jsx)(EventParticipantsButton_1.default, Object.assign({ event: scEvent, hideCaption: true }, EventParticipantsButtonComponentProps))] })), 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({ size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
132
135
  }
133
136
  else {
134
- contentObj = ((0, jsx_runtime_1.jsx)(SnippetRoot, { elevation: 0, square: true, disableTypography: true, 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: scEvent.name, src: scEvent.image_medium, className: classes.snippetAvatar }), ' ', !hideInProgress && inProgress && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.snippetInProgress }))] })), primary: (0, jsx_runtime_1.jsxs)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.snippetPrimary }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: `${intl.formatDate(scEvent.start_date, {
137
+ contentObj = ((0, jsx_runtime_1.jsx)(SnippetRoot, { elevation: 0, square: true, disableTypography: true, 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: scEvent.name, src: scEvent.image_medium, className: classes.snippetAvatar }), ' ', !hideInProgress && inProgress && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.snippetInProgress })), isEventFinished && ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", component: "div", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.event.finished", defaultMessage: "ui.event.finished" }), className: classes.finishedChip }))] })), primary: (0, jsx_runtime_1.jsxs)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.snippetPrimary }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: `${intl.formatDate(scEvent.start_date, {
135
138
  weekday: 'long',
136
139
  month: 'long',
137
140
  day: 'numeric'
@@ -121,7 +121,7 @@ const Root = (0, styles_1.styled)(material_1.Box, {
121
121
  * @param inProps
122
122
  */
123
123
  function EventForm(inProps) {
124
- var _a, _b, _c, _d, _e;
124
+ var _a, _b, _c, _d, _e, _f;
125
125
  //PROPS
126
126
  const props = (0, system_1.useThemeProps)({
127
127
  props: inProps,
@@ -130,6 +130,7 @@ function EventForm(inProps) {
130
130
  const { className, onSuccess, onError, event, presetLocation, EventAddressComponentProps = {} } = props, rest = tslib_1.__rest(props, ["className", "onSuccess", "onError", "event", "presetLocation", "EventAddressComponentProps"]);
131
131
  // CONTEXT
132
132
  const scContext = (0, react_core_1.useSCContext)();
133
+ const scUserContext = (0, react_core_1.useSCUser)();
133
134
  // INTL
134
135
  const intl = (0, react_intl_1.useIntl)();
135
136
  const startDateTime = (0, react_1.useMemo)(() => (0, utils_2.getNewDate)(event === null || event === void 0 ? void 0 : event.start_date), [event]);
@@ -172,6 +173,7 @@ function EventForm(inProps) {
172
173
  scPreferences.features.includes(types_1.SCFeatureName.LIVE_STREAM) &&
173
174
  react_core_1.SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in scPreferences.preferences &&
174
175
  scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
176
+ const canCreateLiveStream = (0, react_1.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; }, [(_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission]);
175
177
  const privateEnabled = (0, react_1.useMemo)(() => scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED].value, [scPreferences.preferences]);
176
178
  const visibilityEnabled = (0, react_1.useMemo)(() => scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED].value, [scPreferences.preferences]);
177
179
  const disablePastStartTime = (0, react_1.useMemo)(() => field.startDate.getDate() === (0, utils_2.getNewDate)().getDate(), [field]);
@@ -384,7 +386,7 @@ function EventForm(inProps) {
384
386
  start_date: field.startDate,
385
387
  location: field.location,
386
388
  geolocation: field.geolocation,
387
- live_stream: Object.assign(Object.assign({ title: field.name || `${intl.formatMessage(messages.name)}` }, (event && ((_b = event.live_stream) === null || _b === void 0 ? void 0 : _b.created_at) && { created_at: field.startDate })), { settings: field.liveStreamSettings })
389
+ live_stream: Object.assign(Object.assign({ title: field.name || `${intl.formatMessage(messages.name)}` }, (event && ((_c = event.live_stream) === null || _c === void 0 ? void 0 : _c.created_at) && { created_at: field.startDate })), { settings: field.liveStreamSettings })
388
390
  }) }, EventAddressComponentProps)), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.privacySection }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), (0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
389
391
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
390
392
  // @ts-ignores
@@ -394,8 +396,8 @@ function EventForm(inProps) {
394
396
  // @ts-ignore
395
397
  b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
396
398
  } })) }))] }))), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
397
- endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) ? Event_1.EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : Event_1.EVENT_DESCRIPTION_MAX_LENGTH })))
398
- }, error: Boolean(((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null }), genericError && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.genericError }, { children: (0, jsx_runtime_1.jsx)(material_1.Alert, Object.assign({ variant: "filled", severity: "error" }, { children: genericError })) }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.name ||
399
+ endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) ? Event_1.EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : Event_1.EVENT_DESCRIPTION_MAX_LENGTH })))
400
+ }, error: Boolean(((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null }), genericError && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.genericError }, { children: (0, jsx_runtime_1.jsx)(material_1.Alert, Object.assign({ variant: "filled", severity: "error" }, { children: genericError })) }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.name ||
399
401
  !field.startDate ||
400
402
  !field.startTime ||
401
403
  !field.endDate ||
@@ -407,6 +409,6 @@ function EventForm(inProps) {
407
409
  field.isSubmitting ||
408
410
  field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH ||
409
411
  field.description.length > Event_1.EVENT_DESCRIPTION_MAX_LENGTH ||
410
- (field.location === types_1.SCEventLocationType.LIVESTREAM && !liveStreamEnabled), variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: event ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.edit", defaultMessage: "ui.eventForm.button.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.create", defaultMessage: "ui.eventForm.button.create" })) })) }))] }))] })));
412
+ (field.location === types_1.SCEventLocationType.LIVESTREAM && (!liveStreamEnabled || !canCreateLiveStream)), variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: event ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.edit", defaultMessage: "ui.eventForm.button.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.create", defaultMessage: "ui.eventForm.button.create" })) })) }))] }))] })));
411
413
  }
412
414
  exports.default = EventForm;
@@ -91,7 +91,7 @@ function EventHeader(inProps) {
91
91
  // INTL
92
92
  const intl = (0, react_intl_1.useIntl)();
93
93
  // CONST
94
- const isEventAdmin = (0, react_1.useMemo)(() => scUserContext.user && scEvent && (scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by.id) === scUserContext.user.id, [scUserContext.user, scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by]);
94
+ const isEventAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && scEvent && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by]);
95
95
  const isEventFinished = (0, react_1.useMemo)(() => (0, events_1.checkEventFinished)(scEvent), [scEvent]);
96
96
  /**
97
97
  * Handles callback subscribe/unsubscribe event