@selfcommunity/react-ui 0.7.9-alpha.4 → 0.7.9-alpha.6

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 (24) hide show
  1. package/lib/cjs/components/Composer/Composer.js +3 -5
  2. package/lib/cjs/components/Composer/Content/ContentPost/ContentPost.js +4 -3
  3. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -2
  4. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +18 -6
  5. package/lib/cjs/components/EditGroupButton/EditGroupButton.js +4 -0
  6. package/lib/cjs/components/Group/Group.js +2 -2
  7. package/lib/cjs/components/GroupHeader/Skeleton.d.ts +2 -4
  8. package/lib/cjs/components/GroupHeader/Skeleton.js +10 -10
  9. package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +1 -0
  10. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +3 -1
  11. package/lib/cjs/components/Groups/Groups.js +1 -1
  12. package/lib/esm/components/Composer/Composer.js +3 -5
  13. package/lib/esm/components/Composer/Content/ContentPost/ContentPost.js +4 -3
  14. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -2
  15. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +18 -6
  16. package/lib/esm/components/EditGroupButton/EditGroupButton.js +5 -1
  17. package/lib/esm/components/Group/Group.js +2 -2
  18. package/lib/esm/components/GroupHeader/Skeleton.d.ts +2 -4
  19. package/lib/esm/components/GroupHeader/Skeleton.js +10 -10
  20. package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +1 -0
  21. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +4 -2
  22. package/lib/esm/components/Groups/Groups.js +1 -1
  23. package/lib/umd/react-ui.js +1 -1
  24. package/package.json +4 -4
@@ -29,7 +29,6 @@ const Attributes_1 = tslib_1.__importDefault(require("./Attributes"));
29
29
  const constants_1 = require("./constants");
30
30
  const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
31
31
  const CloseLayer_1 = tslib_1.__importDefault(require("./Layer/CloseLayer"));
32
- const AudienceLayer_2 = require("./Layer/AudienceLayer/AudienceLayer");
33
32
  const DialogTransition = (0, react_1.forwardRef)(function Transition(props, ref) {
34
33
  return react_1.default.createElement(material_1.Fade, Object.assign({ ref: ref }, props));
35
34
  });
@@ -308,7 +307,7 @@ function Composer(inProps) {
308
307
  }
309
308
  }), [handleAddLayer, handleRemoveLayer, handleChangeCategories, categories]);
310
309
  const handleChangeAudience = (0, react_1.useCallback)((value) => {
311
- if (group) {
310
+ if (group || typeof value === 'object') {
312
311
  dispatch({ type: 'group', value });
313
312
  }
314
313
  else {
@@ -322,8 +321,7 @@ function Composer(inProps) {
322
321
  ComponentProps: {
323
322
  onClose: handleRemoveLayer,
324
323
  onSave: handleChangeAudience,
325
- defaultValue: group ? group : addressing,
326
- defaultType: group ? AudienceLayer_2.AudienceTypes.AUDIENCE_GROUP : addressing ? AudienceLayer_2.AudienceTypes.AUDIENCE_TAG : AudienceLayer_2.AudienceTypes.AUDIENCE_ALL
324
+ defaultValue: group || typeof addressing === 'object' ? group : addressing
327
325
  }
328
326
  }), [handleAddLayer, handleRemoveLayer, handleChangeAudience, addressing, group]);
329
327
  const handleChangeLocation = (0, react_1.useCallback)((value) => {
@@ -555,7 +553,7 @@ function Composer(inProps) {
555
553
  }),
556
554
  react_1.default.createElement(material_1.IconButton, { disabled: isSubmitting, onClick: handleAddCategoryLayer },
557
555
  react_1.default.createElement(Icon_1.default, null, "category")),
558
- react_1.default.createElement(material_1.IconButton, { disabled: isSubmitting || !features.includes(types_1.SCFeatureName.TAGGING), onClick: handleAddAudienceLayer }, addressing === null || addressing.length === 0 ? react_1.default.createElement(Icon_1.default, null, "public") : react_1.default.createElement(Icon_1.default, null, "label")),
556
+ react_1.default.createElement(material_1.IconButton, { disabled: isSubmitting || !features.includes(types_1.SCFeatureName.TAGGING), onClick: handleAddAudienceLayer }, addressing === null || addressing.length === 0 ? (react_1.default.createElement(Icon_1.default, null, "public")) : typeof addressing === 'object' ? (react_1.default.createElement(Icon_1.default, null, "groups")) : (react_1.default.createElement(Icon_1.default, null, "label"))),
559
557
  preferences[react_core_1.SCPreferences.ADDONS_POST_GEOLOCATION_ENABLED].value && (react_1.default.createElement(material_1.IconButton, { disabled: isSubmitting, onClick: handleAddLocationLayer, color: location !== null ? 'primary' : 'default' },
560
558
  react_1.default.createElement(Icon_1.default, null, "add_location_alt"))))),
561
559
  layer && (react_1.default.createElement(LayerTransitionRoot, { className: classes.layerTransitionRoot, in: true, container: dialogRef.current, direction: "left" },
@@ -25,7 +25,8 @@ const DEFAULT_POST = {
25
25
  categories: [],
26
26
  medias: [],
27
27
  html: '',
28
- addressing: []
28
+ addressing: [],
29
+ group: null
29
30
  };
30
31
  exports.default = (props) => {
31
32
  // PROPS
@@ -43,7 +44,7 @@ exports.default = (props) => {
43
44
  }, [value]);
44
45
  // RENDER
45
46
  return (react_1.default.createElement(Root, { className: (0, classnames_1.default)(classes.root, className) },
46
- generalError && react_1.default.createElement(material_1.Typography, { className: classes.generalError },
47
- react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` })),
47
+ generalError && (react_1.default.createElement(material_1.Typography, { className: classes.generalError },
48
+ react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` }))),
48
49
  react_1.default.createElement(Editor_1.default, Object.assign({ ref: editorRef }, EditorProps, { editable: !disabled, className: classes.editor, onChange: handleChangeHtml, defaultValue: value.html }))));
