@selfcommunity/react-ui 0.7.9-alpha.8 → 0.7.9-alpha.81

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 (187) hide show
  1. package/lib/cjs/components/AccountRecover/AccountRecover.js +6 -1
  2. package/lib/cjs/components/BottomNavigation/BottomNavigation.js +4 -3
  3. package/lib/cjs/components/CategoryHeader/Skeleton.js +3 -2
  4. package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.js +6 -6
  5. package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.js +19 -16
  6. package/lib/cjs/components/Composer/Attributes/Attributes.js +3 -3
  7. package/lib/cjs/components/Composer/Composer.js +3 -3
  8. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -1
  9. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +9 -19
  10. package/lib/cjs/components/Editor/Editor.js +2 -0
  11. package/lib/cjs/components/Editor/nodes/ImageNode.js +6 -0
  12. package/lib/cjs/components/Editor/plugins/ImagePlugin.js +4 -0
  13. package/lib/cjs/components/Editor/plugins/ToolbarPlugin.js +17 -3
  14. package/lib/cjs/components/FeedObject/Actions/Share/Share.js +18 -16
  15. package/lib/cjs/components/FeedObject/Contributors/Contributors.js +1 -1
  16. package/lib/cjs/components/FeedObject/FeedObject.d.ts +1 -0
  17. package/lib/cjs/components/FeedObject/FeedObject.js +27 -8
  18. package/lib/cjs/components/FeedObject/Poll/Poll.js +20 -20
  19. package/lib/cjs/components/FeedUpdatesWidget/FeedUpdatesWidget.js +1 -1
  20. package/lib/cjs/components/Footer/Footer.js +1 -1
  21. package/lib/cjs/components/Group/Group.d.ts +9 -1
  22. package/lib/cjs/components/Group/Group.js +18 -6
  23. package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.d.ts +0 -1
  24. package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.js +1 -2
  25. package/lib/cjs/components/GroupForm/GroupForm.js +64 -13
  26. package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -6
  27. package/lib/cjs/components/GroupHeader/GroupHeader.js +53 -12
  28. package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.js +63 -9
  29. package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +31 -9
  30. package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.d.ts +73 -0
  31. package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.js +220 -0
  32. package/lib/cjs/components/GroupInvitedWidget/Skeleton.d.ts +22 -0
  33. package/lib/cjs/components/GroupInvitedWidget/Skeleton.js +38 -0
  34. package/lib/cjs/components/GroupInvitedWidget/constants.d.ts +1 -0
  35. package/lib/cjs/components/GroupInvitedWidget/constants.js +4 -0
  36. package/lib/cjs/components/GroupInvitedWidget/index.d.ts +4 -0
  37. package/lib/cjs/components/GroupInvitedWidget/index.js +8 -0
  38. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.d.ts +5 -0
  39. package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +8 -3
  40. package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +25 -4
  41. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +12 -7
  42. package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +19 -9
  43. package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +48 -0
  44. package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.js +151 -0
  45. package/lib/cjs/components/GroupSettingsIconButton/index.d.ts +3 -0
  46. package/lib/cjs/components/GroupSettingsIconButton/index.js +5 -0
  47. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +8 -3
  48. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +30 -11
  49. package/lib/cjs/components/Groups/Groups.d.ts +15 -8
  50. package/lib/cjs/components/Groups/Groups.js +86 -32
  51. package/lib/cjs/components/Groups/Skeleton.d.ts +4 -0
  52. package/lib/cjs/components/Groups/Skeleton.js +2 -2
  53. package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +7 -0
  54. package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +4 -4
  55. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +9 -2
  56. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -0
  57. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +9 -1
  58. package/lib/cjs/components/Notification/Group/Group.d.ts +15 -0
  59. package/lib/cjs/components/Notification/Group/Group.js +78 -0
  60. package/lib/cjs/components/Notification/Group/index.d.ts +3 -0
  61. package/lib/cjs/components/Notification/Group/index.js +5 -0
  62. package/lib/cjs/components/Notification/Notification.js +31 -1
  63. package/lib/cjs/components/Notification/PrivateMessage/PrivateMessage.js +16 -5
  64. package/lib/cjs/components/PrivateMessageComponent/PrivateMessageComponent.d.ts +7 -1
  65. package/lib/cjs/components/PrivateMessageComponent/PrivateMessageComponent.js +16 -8
  66. package/lib/cjs/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js +1 -1
  67. package/lib/cjs/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +11 -6
  68. package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.d.ts +9 -4
  69. package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.js +24 -6
  70. package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.d.ts +6 -1
  71. package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.js +46 -20
  72. package/lib/cjs/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +6 -0
  73. package/lib/cjs/components/SearchAutocomplete/SearchAutocomplete.js +22 -5
  74. package/lib/cjs/components/SnippetNotifications/SnippetNotifications.js +7 -0
  75. package/lib/cjs/components/ToastNotifications/ToastNotifications.js +7 -0
  76. package/lib/cjs/components/User/User.d.ts +6 -1
  77. package/lib/cjs/components/User/User.js +5 -4
  78. package/lib/cjs/components/UserSubscribedGroupsWidget/Skeleton.d.ts +21 -0
  79. package/lib/cjs/components/UserSubscribedGroupsWidget/Skeleton.js +46 -0
  80. package/lib/cjs/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.d.ts +68 -0
  81. package/lib/cjs/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +183 -0
  82. package/lib/cjs/components/UserSubscribedGroupsWidget/constants.d.ts +1 -0
  83. package/lib/cjs/components/UserSubscribedGroupsWidget/constants.js +4 -0
  84. package/lib/cjs/components/UserSubscribedGroupsWidget/index.d.ts +4 -0
  85. package/lib/cjs/components/UserSubscribedGroupsWidget/index.js +8 -0
  86. package/lib/cjs/components/VoteAudienceButton/VoteAudienceButton.js +1 -1
  87. package/lib/cjs/constants/PubSub.d.ts +28 -0
  88. package/lib/cjs/constants/PubSub.js +22 -0
  89. package/lib/cjs/index.d.ts +6 -3
  90. package/lib/cjs/index.js +13 -4
  91. package/lib/cjs/types/index.d.ts +2 -1
  92. package/lib/esm/components/AccountRecover/AccountRecover.js +6 -1
  93. package/lib/esm/components/BottomNavigation/BottomNavigation.js +5 -4
  94. package/lib/esm/components/CategoryHeader/Skeleton.js +3 -2
  95. package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.js +6 -6
  96. package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.js +19 -16
  97. package/lib/esm/components/Composer/Attributes/Attributes.js +3 -3
  98. package/lib/esm/components/Composer/Composer.js +3 -3
  99. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -1
  100. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +9 -19
  101. package/lib/esm/components/Editor/Editor.js +2 -0
  102. package/lib/esm/components/Editor/nodes/ImageNode.js +6 -0
  103. package/lib/esm/components/Editor/plugins/ImagePlugin.js +4 -0
  104. package/lib/esm/components/Editor/plugins/ToolbarPlugin.js +19 -5
  105. package/lib/esm/components/FeedObject/Actions/Share/Share.js +19 -17
  106. package/lib/esm/components/FeedObject/Contributors/Contributors.js +1 -1
  107. package/lib/esm/components/FeedObject/FeedObject.d.ts +1 -0
  108. package/lib/esm/components/FeedObject/FeedObject.js +28 -9
  109. package/lib/esm/components/FeedObject/Poll/Poll.js +20 -20
  110. package/lib/esm/components/FeedUpdatesWidget/FeedUpdatesWidget.js +1 -1
  111. package/lib/esm/components/Footer/Footer.js +2 -2
  112. package/lib/esm/components/Group/Group.d.ts +9 -1
  113. package/lib/esm/components/Group/Group.js +22 -10
  114. package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.d.ts +0 -1
  115. package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.js +1 -2
  116. package/lib/esm/components/GroupForm/GroupForm.js +64 -13
  117. package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -6
  118. package/lib/esm/components/GroupHeader/GroupHeader.js +55 -14
  119. package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.js +63 -9
  120. package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +31 -9
  121. package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.d.ts +73 -0
  122. package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.js +217 -0
  123. package/lib/esm/components/GroupInvitedWidget/Skeleton.d.ts +22 -0
  124. package/lib/esm/components/GroupInvitedWidget/Skeleton.js +34 -0
  125. package/lib/esm/components/GroupInvitedWidget/constants.d.ts +1 -0
  126. package/lib/esm/components/GroupInvitedWidget/constants.js +1 -0
  127. package/lib/esm/components/GroupInvitedWidget/index.d.ts +4 -0
  128. package/lib/esm/components/GroupInvitedWidget/index.js +4 -0
  129. package/lib/esm/components/GroupMembersButton/GroupMembersButton.d.ts +5 -0
  130. package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +9 -4
  131. package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +26 -5
  132. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +12 -7
  133. package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +19 -9
  134. package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +48 -0
  135. package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.js +148 -0
  136. package/lib/esm/components/GroupSettingsIconButton/index.d.ts +3 -0
  137. package/lib/esm/components/GroupSettingsIconButton/index.js +2 -0
  138. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +8 -3
  139. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +30 -11
  140. package/lib/esm/components/Groups/Groups.d.ts +15 -8
  141. package/lib/esm/components/Groups/Groups.js +91 -37
  142. package/lib/esm/components/Groups/Skeleton.d.ts +4 -0
  143. package/lib/esm/components/Groups/Skeleton.js +2 -2
  144. package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +9 -2
  145. package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +4 -4
  146. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +10 -3
  147. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -0
  148. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -3
  149. package/lib/esm/components/Notification/Group/Group.d.ts +15 -0
  150. package/lib/esm/components/Notification/Group/Group.js +75 -0
  151. package/lib/esm/components/Notification/Group/index.d.ts +3 -0
  152. package/lib/esm/components/Notification/Group/index.js +2 -0
  153. package/lib/esm/components/Notification/Notification.js +31 -1
  154. package/lib/esm/components/Notification/PrivateMessage/PrivateMessage.js +16 -5
  155. package/lib/esm/components/PrivateMessageComponent/PrivateMessageComponent.d.ts +7 -1
  156. package/lib/esm/components/PrivateMessageComponent/PrivateMessageComponent.js +17 -9
  157. package/lib/esm/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js +1 -1
  158. package/lib/esm/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +11 -6
  159. package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.d.ts +9 -4
  160. package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.js +26 -8
  161. package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.d.ts +6 -1
  162. package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.js +48 -22
  163. package/lib/esm/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +7 -1
  164. package/lib/esm/components/SearchAutocomplete/SearchAutocomplete.js +22 -5
  165. package/lib/esm/components/SnippetNotifications/SnippetNotifications.js +7 -0
  166. package/lib/esm/components/ToastNotifications/ToastNotifications.js +7 -0
  167. package/lib/esm/components/User/User.d.ts +6 -1
  168. package/lib/esm/components/User/User.js +5 -4
  169. package/lib/esm/components/UserSubscribedGroupsWidget/Skeleton.d.ts +21 -0
  170. package/lib/esm/components/UserSubscribedGroupsWidget/Skeleton.js +42 -0
  171. package/lib/esm/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.d.ts +68 -0
  172. package/lib/esm/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +180 -0
  173. package/lib/esm/components/UserSubscribedGroupsWidget/constants.d.ts +1 -0
  174. package/lib/esm/components/UserSubscribedGroupsWidget/constants.js +1 -0
  175. package/lib/esm/components/UserSubscribedGroupsWidget/index.d.ts +4 -0
  176. package/lib/esm/components/UserSubscribedGroupsWidget/index.js +4 -0
  177. package/lib/esm/components/VoteAudienceButton/VoteAudienceButton.js +1 -1
  178. package/lib/esm/constants/PubSub.d.ts +28 -0
  179. package/lib/esm/constants/PubSub.js +19 -0
  180. package/lib/esm/index.d.ts +6 -3
  181. package/lib/esm/index.js +6 -3
  182. package/lib/esm/types/index.d.ts +2 -1
  183. package/lib/umd/311.js +2 -0
  184. package/lib/umd/react-ui.js +1 -1
  185. package/package.json +9 -9
  186. package/lib/umd/871.js +0 -2
  187. /package/lib/umd/{871.js.LICENSE.txt → 311.js.LICENSE.txt} +0 -0