49
50
  };
@@ -10,9 +10,8 @@ export declare enum AudienceTypes {
10
10
  AUDIENCE_GROUP = "group"
11
11
  }
12
12
  export interface AudienceLayerProps extends Omit<BoxProps, 'defaultValue'>, ComposerLayerProps {
13
- defaultType: AudienceTypes;
14
13
  defaultValue: SCTagType[] | SCGroupType;
15
14
  TextFieldProps?: TextFieldProps;
16
15
  }
17
- 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" | "defaultType" | "onSave"> & React.RefAttributes<unknown>>;
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>>;
18
17
  export default AudienceLayer;
@@ -35,10 +35,10 @@ const Root = (0, styles_1.styled)(material_1.Box, {
35
35
  })(() => ({}));
36
36
  const AudienceLayer = react_1.default.forwardRef((props, ref) => {
37
37
  // Props
38
- const { className, onClose, onSave, defaultType = AudienceTypes.AUDIENCE_TAG, defaultValue = AudienceTypes.AUDIENCE_TAG ? [] : null, TextFieldProps = {
38
+ const { className, onClose, onSave, defaultValue = AudienceTypes.AUDIENCE_TAG ? [] : null, TextFieldProps = {
39
39
  variant: 'outlined',
40
40
  label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.tags.label", defaultMessage: "ui.composer.layer.audience.tags.label" })
41
- } } = props, rest = tslib_1.__rest(props, ["className", "onClose", "onSave", "defaultType", "defaultValue", "TextFieldProps"]);
41
+ } } = props, rest = tslib_1.__rest(props, ["className", "onClose", "onSave", "defaultValue", "TextFieldProps"]);
42
42
  // STATE
43
43
  const [autocompleteOpen, setAutocompleteOpen] = (0, react_1.useState)(false);
44
44
  const [audience, setAudience] = (0, react_1.useState)(
@@ -46,7 +46,7 @@ const AudienceLayer = react_1.default.forwardRef((props, ref) => {
46
46
  // @ts-ignore
47
47
  defaultValue === null || defaultValue.length === 0
48
48
  ? AudienceTypes.AUDIENCE_ALL
49
- : defaultType === AudienceTypes.AUDIENCE_GROUP
49
+ : typeof defaultValue === 'object'
50
50
  ? AudienceTypes.AUDIENCE_GROUP
51
51
  : AudienceTypes.AUDIENCE_TAG);
52
52
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -58,7 +58,7 @@ const AudienceLayer = react_1.default.forwardRef((props, ref) => {
58
58
  const handleSave = (0, react_1.useCallback)(
59
59
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
60
60
  // @ts-ignore
61
- () => (defaultType === 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)), [value, onSave]);
61
+ () => (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]);
62
62
  const handleChange = (0, react_1.useCallback)((event, tags) => setValue(tags), []);
63
63
  const handleGroupChange = (0, react_1.useCallback)((group) => setValue(group), []);
64
64
  const handleChangeAudience = (0, react_1.useCallback)((event, data) => setAudience(data), []);
@@ -75,8 +75,20 @@ const AudienceLayer = react_1.default.forwardRef((props, ref) => {
75
75
  react_1.default.createElement(DialogContent_1.default, { className: classes.content },
76
76
  react_1.default.createElement(material_1.Tabs, { value: audience, onChange: handleChangeAudience, "aria-label": "audience type" },
77
77
  react_1.default.createElement(material_1.Tab, { value: AudienceTypes.AUDIENCE_ALL, icon: react_1.default.createElement(Icon_1.default, null, "public"), label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.all", defaultMessage: "ui.composer.layer.audience.all" }) }),
78
- react_1.default.createElement(material_1.Tab, { disabled: defaultType === AudienceTypes.AUDIENCE_TAG, value: AudienceTypes.AUDIENCE_GROUP, icon: react_1.default.createElement(Icon_1.default, null, "groups"), label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.group", defaultMessage: "ui.composer.layer.audience.group" }) }),
79
- react_1.default.createElement(material_1.Tab, { disabled: defaultType === AudienceTypes.AUDIENCE_GROUP, value: AudienceTypes.AUDIENCE_TAG, icon: react_1.default.createElement(Icon_1.default, null, "label"), label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.tag", defaultMessage: "ui.composer.layer.audience.tag" }) })),
78
+ react_1.default.createElement(material_1.Tab
79
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
80
+ // @ts-ignore
81
+ , {
82
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
83
+ // @ts-ignore
84
+ disabled: defaultValue && defaultValue.length !== 0, value: AudienceTypes.AUDIENCE_GROUP, icon: react_1.default.createElement(Icon_1.default, null, "groups"), label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.group", defaultMessage: "ui.composer.layer.audience.group" }) }),
85
+ react_1.default.createElement(material_1.Tab
86
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
87
+ // @ts-ignore
88
+ , {
89
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
90
+ // @ts-ignore
91
+ disabled: typeof defaultValue === 'object', value: AudienceTypes.AUDIENCE_TAG, icon: react_1.default.createElement(Icon_1.default, null, "label"), label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.tag", defaultMessage: "ui.composer.layer.audience.tag" }) })),
80
92
  react_1.default.createElement(material_1.Typography, { className: classes.message },
81
93
  audience === AudienceTypes.AUDIENCE_ALL && (react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
82
94
  audience === AudienceTypes.AUDIENCE_GROUP && (react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composer.layer.audience.group.message", defaultMessage: "ui.composer.audience.layer.group.message" })),
@@ -44,10 +44,14 @@ function EditGroupButton(inProps) {
44
44
  });
45
45
  const { className, groupId, group, onEditSuccess } = props, rest = tslib_1.__rest(props, ["className", "groupId", "group", "onEditSuccess"]);
46
46
  const { scGroup, setSCGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
47
+ const scUserContext = (0, react_core_1.useSCUser)();
47
48
  const handleSuccess = (data) => {
48
49
  setSCGroup(data);
49
50
  onEditSuccess && onEditSuccess(data);
50
51
  };
52
+ if (!scUserContext.user) {
53
+ return null;
54
+ }
51
55
  /**
52
56
  * Renders root object
53
57
  */
@@ -63,7 +63,7 @@ function Group(inProps) {
63
63
  props: inProps,
64
64
  name: constants_1.PREFIX
65
65
  });
66
- const { groupId = null, group = null, className = null, elevation, hideActions = false, groupSubscribeButtonProps = {}, buttonProps = {}, visible = true } = props, rest = tslib_1.__rest(props, ["groupId", "group", "className", "elevation", "hideActions", "groupSubscribeButtonProps", "buttonProps", "visible"]);
66
+ const { groupId = null, group = null, className = null, elevation, hideActions = false, groupSubscribeButtonProps = {}, visible = true } = props, rest = tslib_1.__rest(props, ["groupId", "group", "className", "elevation", "hideActions", "groupSubscribeButtonProps", "visible"]);
67
67
  // STATE
68
68
  const { scGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
69
69
  // CONTEXT
@@ -90,7 +90,7 @@ function Group(inProps) {
90
90
  * Renders root object
91
91
  */
92
92
  return (react_1.default.createElement(react_1.default.Fragment, null,
93
- react_1.default.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: (0, classnames_1.default)(classes.root, className), ButtonBaseProps: buttonProps !== null && buttonProps !== void 0 ? buttonProps : { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: react_1.default.createElement(material_1.Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary: scGroup.name, secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })),
93
+ react_1.default.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: (0, classnames_1.default)(classes.root, className), ButtonBaseProps: { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: react_1.default.createElement(material_1.Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary: scGroup.name, secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })),
94
94
  openAlert && react_1.default.createElement(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })));
95
95
  }
96
96
  exports.default = Group;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * > API documentation for the Community-JS Group Headerr Skeleton component. Learn about the available props and the CSS API.
2
+ * > API documentation for the Community-JS Group Header Skeleton component. Learn about the available props and the CSS API.
3
3
 
4
4
  #### Import
5
5
 
@@ -18,9 +18,7 @@
18
18
  |root|.SCGroupHeader-skeleton-root|Styles applied to the root element.|
19
19
  |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
20
20
  |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
21
- |actions|.SCGroupHeader-actions|Styles applied to the actions section.|
22
- |section|.SCGroupHeader-section|Styles applied to the info section.|
23
- |username|.SCGroupHeader-username|Styles applied to the username element.|
21
+ |info|.SCGroupHeader-info|Styles applied to the info info.|
24
22
  *
25
23
  */
26
24
  declare function GroupHeaderSkeleton(): JSX.Element;
@@ -10,16 +10,14 @@ const classes = {
10
10
  root: `${constants_1.PREFIX}-skeleton-root`,
11
11
  cover: `${constants_1.PREFIX}-cover`,
12
12
  avatar: `${constants_1.PREFIX}-avatar`,
13
- actions: `${constants_1.PREFIX}-actions`,
14
- section: `${constants_1.PREFIX}-section`,
15
- username: `${constants_1.PREFIX}-username`
13
+ info: `${constants_1.PREFIX}-info`
16
14
  };
17
15
  const Root = (0, styles_1.styled)(material_1.Box, {
18
16
  name: constants_1.PREFIX,
19
17
  slot: 'SkeletonRoot'
20
18
  })(() => ({}));
21
19
  /**
22
- * > API documentation for the Community-JS Group Headerr Skeleton component. Learn about the available props and the CSS API.
20
+ * > API documentation for the Community-JS Group Header Skeleton component. Learn about the available props and the CSS API.
23
21
 
24
22
  #### Import
25
23
 
@@ -38,9 +36,7 @@ const Root = (0, styles_1.styled)(material_1.Box, {
38
36
  |root|.SCGroupHeader-skeleton-root|Styles applied to the root element.|
39
37
  |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
40
38
  |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
41
- |actions|.SCGroupHeader-actions|Styles applied to the actions section.|
42
- |section|.SCGroupHeader-section|Styles applied to the info section.|
43
- |username|.SCGroupHeader-username|Styles applied to the username element.|
39
+ |info|.SCGroupHeader-info|Styles applied to the info info.|
44
40
  *
45
41
  */
46
42
  function GroupHeaderSkeleton() {
@@ -49,8 +45,12 @@ function GroupHeaderSkeleton() {
49
45
  react_1.default.createElement(Skeleton_1.default, { className: classes.cover, animation: "wave", variant: "rectangular" }),
50
46
  react_1.default.createElement(material_1.Box, { className: classes.avatar },
51
47
  react_1.default.createElement(Skeleton_1.default, { animation: "wave", variant: "circular", width: theme.selfcommunity.group.avatar.sizeLarge, height: theme.selfcommunity.group.avatar.sizeLarge })),
52
- react_1.default.createElement(material_1.Box, { className: classes.section },
53
- react_1.default.createElement(material_1.Typography, { variant: "h5", className: classes.username },
54
- react_1.default.createElement(Skeleton_1.default, { animation: "wave", sx: { height: 30, width: 100 } })))));
48
+ react_1.default.createElement(material_1.Box, { className: classes.info },
49
+ react_1.default.createElement(material_1.Typography, { variant: "h5" },
50
+ react_1.default.createElement(Skeleton_1.default, { animation: "wave", sx: { height: 30, width: 200 } })),
51
+ react_1.default.createElement(material_1.Typography, null,
52
+ react_1.default.createElement(Skeleton_1.default, { animation: "wave", sx: { height: 20, width: 150 } })),
53
+ react_1.default.createElement(material_1.Typography, null,
54
+ react_1.default.createElement(Skeleton_1.default, { animation: "wave", sx: { height: 20, width: 100 } })))));
55
55
  }
56
56
  exports.default = GroupHeaderSkeleton;
@@ -181,6 +181,7 @@ function GroupInviteButton(inProps) {
181
181
  .then(() => {
182
182
  setIsSending(false);
183
183
  setOpen(false);
184
+ setInvited([]);
184
185
  })
185
186
  .catch((error) => {
186
187
  setOpen(false);
@@ -43,6 +43,7 @@ const Root = (0, styles_1.styled)(lab_1.LoadingButton, {
43
43
  * @param inProps
44
44
  */
45
45
  function GroupSubscribeButton(inProps) {
46
+ var _a;
46
47
  // PROPS
47
48
  const props = (0, system_1.useThemeProps)({
48
49
  props: inProps,
@@ -62,6 +63,7 @@ function GroupSubscribeButton(inProps) {
62
63
  group,
63
64
  cacheStrategy: authUserId ? utils_1.CacheStrategies.CACHE_FIRST : utils_1.CacheStrategies.STALE_WHILE_REVALIDATE
64
65
  });
66
+ const canEdit = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
65
67
  (0, react_1.useEffect)(() => {
66
68
  /**
67
69
  * Call scGroupsManager.subscriptionStatus inside an effect
@@ -119,7 +121,7 @@ function GroupSubscribeButton(inProps) {
119
121
  }
120
122
  return _status;
121
123
  };
122
- if (!scGroup || (scGroup && !scGroup.subscription_status)) {
124
+ if (!scGroup || (scGroup && !scGroup.subscription_status) || canEdit) {
123
125
  return null;
124
126
  }
125
127
  return (react_1.default.createElement(Root, Object.assign({ size: "small", variant: "outlined", onClick: handleSubscribeAction, loading: scUserContext.user ? scGroupsManager.isLoading(scGroup) : null, className: (0, classnames_1.default)(classes.root, className) }, rest), getStatus()));
@@ -173,7 +173,7 @@ function Groups(inProps) {
173
173
  const content = (react_1.default.createElement(react_1.default.Fragment, null, !state.count ? (react_1.default.createElement(material_1.Typography, { className: classes.noResults, variant: "body2" },
174
174
  react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.groupRequestsWidget.subtitle.noResults", defaultMessage: "" }))) : (react_1.default.createElement(react_1.default.Fragment, null,
175
175
  react_1.default.createElement(material_1.Grid, { container: true, spacing: { xs: 3 }, className: classes.groups }, state.results.slice(0, state.visibleItems).map((group) => (react_1.default.createElement(material_1.Grid, { item: true, xs: 12, sm: 8, md: 6, key: group.id, className: classes.item },
176
- react_1.default.createElement(Group_1.default, Object.assign({ actions: react_1.default.createElement(react_1.default.Fragment, null), group: group, groupId: group.id, buttonProps: { onClick: () => console.log(group) } }, GroupProps)))))),
176
+ react_1.default.createElement(Group_1.default, Object.assign({ group: group, groupId: group.id }, GroupProps)))))),
177
177
  state.count > state.visibleItems && (react_1.default.createElement(material_1.Button, { className: classes.showMore, onClick: handleNext },
178
178
  react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.groupRequestsWidget.button.showMore", defaultMessage: "ui.groupRequestsWidget.button.showMore" })))))));
179
179
  return (react_1.default.createElement(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest), content));
@@ -27,7 +27,6 @@ import Attributes from './Attributes';
27
27
  import { PREFIX } from './constants';
28
28
  import ComposerSkeleton from './Skeleton';
29
29
  import CloseLayer from './Layer/CloseLayer';
30
- import { AudienceTypes } from './Layer/AudienceLayer/AudienceLayer';
31
30
  const DialogTransition = forwardRef(function Transition(props, ref) {
32
31
  return React.createElement(Fade, Object.assign({ ref: ref }, props));
33
32
  });
@@ -306,7 +305,7 @@ export default function Composer(inProps) {
306
305
  }
307
306
  }), [handleAddLayer, handleRemoveLayer, handleChangeCategories, categories]);
308
307
  const handleChangeAudience = useCallback((value) => {
309
- if (group) {
308
+ if (group || typeof value === 'object') {
310
309
  dispatch({ type: 'group', value });
311
310
  }
312
311
  else {
@@ -320,8 +319,7 @@ export default function Composer(inProps) {
320
319
  ComponentProps: {
321
320
  onClose: handleRemoveLayer,
322
321
  onSave: handleChangeAudience,
323
- defaultValue: group ? group : addressing,
324
- defaultType: group ? AudienceTypes.AUDIENCE_GROUP : addressing ? AudienceTypes.AUDIENCE_TAG : AudienceTypes.AUDIENCE_ALL
322
+ defaultValue: group || typeof addressing === 'object' ? group : addressing
325
323
  }
326
324
  }), [handleAddLayer, handleRemoveLayer, handleChangeAudience, addressing, group]);
327
325
  const handleChangeLocation = useCallback((value) => {
@@ -553,7 +551,7 @@ export default function Composer(inProps) {
553
551
  }),
554
552
  React.createElement(IconButton, { disabled: isSubmitting, onClick: handleAddCategoryLayer },
555
553
  React.createElement(Icon, null, "category")),
556
- React.createElement(IconButton, { disabled: isSubmitting || !features.includes(SCFeatureName.TAGGING), onClick: handleAddAudienceLayer }, addressing === null || addressing.length === 0 ? React.createElement(Icon, null, "public") : React.createElement(Icon, null, "label")),
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"))),
557
555
  preferences[SCPreferences.ADDONS_POST_GEOLOCATION_ENABLED].value && (React.createElement(IconButton, { disabled: isSubmitting, onClick: handleAddLocationLayer, color: location !== null ? 'primary' : 'default' },
558
556
  React.createElement(Icon, null, "add_location_alt"))))),
559
557
  layer && (React.createElement(LayerTransitionRoot, { className: classes.layerTransitionRoot, in: true, container: dialogRef.current, direction: "left" },
@@ -22,7 +22,8 @@ const DEFAULT_POST = {
22
22
  categories: [],
23
23
  medias: [],
24
24
  html: '',
25
- addressing: []
25
+ addressing: [],
26
+ group: null
26
27
  };
27
28
  export default (props) => {
28
29
  // PROPS
@@ -40,7 +41,7 @@ export default (props) => {
40
41
  }, [value]);
41
42
  // RENDER
42
43
  return (React.createElement(Root, { className: classNames(classes.root, className) },
43
- generalError && React.createElement(Typography, { className: classes.generalError },
44
- React.createElement(FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` })),
44
+ generalError && (React.createElement(Typography, { className: classes.generalError },
45
+ React.createElement(FormattedMessage, { id: `ui.composer.error.${generalError}`, defaultMessage: `ui.composer.error.${generalError}` }))),
45
46
  React.createElement(Editor, Object.assign({ ref: editorRef }, EditorProps, { editable: !disabled, className: classes.editor, onChange: handleChangeHtml, defaultValue: value.html }))));
46
47
  };
@@ -10,9 +10,8 @@ export declare enum AudienceTypes {
10
10
  AUDIENCE_GROUP = "group"
11
11
  }
12
12
  export interface AudienceLayerProps extends Omit<BoxProps, 'defaultValue'>, ComposerLayerProps {
13
- defaultType: AudienceTypes;
14
13
  defaultValue: SCTagType[] | SCGroupType;
15
14
  TextFieldProps?: TextFieldProps;
16
15
  }
17
- 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" | "defaultType" | "onSave"> & React.RefAttributes<unknown>>;
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>>;
18
17
  export default AudienceLayer;
@@ -32,10 +32,10 @@ const Root = styled(Box, {
32
32
  })(() => ({}));
33
33
  const AudienceLayer = React.forwardRef((props, ref) => {
34
34
  // Props
35
- const { className, onClose, onSave, defaultType = AudienceTypes.AUDIENCE_TAG, defaultValue = AudienceTypes.AUDIENCE_TAG ? [] : null, TextFieldProps = {
35
+ const { className, onClose, onSave, defaultValue = AudienceTypes.AUDIENCE_TAG ? [] : null, TextFieldProps = {
36
36
  variant: 'outlined',
37
37
  label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tags.label", defaultMessage: "ui.composer.layer.audience.tags.label" })
38
- } } = props, rest = __rest(props, ["className", "onClose", "onSave", "defaultType", "defaultValue", "TextFieldProps"]);
38
+ } } = props, rest = __rest(props, ["className", "onClose", "onSave", "defaultValue", "TextFieldProps"]);
39
39
  // STATE
40
40
  const [autocompleteOpen, setAutocompleteOpen] = useState(false);
41
41
  const [audience, setAudience] = useState(
@@ -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
- : defaultType === AudienceTypes.AUDIENCE_GROUP
46
+ : typeof defaultValue === 'object'
47
47
  ? AudienceTypes.AUDIENCE_GROUP
48
48
  : AudienceTypes.AUDIENCE_TAG);
49
49
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -55,7 +55,7 @@ const AudienceLayer = React.forwardRef((props, ref) => {
55
55
  const handleSave = useCallback(
56
56
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
57
  // @ts-ignore
58
- () => (defaultType === 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)), [value, onSave]);
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]);
59
59
  const handleChange = useCallback((event, tags) => setValue(tags), []);
60
60
  const handleGroupChange = useCallback((group) => setValue(group), []);
61
61
  const handleChangeAudience = useCallback((event, data) => setAudience(data), []);
@@ -72,8 +72,20 @@ 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, { disabled: defaultType === AudienceTypes.AUDIENCE_TAG, 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" }) }),
76
- React.createElement(Tab, { disabled: defaultType === AudienceTypes.AUDIENCE_GROUP, 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
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" }) })),
77
89
  React.createElement(Typography, { className: classes.message },
78
90
  audience === AudienceTypes.AUDIENCE_ALL && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
79
91
  audience === AudienceTypes.AUDIENCE_GROUP && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group.message", defaultMessage: "ui.composer.audience.layer.group.message" })),
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { useThemeProps } from '@mui/system';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { FormattedMessage } from 'react-intl';
6
- import { useSCFetchGroup } from '@selfcommunity/react-core';
6
+ import { useSCFetchGroup, useSCUser } from '@selfcommunity/react-core';
7
7
  import classNames from 'classnames';
8
8
  import CreateGroupButton from '../CreateGroupButton';
9
9
  const PREFIX = 'SCEditGroupButton';
@@ -42,10 +42,14 @@ export default function EditGroupButton(inProps) {
42
42
  });
43
43
  const { className, groupId, group, onEditSuccess } = props, rest = __rest(props, ["className", "groupId", "group", "onEditSuccess"]);
44
44
  const { scGroup, setSCGroup } = useSCFetchGroup({ id: groupId, group });
45
+ const scUserContext = useSCUser();
45
46
  const handleSuccess = (data) => {
46
47
  setSCGroup(data);
47
48
  onEditSuccess && onEditSuccess(data);
48
49
  };
50
+ if (!scUserContext.user) {
51
+ return null;
52
+ }
49
53
  /**
50
54
  * Renders root object
51
55
  */
@@ -61,7 +61,7 @@ export default function Group(inProps) {
61
61
  props: inProps,
62
62
  name: PREFIX
63
63
  });
64
- const { groupId = null, group = null, className = null, elevation, hideActions = false, groupSubscribeButtonProps = {}, buttonProps = {}, visible = true } = props, rest = __rest(props, ["groupId", "group", "className", "elevation", "hideActions", "groupSubscribeButtonProps", "buttonProps", "visible"]);
64
+ const { groupId = null, group = null, className = null, elevation, hideActions = false, groupSubscribeButtonProps = {}, visible = true } = props, rest = __rest(props, ["groupId", "group", "className", "elevation", "hideActions", "groupSubscribeButtonProps", "visible"]);
65
65
  // STATE
66
66
  const { scGroup } = useSCFetchGroup({ id: groupId, group });
67
67
  // CONTEXT
@@ -88,6 +88,6 @@ export default function Group(inProps) {
88
88
  * Renders root object
89
89
  */
90
90
  return (React.createElement(React.Fragment, null,
91
- React.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: buttonProps !== null && buttonProps !== void 0 ? buttonProps : { component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: React.createElement(Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary: scGroup.name, secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })),
91
+ React.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: React.createElement(Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary: scGroup.name, secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })),
92
92
  openAlert && React.createElement(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })));
93
93
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * > API documentation for the Community-JS Group Headerr Skeleton component. Learn about the available props and the CSS API.
2
+ * > API documentation for the Community-JS Group Header Skeleton component. Learn about the available props and the CSS API.
3
3
 
4
4
  #### Import
5
5
 
@@ -18,9 +18,7 @@
18
18
  |root|.SCGroupHeader-skeleton-root|Styles applied to the root element.|
19
19
  |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
20
20
  |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
21
- |actions|.SCGroupHeader-actions|Styles applied to the actions section.|
22
- |section|.SCGroupHeader-section|Styles applied to the info section.|
23
- |username|.SCGroupHeader-username|Styles applied to the username element.|
21
+ |info|.SCGroupHeader-info|Styles applied to the info info.|
24
22
  *
25
23
  */
26
24
  declare function GroupHeaderSkeleton(): JSX.Element;
@@ -7,16 +7,14 @@ const classes = {
7
7
  root: `${PREFIX}-skeleton-root`,
8
8
  cover: `${PREFIX}-cover`,
9
9
  avatar: `${PREFIX}-avatar`,
10
- actions: `${PREFIX}-actions`,
11
- section: `${PREFIX}-section`,
12
- username: `${PREFIX}-username`
10
+ info: `${PREFIX}-info`
13
11
  };
14
12
  const Root = styled(Box, {
15
13
  name: PREFIX,
16
14
  slot: 'SkeletonRoot'
17
15
  })(() => ({}));
18
16
  /**
19
- * > API documentation for the Community-JS Group Headerr Skeleton component. Learn about the available props and the CSS API.
17
+ * > API documentation for the Community-JS Group Header Skeleton component. Learn about the available props and the CSS API.
20
18
 
21
19
  #### Import
22
20
 
@@ -35,9 +33,7 @@ const Root = styled(Box, {
35
33
  |root|.SCGroupHeader-skeleton-root|Styles applied to the root element.|
36
34
  |avatar|.SCGroupHeader-avatar|Styles applied to the avatar element.|
37
35
  |cover|.SCGroupHeader-cover|Styles applied to the cover element.|
38
- |actions|.SCGroupHeader-actions|Styles applied to the actions section.|
39
- |section|.SCGroupHeader-section|Styles applied to the info section.|
40
- |username|.SCGroupHeader-username|Styles applied to the username element.|
36
+ |info|.SCGroupHeader-info|Styles applied to the info info.|
41
37
  *
42
38
  */
43
39
  function GroupHeaderSkeleton() {
@@ -46,8 +42,12 @@ function GroupHeaderSkeleton() {
46
42
  React.createElement(Skeleton, { className: classes.cover, animation: "wave", variant: "rectangular" }),
47
43
  React.createElement(Box, { className: classes.avatar },
48
44
  React.createElement(Skeleton, { animation: "wave", variant: "circular", width: theme.selfcommunity.group.avatar.sizeLarge, height: theme.selfcommunity.group.avatar.sizeLarge })),
49
- React.createElement(Box, { className: classes.section },
50
- React.createElement(Typography, { variant: "h5", className: classes.username },
51
- React.createElement(Skeleton, { animation: "wave", sx: { height: 30, width: 100 } })))));
45
+ React.createElement(Box, { className: classes.info },
46
+ React.createElement(Typography, { variant: "h5" },
47
+ React.createElement(Skeleton, { animation: "wave", sx: { height: 30, width: 200 } })),
48
+ React.createElement(Typography, null,
49
+ React.createElement(Skeleton, { animation: "wave", sx: { height: 20, width: 150 } })),
50
+ React.createElement(Typography, null,
51
+ React.createElement(Skeleton, { animation: "wave", sx: { height: 20, width: 100 } })))));
52
52
  }
53
53
  export default GroupHeaderSkeleton;
@@ -179,6 +179,7 @@ export default function GroupInviteButton(inProps) {
179
179
  .then(() => {
180
180
  setIsSending(false);
181
181
  setOpen(false);
182
+ setInvited([]);
182
183
  })
183
184
  .catch((error) => {
184
185
  setOpen(false);