@@ -57,12 +57,12 @@ export default function ChangeGroupPicture(inProps) {
57
57
  name: PREFIX
58
58
  });
59
59
  const { groupId, onChange, autoHide, className, isCreationMode = false } = props, rest = __rest(props, ["groupId", "onChange", "autoHide", "className", "isCreationMode"]);
60
+ //CONTEXT
61
+ const scUserContext = useContext(SCUserContext);
60
62
  //STATE
63
+ let fileInput = useRef(null);
61
64
  const [loading, setLoading] = useState(false);
62
65
  const [alert, setAlert] = useState(null);
63
- let fileInput = useRef(null);
64
- //CONTEXT
65
- const scUserContext = useContext(SCUserContext);
66
66
  // INTL
67
67
  const intl = useIntl();
68
68
  // Anonymous
@@ -73,44 +73,47 @@ export default function ChangeGroupPicture(inProps) {
73
73
  * Handles avatar upload
74
74
  * @param event
75
75
  */
76
- function handleUpload(event) {
77
- const fileInput = event.target.files[0];
76
+ const handleUpload = (event) => {
77
+ fileInput = event.target.files[0];
78
78
  if (fileInput) {
79
79
  const reader = new FileReader();
80
80
  reader.onload = (e) => {
81
81
  const img = new Image();
82
82
  img.onload = () => {
83
- if (img.width < 600 && img.height < 600) {
84
- setAlert(intl.formatMessage(messages.errorLoadImage));
85
- }
86
- else {
87
- isCreationMode ? onChange && onChange(fileInput) : handleSave();
88
- }
83
+ isCreationMode ? onChange && onChange(fileInput) : handleSave();
84
+ // if (img.width < 600 && img.height < 600) {
85
+ // setAlert(intl.formatMessage(messages.errorLoadImage));
86
+ // } else {
87
+ // isCreationMode ? onChange && onChange(fileInput) : handleSave();
88
+ // }
89
89
  };
90
90
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
91
91
  // @ts-ignore
92
92
  img.src = e.target.result;
93
93
  };
94
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
95
+ // @ts-ignore
94
96
  reader.readAsDataURL(fileInput);
95
97
  }
96
- }
97
- // ui.changeGroupPicture.alert
98
+ };
98
99
  /**
99
100
  * Performs save avatar after upload
100
101
  */
101
102
  function handleSave() {
102
103
  setLoading(true);
103
104
  const formData = new FormData();
105
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
106
+ // @ts-ignore
104
107
  formData.append('image_original', fileInput);
105
108
  GroupService.changeGroupAvatarOrCover(groupId, formData, { headers: { 'Content-Type': 'multipart/form-data' } })
106
109
  .then((data) => {
110
+ onChange && onChange(data.image_big);
107
111
  setLoading(false);
108
- onChange && onChange(data.image_bigger);
109
112
  })
110
113
  .catch((error) => {
111
- setAlert(intl.formatMessage(messages.errorLoadImage));
112
- setLoading(false);
113
114
  Logger.error(SCOPE_SC_UI, error);
115
+ setLoading(false);
116
+ setAlert(intl.formatMessage(messages.errorLoadImage));
114
117
  });
115
118
  }
116
119
  /**
@@ -13,7 +13,7 @@ const Root = styled(Box, {
13
13
  slot: 'AttributesRoot'
14
14
  })(() => ({}));
15
15
  export default (props) => {
16
- var _a, _b;
16
+ var _a, _b, _c;
17
17
  // PROPS
18
18
  const { className = null, value = null, onChange = null, onClick = null } = props;
19
19
  // HANDLERS
@@ -44,8 +44,8 @@ export default (props) => {
44
44
  return (React.createElement(Root, { className: classNames(classes.root, className) },
45
45
  ((_a = value === null || value === void 0 ? void 0 : value.categories) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
46
46
  (value === null || value === void 0 ? void 0 : value.categories.map((c) => (React.createElement(Chip, { key: c.id, label: c.name, onDelete: handleDeleteCategory(c.id), icon: React.createElement(Icon, null, "category"), onClick: handleClickCategory })))),
47
- (value === null || value === void 0 ? void 0 : value.group) && (React.createElement(Chip, { key: value === null || value === void 0 ? void 0 : value.group.id, label: value === null || value === void 0 ? void 0 : value.group.name, onDelete: handleDeleteGroup, icon: React.createElement(Icon, null, "groups"), onClick: handleClickGroup })),
48
- ((_b = value === null || value === void 0 ? void 0 : value.addressing) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
47
+ (value === null || value === void 0 ? void 0 : value.group) && (React.createElement(Chip, { key: value === null || value === void 0 ? void 0 : value.group.id, label: value === null || value === void 0 ? void 0 : value.group.name, onDelete: handleDeleteGroup, icon: React.createElement(Icon, null, "groups"), onClick: handleClickGroup, disabled: !((_b = value === null || value === void 0 ? void 0 : value.group) === null || _b === void 0 ? void 0 : _b.subscription_status) })),
48
+ ((_c = value === null || value === void 0 ? void 0 : value.addressing) === null || _c === void 0 ? void 0 : _c.length) > 0 &&
49
49
  (value === null || value === void 0 ? void 0 : value.addressing.map((t) => (React.createElement(TagChip, { key: t.id, tag: t, onDelete: handleDeleteTag(t.id), icon: React.createElement(Icon, null, "label"), onClick: handleClickTag })))),
50
50
  (value === null || value === void 0 ? void 0 : value.location) && (React.createElement(Chip, { icon: React.createElement(Icon, null, "add_location_alt"), label: value === null || value === void 0 ? void 0 : value.location.location, onDelete: handleDeleteLocation, onClick: handleClickLocation }))));
51
51
  };
@@ -305,7 +305,7 @@ export default function Composer(inProps) {
305
305
  }
306
306
  }), [handleAddLayer, handleRemoveLayer, handleChangeCategories, categories]);
307
307
  const handleChangeAudience = useCallback((value) => {
308
- if (group || typeof value === 'object') {
308
+ if (group || (value && Object.prototype.hasOwnProperty.call(value, 'managed_by'))) {
309
309
  dispatch({ type: 'group', value });
310
310
  }
311
311
  else {
@@ -319,7 +319,7 @@ export default function Composer(inProps) {
319
319
  ComponentProps: {
320
320
  onClose: handleRemoveLayer,
321
321
  onSave: handleChangeAudience,
322
- defaultValue: group || typeof addressing === 'object' ? group : addressing
322
+ defaultValue: group || (addressing && Object.prototype.hasOwnProperty.call(addressing, 'managed_by')) ? group : addressing
323
323
  }
324
324
  }), [handleAddLayer, handleRemoveLayer, handleChangeAudience, addressing, group]);
325
325
  const handleChangeLocation = useCallback((value) => {
@@ -551,7 +551,7 @@ export default function Composer(inProps) {
551
551
  }),
552
552
  React.createElement(IconButton, { disabled: isSubmitting, onClick: handleAddCategoryLayer },
553
553
  React.createElement(Icon, null, "category")),
554
- React.createElement(IconButton, { disabled: isSubmitting || !features.includes(SCFeatureName.TAGGING), onClick: handleAddAudienceLayer }, addressing === null || addressing.length === 0 ? (React.createElement(Icon, null, "public")) : typeof addressing === 'object' ? (React.createElement(Icon, null, "groups")) : (React.createElement(Icon, null, "label"))),
554
+ React.createElement(IconButton, { disabled: isSubmitting || !features.includes(SCFeatureName.TAGGING) || Boolean(feedObject === null || feedObject === void 0 ? void 0 : feedObject.group), onClick: handleAddAudienceLayer }, (!group && addressing === null) || (addressing === null || addressing === void 0 ? void 0 : addressing.length) === 0 ? React.createElement(Icon, null, "public") : group ? React.createElement(Icon, null, "groups") : React.createElement(Icon, null, "label")),
555
555
  preferences[SCPreferences.ADDONS_POST_GEOLOCATION_ENABLED].value && (React.createElement(IconButton, { disabled: isSubmitting, onClick: handleAddLocationLayer, color: location !== null ? 'primary' : 'default' },
556
556
  React.createElement(Icon, null, "add_location_alt"))))),
557
557
  layer && (React.createElement(LayerTransitionRoot, { className: classes.layerTransitionRoot, in: true, container: dialogRef.current, direction: "left" },
@@ -10,7 +10,7 @@ export declare enum AudienceTypes {
10
10
  AUDIENCE_GROUP = "group"
11
11
  }
12
12
  export interface AudienceLayerProps extends Omit<BoxProps, 'defaultValue'>, ComposerLayerProps {
13
- defaultValue: SCTagType[] | SCGroupType;
13
+ defaultValue: SCTagType[] | SCGroupType | any;
14
14
  TextFieldProps?: TextFieldProps;
15
15
  }
16
16
  declare const AudienceLayer: React.ForwardRefExoticComponent<Pick<AudienceLayerProps, "p" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "component" | "sx" | "classes" | "onClose" | "TextFieldProps" | "onSave"> & React.RefAttributes<unknown>>;
@@ -43,7 +43,7 @@ const AudienceLayer = React.forwardRef((props, ref) => {
43
43
  // @ts-ignore
44
44
  defaultValue === null || defaultValue.length === 0
45
45
  ? AudienceTypes.AUDIENCE_ALL
46
- : typeof defaultValue === 'object'
46
+ : defaultValue && Object.prototype.hasOwnProperty.call(defaultValue, 'managed_by')
47
47
  ? AudienceTypes.AUDIENCE_GROUP
48
48
  : AudienceTypes.AUDIENCE_TAG);
49
49
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -52,15 +52,15 @@ const AudienceLayer = React.forwardRef((props, ref) => {
52
52
  // HOOKS
53
53
  const { scAddressingTags } = useSCFetchAddressingTagList({ fetch: autocompleteOpen });
54
54
  // HANDLERS
55
- const handleSave = useCallback(
56
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
- // @ts-ignore
58
- () => (typeof defaultValue === 'object' ? onSave(value) : onSave((value === null || value === void 0 ? void 0 : value.length) && (value === null || value === void 0 ? void 0 : value.length) > 0 ? value : null)), [value, onSave]);
55
+ const handleSave = useCallback(() => {
56
+ audience === AudienceTypes.AUDIENCE_GROUP ? onSave(value) : onSave((value === null || value === void 0 ? void 0 : value.length) && (value === null || value === void 0 ? void 0 : value.length) > 0 ? value : null);
57
+ }, [value, onSave, audience]);
59
58
  const handleChange = useCallback((event, tags) => setValue(tags), []);
60
59
  const handleGroupChange = useCallback((group) => setValue(group), []);
61
60
  const handleChangeAudience = useCallback((event, data) => setAudience(data), []);
62
61
  const handleAutocompleteOpen = useCallback(() => setAutocompleteOpen(true), []);
63
62
  const handleAutocompleteClose = useCallback(() => setAutocompleteOpen(false), []);
63
+ console.log(defaultValue);
64
64
  return (React.createElement(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest),
65
65
  React.createElement(DialogTitle, { className: classes.title },
66
66
  React.createElement(IconButton, { onClick: onClose },
@@ -72,20 +72,10 @@ const AudienceLayer = React.forwardRef((props, ref) => {
72
72
  React.createElement(DialogContent, { className: classes.content },
73
73
  React.createElement(Tabs, { value: audience, onChange: handleChangeAudience, "aria-label": "audience type" },
74
74
  React.createElement(Tab, { value: AudienceTypes.AUDIENCE_ALL, icon: React.createElement(Icon, null, "public"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all", defaultMessage: "ui.composer.layer.audience.all" }) }),
75
- React.createElement(Tab
76
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
77
- // @ts-ignore
78
- , {
79
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
80
- // @ts-ignore
81
- disabled: defaultValue && defaultValue.length !== 0, value: AudienceTypes.AUDIENCE_GROUP, icon: React.createElement(Icon, null, "groups"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group", defaultMessage: "ui.composer.layer.audience.group" }) }),
82
- React.createElement(Tab
83
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
84
- // @ts-ignore
85
- , {
86
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
87
- // @ts-ignore
88
- disabled: typeof defaultValue === 'object', value: AudienceTypes.AUDIENCE_TAG, icon: React.createElement(Icon, null, "label"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tag", defaultMessage: "ui.composer.layer.audience.tag" }) })),
75
+ React.createElement(Tab, { disabled: (Boolean(value === null || value === void 0 ? void 0 : value.length) && !Object.prototype.hasOwnProperty.call(value, 'managed_by')) ||
76
+ (value !== undefined && Boolean(!(value === null || value === void 0 ? void 0 : value.length)) && audience !== AudienceTypes.AUDIENCE_ALL) ||
77
+ (Boolean((value === null || value === void 0 ? void 0 : value.length) === 0) && audience === AudienceTypes.AUDIENCE_ALL && Boolean((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) !== 0)), value: AudienceTypes.AUDIENCE_GROUP, icon: React.createElement(Icon, null, "groups"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group", defaultMessage: "ui.composer.layer.audience.group" }) }),
78
+ React.createElement(Tab, { disabled: value && Object.prototype.hasOwnProperty.call(value, 'managed_by'), value: AudienceTypes.AUDIENCE_TAG, icon: React.createElement(Icon, null, "label"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tag", defaultMessage: "ui.composer.layer.audience.tag" }) })),
89
79
  React.createElement(Typography, { className: classes.message },
90
80
  audience === AudienceTypes.AUDIENCE_ALL && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
91
81
  audience === AudienceTypes.AUDIENCE_GROUP && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group.message", defaultMessage: "ui.composer.audience.layer.group.message" })),
@@ -132,6 +132,8 @@ const Editor = (inProps, ref) => {
132
132
  }
133
133
  }));
134
134
  // RENDER
135
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
136
+ // @ts-ignore
135
137
  const initialConfig = useMemo(() => ({
136
138
  namespace: 'LexicalEditor',
137
139
  editable: editable,
@@ -101,6 +101,8 @@ function convertImageElement(domNode) {
101
101
  }
102
102
  return null;
103
103
  }
104
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
105
+ // @ts-ignore
104
106
  export class ImageNode extends DecoratorNode {
105
107
  constructor(src, altText, maxWidth, key) {
106
108
  super(key);
@@ -166,8 +168,12 @@ export class ImageNode extends DecoratorNode {
166
168
  }
167
169
  exportJSON() {
168
170
  return {
171
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
172
+ // @ts-ignore
169
173
  altText: this.getAltText(),
170
174
  maxWidth: this.__maxWidth,
175
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
176
+ // @ts-ignore
171
177
  src: this.getSrc(),
172
178
  type: 'image',
173
179
  version: 1
@@ -76,6 +76,8 @@ const Root = styled(Image, {
76
76
  export default function ImagePlugin() {
77
77
  const [editor] = useLexicalComposerContext();
78
78
  useEffect(() => {
79
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
80
+ // @ts-ignore
79
81
  if (!editor.hasNodes([ImageNode])) {
80
82
  return;
81
83
  }
@@ -92,6 +94,8 @@ export default function ImagePlugin() {
92
94
  return true;
93
95
  }, COMMAND_PRIORITY_EDITOR);
94
96
  }, [editor]);
97
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
98
+ // @ts-ignore
95
99
  if (!editor.hasNodes([ImageNode])) {
96
100
  return null;
97
101
  }
@@ -5,14 +5,14 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { $createParagraphNode, $getSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, COMMAND_PRIORITY_CRITICAL, DEPRECATED_$isGridSelection, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
8
+ import { $createParagraphNode, $getSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, COMMAND_PRIORITY_CRITICAL, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
9
9
  import { $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link';
10
10
  import { $isListNode, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, ListNode, REMOVE_LIST_COMMAND } from '@lexical/list';
11
11
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
12
12
  import { $isDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode';
13
13
  import { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode } from '@lexical/rich-text';
14
14
  import { $setBlocksType } from '@lexical/selection';
15
- import { $isTableNode } from '@lexical/table';
15
+ import { $isTableNode, $isTableSelection } from '@lexical/table';
16
16
  import { $findMatchingParent, $getNearestBlockElementAncestorOrThrow, $getNearestNodeOfType, mergeRegister } from '@lexical/utils';
17
17
  import * as React from 'react';
18
18
  import { useCallback, useEffect, useState } from 'react';
@@ -47,7 +47,7 @@ function BlockFormatIconButton({ className = '', editor, blockType, disabled = f
47
47
  const formatParagraph = () => {
48
48
  editor.update(() => {
49
49
  const selection = $getSelection();
50
- if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {
50
+ if ($isRangeSelection(selection) || $isTableSelection(selection)) {
51
51
  $setBlocksType(selection, () => $createParagraphNode());
52
52
  }
53
53
  });
@@ -56,7 +56,7 @@ function BlockFormatIconButton({ className = '', editor, blockType, disabled = f
56
56
  if (blockType !== headingSize) {
57
57
  editor.update(() => {
58
58
  const selection = $getSelection();
59
- if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {
59
+ if ($isRangeSelection(selection) || $isTableSelection(selection)) {
60
60
  $setBlocksType(selection, () => $createHeadingNode(headingSize));
61
61
  }
62
62
  });
@@ -82,7 +82,7 @@ function BlockFormatIconButton({ className = '', editor, blockType, disabled = f
82
82
  if (blockType !== 'quote') {
83
83
  editor.update(() => {
84
84
  const selection = $getSelection();
85
- if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {
85
+ if ($isRangeSelection(selection) || $isTableSelection(selection)) {
86
86
  $setBlocksType(selection, () => $createQuoteNode());
87
87
  }
88
88
  });
@@ -166,6 +166,8 @@ export default function ToolbarPlugin(inProps) {
166
166
  const elementDOM = activeEditor.getElementByKey(elementKey);
167
167
  // Update text format
168
168
  setFormats(FORMATS.filter((f) => selection.hasFormat(f)));
169
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
170
+ // @ts-ignore
169
171
  setAlignment(ALIGNMENTS.find((a) => element.getFormatType() === a) || ALIGNMENTS[0]);
170
172
  // Update links
171
173
  const node = getSelectedNode(selection);
@@ -191,6 +193,8 @@ export default function ToolbarPlugin(inProps) {
191
193
  setBlockType(type);
192
194
  }
193
195
  else {
196
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
197
+ // @ts-ignore
194
198
  const type = $isHeadingNode(element) ? element.getTag() : element.getType();
195
199
  if (type in blockTypeToBlockIcon) {
196
200
  setBlockType(type);
@@ -233,12 +237,22 @@ export default function ToolbarPlugin(inProps) {
233
237
  node = node.splitText(anchor.offset)[1] || node;
234
238
  }
235
239
  if (idx === nodes.length - 1) {
240
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
241
+ // @ts-ignore
236
242
  node = node.splitText(focus.offset)[0] || node;
237
243
  }
244
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
245
+ // @ts-ignore
238
246
  if (node.__style !== '') {
247
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
248
+ // @ts-ignore
239
249
  node.setStyle('');
240
250
  }
251
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
252
+ // @ts-ignore
241
253
  if (node.__format !== 0) {
254
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
255
+ // @ts-ignore
242
256
  node.setFormat(0);
243
257
  $getNearestBlockElementAncestorOrThrow(node).setFormat('');
244
258
  }
@@ -13,7 +13,7 @@ import { SCOPE_SC_UI } from '../../../../constants/Errors';
13
13
  import classNames from 'classnames';
14
14
  import { useSnackbar } from 'notistack';
15
15
  import Skeleton from '@mui/material/Skeleton';
16
- import { SCContributionType } from '@selfcommunity/types';
16
+ import { SCContributionType, SCGroupPrivacyType } from '@selfcommunity/types';
17
17
  import { Endpoints, http } from '@selfcommunity/api-services';
18
18
  import { copyTextToClipboard, Logger } from '@selfcommunity/utils';
19
19
  import { SCPreferences, SCPreferencesContext, UserUtils, useSCContext, useSCFetchFeedObject, useSCRouting, useSCUser } from '@selfcommunity/react-core';
@@ -68,6 +68,7 @@ export default function Share(props) {
68
68
  const { enqueueSnackbar } = useSnackbar();
69
69
  const domain = typeof location !== 'undefined' && location.origin ? location.origin : '';
70
70
  const url = domain + scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj));
71
+ const isGroupPublic = useMemo(() => feedObject.group && feedObject.group.privacy === SCGroupPrivacyType.PUBLIC, [feedObject.group]);
71
72
  // INTL
72
73
  const intl = useIntl();
73
74
  // HANDLERS
@@ -186,22 +187,23 @@ export default function Share(props) {
186
187
  }
187
188
  function renderShareMenuItems() {
188
189
  return (React.createElement(Box, null,
189
- React.createElement(MenuItem, { onClick: () => share(false) },
190
- React.createElement(ListItemIcon, null,
191
- React.createElement(Icon, { fontSize: "small" }, "redo")),
192
- React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.shareNow", defaultMessage: "ui.feedObject.share.shareNow" }) })),
193
- facebookShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(FACEBOOK_SHARE + url, 'facebook-share-dialog', 'width=626,height=436') },
194
- React.createElement(ListItemIcon, null,
195
- React.createElement(Icon, { fontSize: "small" }, "facebook")),
196
- React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.facebook", defaultMessage: "ui.feedObject.share.facebook" }) }))),
197
- twitterShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(TWITTER_SHARE + url, 'twitter-share-dialog', 'width=626,height=436') },
198
- React.createElement(ListItemIcon, null,
199
- React.createElement(Icon, { fontSize: "small" }, "twitter")),
200
- React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.twitter", defaultMessage: "ui.feedObject.share.twitter" }) }))),
201
- linkedinShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(LINKEDIN_SHARE + url, 'linkedin-share-dialog', 'width=626,height=436') },
202
- React.createElement(ListItemIcon, null,
203
- React.createElement(Icon, { fontSize: "small" }, "linkedin")),
204
- React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.linkedin", defaultMessage: "ui.feedObject.share.linkedin" }) }))),
190
+ (!feedObject.group || isGroupPublic) && (React.createElement(React.Fragment, null,
191
+ React.createElement(MenuItem, { onClick: () => share(false) },
192
+ React.createElement(ListItemIcon, null,
193
+ React.createElement(Icon, { fontSize: "small" }, "redo")),
194
+ React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.shareNow", defaultMessage: "ui.feedObject.share.shareNow" }) })),
195
+ facebookShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(FACEBOOK_SHARE + url, 'facebook-share-dialog', 'width=626,height=436') },
196
+ React.createElement(ListItemIcon, null,
197
+ React.createElement(Icon, { fontSize: "small" }, "facebook")),
198
+ React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.facebook", defaultMessage: "ui.feedObject.share.facebook" }) }))),
199
+ twitterShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(TWITTER_SHARE + url, 'twitter-share-dialog', 'width=626,height=436') },
200
+ React.createElement(ListItemIcon, null,
201
+ React.createElement(Icon, { fontSize: "small" }, "twitter")),
202
+ React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.twitter", defaultMessage: "ui.feedObject.share.twitter" }) }))),
203
+ linkedinShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(LINKEDIN_SHARE + url, 'linkedin-share-dialog', 'width=626,height=436') },
204
+ React.createElement(ListItemIcon, null,
205
+ React.createElement(Icon, { fontSize: "small" }, "linkedin")),
206
+ React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.linkedin", defaultMessage: "ui.feedObject.share.linkedin" }) }))))),
205
207
  React.createElement(MenuItem, null,
206
208
  React.createElement(ListItemIcon, null,
207
209
  React.createElement(Icon, { fontSize: "small" }, "link")),
@@ -58,5 +58,5 @@ export default function ContributorsFeedObject(props) {
58
58
  openContributorsDialog && (React.createElement(BaseDialog, { title: React.createElement(FormattedMessage, { defaultMessage: "ui.feedObject.contributors.title", id: "ui.feedObject.contributors.title", values: { total: contributorsObject.total } }), onClose: () => setOpenContributorsDialog(false), open: openContributorsDialog }, contributorsObject.isLoadingNext ? (React.createElement(CentralProgress, { size: 50 })) : (React.createElement(InfiniteScroll, { dataLength: contributorsObject.contributors.length, next: contributorsObject.getNextPage(), hasMoreNext: Boolean(contributorsObject.next), loaderNext: React.createElement(CentralProgress, { size: 30 }), height: 400, endMessage: React.createElement(Typography, { variant: "body2", align: "center", fontWeight: "bold" },
59
59
  React.createElement(FormattedMessage, { id: "ui.feedObject.contributors.noOtherContributors", defaultMessage: "ui.feedObject.contributors.noOtherContributors" })) },
60
60
  React.createElement(List, null, contributorsObject.contributors.map((c, i) => (React.createElement(ListItem, { key: i },
61
- React.createElement(User, { elevation: 0, user: c, key: c.id, sx: { m: 0 } }))))))))))) : null)))));
61
+ React.createElement(User, { elevation: 0, user: c, key: c.id, sx: { m: 0 }, onClick: () => setOpenContributorsDialog(false) }))))))))))) : null)))));
62
62
  }
@@ -188,6 +188,7 @@ export interface FeedObjectProps extends CardProps, VirtualScrollerItemProps {
188
188
  |deleted|.SCFeedObject-deleted|Styles applied to the feed obj when is deleted (visible only for admin and moderator).|
189
189
  |header|.SCFeedObject-header|Styles applied to the header of the card.|
190
190
  |category|.SCFeedObject-category|Styles applied to the category element.|
191
+ |group|.SCFeedObject-group|Styles applied to the group element.|
191
192
  |avatar|.SCFeedObject-avatar|Styles applied to the avatar element.|
192
193
  |username|.SCFeedObject-username|Styles applied to the username element.|
193
194
  |activityAt|.SCFeedObject-activity-at|Styles applied to the activity at section.|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
2
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import CardContent from '@mui/material/CardContent';
5
- import { Avatar, Box, Button, CardActions, CardHeader, Collapse, Stack, Tooltip, Typography } from '@mui/material';
5
+ import { Avatar, Box, Button, CardActions, CardHeader, Chip, Collapse, Stack, Tooltip, Typography } from '@mui/material';
6
6
  import FeedObjectSkeleton from './Skeleton';
7
7
  import DateTimeAgo from '../../shared/DateTimeAgo';
8
8
  import Bullet from '../../shared/Bullet';
@@ -40,6 +40,10 @@ const messages = defineMessages({
40
40
  visibleToAll: {
41
41
  id: 'ui.feedObject.visibleToAll',
42
42
  defaultMessage: 'ui.feedObject.visibleToAll'
43
+ },
44
+ visibleToGroup: {
45
+ id: 'ui.feedObject.visibleToGroup',
46
+ defaultMessage: 'ui.feedObject.visibleToGroup'
43
47
  }
44
48
  });
45
49
  const classes = {
@@ -47,6 +51,7 @@ const classes = {
47
51
  deleted: `${PREFIX}-deleted`,
48
52
  header: `${PREFIX}-header`,
49
53
  category: `${PREFIX}-category`,
54
+ group: `${PREFIX}-group`,
50
55
  avatar: `${PREFIX}-avatar`,
51
56
  username: `${PREFIX}-username`,
52
57
  activityAt: `${PREFIX}-activity-at`,
@@ -100,6 +105,7 @@ const Root = styled(Widget, {
100
105
  |deleted|.SCFeedObject-deleted|Styles applied to the feed obj when is deleted (visible only for admin and moderator).|
101
106
  |header|.SCFeedObject-header|Styles applied to the header of the card.|
102
107
  |category|.SCFeedObject-category|Styles applied to the category element.|
108
+ |group|.SCFeedObject-group|Styles applied to the group element.|
103
109
  |avatar|.SCFeedObject-avatar|Styles applied to the avatar element.|
104
110
  |username|.SCFeedObject-username|Styles applied to the username element.|
105
111
  |activityAt|.SCFeedObject-activity-at|Styles applied to the activity at section.|
@@ -167,7 +173,7 @@ export default function FeedObject(inProps) {
167
173
  }, [onStateChange, onHeightChange]);
168
174
  /**
169
175
  * Update state object
170
- * @param obj
176
+ * @param newObj
171
177
  */
172
178
  const updateObject = (newObj) => {
173
179
  setObj(newObj);
@@ -196,8 +202,10 @@ export default function FeedObject(inProps) {
196
202
  /**
197
203
  * Handle change/update poll: votes
198
204
  */
199
- const handleChangePoll = useCallback((pollObject) => {
200
- updateObject(Object.assign({}, obj, { poll: pollObject }));
205
+ const handleChangePoll = useCallback((pollChoices) => {
206
+ if ('poll' in obj) {
207
+ updateObject(Object.assign({}, obj, { poll: Object.assign(Object.assign({}, obj.poll), { choices: pollChoices }) }));
208
+ }
201
209
  }, [obj]);
202
210
  /**
203
211
  * Handle change poll visibility
@@ -424,8 +432,13 @@ export default function FeedObject(inProps) {
424
432
  template === SCFeedObjectTemplateType.DETAIL ||
425
433
  template === SCFeedObjectTemplateType.SEARCH) {
426
434
  objElement = (React.createElement(React.Fragment, null, obj ? (React.createElement(Box, { className: classNames({ [classes.deleted]: obj && obj.deleted }) },
427
- obj.categories.length > 0 && (React.createElement("div", { className: classes.category }, obj.categories.map((c) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c), key: c.id },
428
- React.createElement(Typography, { variant: "overline" }, c.name)))))),
435
+ obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
436
+ React.createElement(React.Fragment, null, obj.group && (React.createElement("div", { className: classes.group },
437
+ React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true })))),
438
+ obj.categories.map((c) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c), key: c.id },
439
+ React.createElement(Typography, { variant: "overline" }, c.name)))))),
440
+ obj.group && !obj.categories.length && (React.createElement("div", { className: classes.group },
441
+ React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), label: obj.group.name, component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }))),
429
442
  React.createElement(CardHeader, { className: classes.header, avatar: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null }),
430
443
  React.createElement(UserAvatar, { hide: !obj.author.community_badge },
431
444
  React.createElement(Avatar, { "aria-label": "recipe", src: obj.author.avatar, className: classes.avatar }, obj.author.username))), title: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }), obj.author.username), subheader: React.createElement(React.Fragment, null,
@@ -437,7 +450,8 @@ export default function FeedObject(inProps) {
437
450
  React.createElement(Icon, null, "add_location_alt"), (_a = obj.location) === null || _a === void 0 ? void 0 :
438
451
  _a.location))),
439
452
  React.createElement(Bullet, null),
440
- React.createElement(Box, { className: classes.tag }, obj.addressing.length > 0 ? (React.createElement(Tags, { tags: obj.addressing, TagChipProps: { disposable: false, clickable: false } })) : (React.createElement(Tooltip, { title: `${intl.formatMessage(messages.visibleToAll)}` },
453
+ React.createElement(Box, { className: classes.tag }, obj.addressing.length > 0 ? (React.createElement(Tags, { tags: obj.addressing, TagChipProps: { disposable: false, clickable: false } })) : obj.group ? (React.createElement(Tooltip, { title: `${intl.formatMessage(messages.visibleToGroup, { group: obj.group.name })}` },
454
+ React.createElement(Icon, { color: "disabled", fontSize: "small" }, "groups"))) : (React.createElement(Tooltip, { title: `${intl.formatMessage(messages.visibleToAll)}` },
441
455
  React.createElement(Icon, { color: "disabled", fontSize: "small" }, "public"))))), action: renderHeaderAction() }),
442
456
  React.createElement(CardContent, { classes: { root: classes.content } },
443
457
  React.createElement(Box, { className: classes.titleSection }, 'title' in obj && (React.createElement(React.Fragment, null, template === SCFeedObjectTemplateType.DETAIL ? (React.createElement(Typography, { variant: "body1", gutterBottom: true, className: classes.title }, obj.title)) : (React.createElement(Link, { to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)) },
@@ -466,8 +480,13 @@ export default function FeedObject(inProps) {
466
480
  }
467
481
  else if (template === SCFeedObjectTemplateType.SHARE) {
468
482
  objElement = (React.createElement(React.Fragment, null, obj ? (React.createElement(React.Fragment, null,
469
- obj.categories.length > 0 && (React.createElement("div", { className: classes.category }, obj.categories.map((c) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c), key: c.id },
470
- React.createElement(Typography, { variant: "overline" }, c.name)))))),
483
+ obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
484
+ React.createElement(React.Fragment, null, obj.group && (React.createElement("div", { className: classes.group },
485
+ React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true })))),
486
+ obj.categories.map((c) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c), key: c.id },
487
+ React.createElement(Typography, { variant: "overline" }, c.name)))))),
488
+ obj.group && !obj.categories.length && (React.createElement("div", { className: classes.group },
489
+ React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), label: obj.group.name, component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }))),
471
490
  React.createElement(CardHeader, { classes: { root: classes.header }, avatar: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }),
472
491
  React.createElement(UserAvatar, { hide: !obj.author.community_badge },
473
492
  React.createElement(Avatar, { "aria-label": "recipe", src: obj.author.avatar, className: classes.avatar }, obj.author.username))), title: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }), obj.author.username), subheader: React.createElement(Link, { to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)), className: classes.activityAt },
@@ -67,36 +67,36 @@ export default function PollObject(props) {
67
67
  * Handles choice upvote
68
68
  */
69
69
  const handleVote = (id) => {
70
+ const prevChoices = [...choices];
71
+ let updatedChoices;
70
72
  if (multipleChoices) {
71
- setChoices((prevChoices) => {
72
- return prevChoices.map((choice) => Object.assign({}, choice, {
73
- voted: choice.id === id ? true : choice.voted,
74
- vote_count: choice.id === id ? choice.vote_count + 1 : choice.vote_count
75
- }));
76
- });
73
+ updatedChoices = prevChoices.map((choice) => Object.assign({}, choice, {
74
+ voted: choice.id === id ? true : choice.voted,
75
+ vote_count: choice.id === id ? choice.vote_count + 1 : choice.vote_count
76
+ }));
77
77
  setVotes((prevVotes) => prevVotes + 1);
78
78
  }
79
79
  else {
80
- setChoices((prevChoices) => {
81
- const updatedChoices = prevChoices.map((choice) => {
82
- return Object.assign(Object.assign({}, choice), { voted: choice.id === id, vote_count: choice.id === id ? choice.vote_count + 1 : choice.vote_count > 0 && choice.voted ? choice.vote_count - 1 : choice.vote_count });
83
- });
84
- const newVotes = updatedChoices.reduce((totalVotes, choice) => totalVotes + choice.vote_count, 0);
85
- setVotes(newVotes);
86
- return updatedChoices;
87
- });
80
+ updatedChoices = prevChoices.map((choice) => Object.assign({}, choice, {
81
+ voted: choice.id === id,
82
+ vote_count: choice.id === id ? choice.vote_count + 1 : choice.vote_count > 0 && choice.voted ? choice.vote_count - 1 : choice.vote_count
83
+ }));
84
+ setVotes(updatedChoices.reduce((totalVotes, choice) => totalVotes + choice.vote_count, 0));
88
85
  }
86
+ setChoices(updatedChoices);
87
+ onChange(updatedChoices);
89
88
  };
90
89
  /**
91
90
  * Handles choice unvote
92
91
  */
93
92
  const handleUnVote = (id) => {
94
- setChoices((prevChoices) => {
95
- return prevChoices.map((choice) => Object.assign({}, choice, {
96
- voted: choice.id === id ? false : choice.voted,
97
- vote_count: choice.id === id && choice.vote_count > 0 ? choice.vote_count - 1 : choice.vote_count
98
- }));
99
- });
93
+ const prevChoices = [...choices];
94
+ const updatedChoices = prevChoices.map((choice) => Object.assign({}, choice, {
95
+ voted: choice.id === id ? false : choice.voted,
96
+ vote_count: choice.id === id && choice.vote_count > 0 ? choice.vote_count - 1 : choice.vote_count
97
+ }));
98
+ setChoices(updatedChoices);
99
+ onChange(updatedChoices);
100
100
  setVotes((prevVotes) => prevVotes - 1);
101
101
  };
102
102
  /**
@@ -55,7 +55,7 @@ export default function FeedUpdatesWidget(inProps) {
55
55
  const [updates, setUpdates] = useState(false);
56
56
  // REFS
57
57
  const updatesSubscription = useRef(null);
58
- // Subscripber for pubsub callback
58
+ // Subscriber for pubsub callback
59
59
  const subscriber = (msg, data) => {
60
60
  if (subscriptionChannelUpdatesCallback(msg, data)) {
61
61
  setUpdates(true);