@selfcommunity/react-ui 0.7.20-alpha.3 → 0.7.21-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/Composer/Composer.d.ts +6 -1
- package/lib/cjs/components/Composer/Composer.js +20 -4
- package/lib/cjs/components/Feed/Feed.d.ts +5 -0
- package/lib/cjs/components/Feed/Feed.js +4 -2
- package/lib/cjs/components/FeedObject/Actions/Share/Share.js +3 -3
- package/lib/cjs/components/IncubatorDetail/IncubatorDetail.js +3 -3
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.d.ts +6 -1
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +3 -2
- package/lib/cjs/components/PlatformWidget/PlatformWidget.d.ts +14 -0
- package/lib/cjs/components/PlatformWidget/PlatformWidget.js +6 -8
- package/lib/cjs/constants/SocialShare.d.ts +1 -1
- package/lib/cjs/constants/SocialShare.js +2 -2
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js +2 -2
- package/lib/esm/components/Composer/Composer.d.ts +6 -1
- package/lib/esm/components/Composer/Composer.js +21 -5
- package/lib/esm/components/Feed/Feed.d.ts +5 -0
- package/lib/esm/components/Feed/Feed.js +4 -2
- package/lib/esm/components/FeedObject/Actions/Share/Share.js +4 -4
- package/lib/esm/components/IncubatorDetail/IncubatorDetail.js +4 -4
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.d.ts +6 -1
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +3 -2
- package/lib/esm/components/PlatformWidget/PlatformWidget.d.ts +14 -0
- package/lib/esm/components/PlatformWidget/PlatformWidget.js +6 -8
- package/lib/esm/constants/SocialShare.d.ts +1 -1
- package/lib/esm/constants/SocialShare.js +1 -1
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +2 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SyntheticEvent } from 'react';
|
|
2
|
-
import { SCCategoryType, SCContributionType, SCFeedDiscussionType, SCFeedPostType, SCFeedStatusType, SCGroupType, SCMediaType, SCPollType, SCTagType } from '@selfcommunity/types';
|
|
2
|
+
import { SCCategoryType, SCContributionType, SCFeedDiscussionType, SCFeedPostType, SCFeedStatusType, SCFeedTypologyType, SCGroupType, SCMediaType, SCPollType, SCTagType } from '@selfcommunity/types';
|
|
3
3
|
import { DialogProps } from '@mui/material';
|
|
4
4
|
import { EditorProps } from '../Editor';
|
|
5
5
|
import { SCMediaObjectType } from '../../types/media';
|
|
@@ -54,6 +54,11 @@ export interface ComposerProps extends Omit<DialogProps, 'defaultValue' | 'scrol
|
|
|
54
54
|
* @default null
|
|
55
55
|
*/
|
|
56
56
|
onClose?: (event: SyntheticEvent) => void;
|
|
57
|
+
/**
|
|
58
|
+
* The feed where the component is rendered
|
|
59
|
+
* @default SCFeedTypologyType.HOME
|
|
60
|
+
*/
|
|
61
|
+
feedType?: SCFeedTypologyType;
|
|
57
62
|
}
|
|
58
63
|
/**
|
|
59
64
|
* > API documentation for the Community-JS Composer component. Learn about the available props and the CSS API.
|
|
@@ -73,6 +73,10 @@ const reducer = (state, action) => {
|
|
|
73
73
|
switch (action.type) {
|
|
74
74
|
case 'reset':
|
|
75
75
|
return Object.assign(Object.assign({}, COMPOSER_INITIAL_STATE), { key: (0, utils_1.random)() });
|
|
76
|
+
case 'resetGroupFeed':
|
|
77
|
+
return Object.assign(Object.assign({}, COMPOSER_INITIAL_STATE), { group: state.group, key: (0, utils_1.random)() });
|
|
78
|
+
case 'resetCategoryFeed':
|
|
79
|
+
return Object.assign(Object.assign({}, COMPOSER_INITIAL_STATE), { categories: state.categories, key: (0, utils_1.random)() });
|
|
76
80
|
case 'multiple':
|
|
77
81
|
return Object.assign(Object.assign({}, state), action.value);
|
|
78
82
|
default:
|
|
@@ -123,7 +127,7 @@ function Composer(inProps) {
|
|
|
123
127
|
props: inProps,
|
|
124
128
|
name: constants_1.PREFIX
|
|
125
129
|
});
|
|
126
|
-
const { feedObjectId = null, feedObjectType = null, feedObject = null, defaultValue = {}, mediaObjectTypes = [Media_2.File, Media_2.Link, Media_2.Share], EditorProps = {}, onClose = null, onSuccess = null, maxWidth } = props, rest = tslib_1.__rest(props, ["feedObjectId", "feedObjectType", "feedObject", "defaultValue", "mediaObjectTypes", "EditorProps", "onClose", "onSuccess", "maxWidth"]);
|
|
130
|
+
const { feedObjectId = null, feedObjectType = null, feedObject = null, defaultValue = {}, mediaObjectTypes = [Media_2.File, Media_2.Link, Media_2.Share], EditorProps = {}, onClose = null, onSuccess = null, maxWidth, feedType } = props, rest = tslib_1.__rest(props, ["feedObjectId", "feedObjectType", "feedObject", "defaultValue", "mediaObjectTypes", "EditorProps", "onClose", "onSuccess", "maxWidth", "feedType"]);
|
|
127
131
|
// Context
|
|
128
132
|
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
129
133
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
@@ -438,7 +442,11 @@ function Composer(inProps) {
|
|
|
438
442
|
if (unloadRef.current) {
|
|
439
443
|
window.onbeforeunload = null;
|
|
440
444
|
}
|
|
441
|
-
|
|
445
|
+
feedType && feedType === types_1.SCFeedTypologyType.CATEGORY
|
|
446
|
+
? dispatch({ type: 'resetCategoryFeed' })
|
|
447
|
+
: feedType === types_1.SCFeedTypologyType.GROUP
|
|
448
|
+
? dispatch({ type: 'resetGroupFeed' })
|
|
449
|
+
: dispatch({ type: 'reset' });
|
|
442
450
|
})
|
|
443
451
|
.catch((error) => {
|
|
444
452
|
dispatch({ type: 'multiple', value: (0, api_services_1.formatHttpErrorCode)(error) });
|
|
@@ -459,7 +467,11 @@ function Composer(inProps) {
|
|
|
459
467
|
onSave: () => {
|
|
460
468
|
onClose && onClose(event);
|
|
461
469
|
setLayer(null);
|
|
462
|
-
|
|
470
|
+
feedType && feedType === types_1.SCFeedTypologyType.CATEGORY
|
|
471
|
+
? dispatch({ type: 'resetCategoryFeed' })
|
|
472
|
+
: feedType === types_1.SCFeedTypologyType.GROUP
|
|
473
|
+
? dispatch({ type: 'resetGroupFeed' })
|
|
474
|
+
: dispatch({ type: 'reset' });
|
|
463
475
|
}
|
|
464
476
|
}
|
|
465
477
|
});
|
|
@@ -467,7 +479,11 @@ function Composer(inProps) {
|
|
|
467
479
|
else {
|
|
468
480
|
onClose && onClose(event);
|
|
469
481
|
setLayer(null);
|
|
470
|
-
|
|
482
|
+
feedType && feedType === types_1.SCFeedTypologyType.CATEGORY
|
|
483
|
+
? dispatch({ type: 'resetCategoryFeed' })
|
|
484
|
+
: feedType === types_1.SCFeedTypologyType.GROUP
|
|
485
|
+
? dispatch({ type: 'resetGroupFeed' })
|
|
486
|
+
: dispatch({ type: 'reset' });
|
|
471
487
|
}
|
|
472
488
|
}, [onClose, canSubmit, handleRemoveLayer]);
|
|
473
489
|
const handleClosePrompt = (0, react_1.useCallback)((event) => {
|
|
@@ -42,6 +42,11 @@ export interface FeedProps {
|
|
|
42
42
|
* @default `<FormattedMessage id="ui.feed.noOtherFeedObject" defaultMessage="ui.feed.noOtherFeedObject" />`
|
|
43
43
|
*/
|
|
44
44
|
endMessage?: ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Empty feed placeholder, rendered when no feed item can be displayed
|
|
47
|
+
* @default null
|
|
48
|
+
*/
|
|
49
|
+
emptyFeedPlaceholder?: ReactNode;
|
|
45
50
|
/**
|
|
46
51
|
* Refresh message, rendered when no more feed item can be displayed
|
|
47
52
|
* @default `<FormattedMessage id="ui.feed.refreshRelease" defaultMessage="ui.feed.refreshRelease" />`
|
|
@@ -77,7 +77,7 @@ const Feed = (inProps, ref) => {
|
|
|
77
77
|
props: inProps,
|
|
78
78
|
name: constants_1.PREFIX
|
|
79
79
|
});
|
|
80
|
-
const { id = 'feed', className, endpoint, endpointQueryParams = { limit: Pagination_1.DEFAULT_PAGINATION_LIMIT, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, endMessage = react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feed.noOtherFeedObject", defaultMessage: "ui.feed.noOtherFeedObject" }), refreshMessage = react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feed.refreshRelease", defaultMessage: "ui.feed.refreshRelease" }), HeaderComponent, FooterComponent = Footer_1.default, FooterComponentProps = {}, widgets = [], ItemComponent, itemPropsGenerator, itemIdGenerator, ItemProps = {}, ItemSkeleton, ItemSkeletonProps = {}, onNextData, onPreviousData, FeedSidebarProps = {}, CustomAdvProps = {}, enabledCustomAdvPositions = [types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR, types_1.SCCustomAdvPosition.POSITION_FEED], requireAuthentication = false, cacheStrategy = utils_1.CacheStrategies.NETWORK_ONLY, prefetchedData, scrollableTargetId, VirtualizedScrollerProps = {}, disablePaginationLinks = false, hidePaginationLinks = true, paginationLinksPageQueryParam = Pagination_1.DEFAULT_PAGINATION_QUERY_PARAM_NAME, PaginationLinkProps = {}, hideAdvs = false } = props;
|
|
80
|
+
const { id = 'feed', className, endpoint, endpointQueryParams = { limit: Pagination_1.DEFAULT_PAGINATION_LIMIT, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, endMessage = react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feed.noOtherFeedObject", defaultMessage: "ui.feed.noOtherFeedObject" }), refreshMessage = react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feed.refreshRelease", defaultMessage: "ui.feed.refreshRelease" }), HeaderComponent, FooterComponent = Footer_1.default, FooterComponentProps = {}, widgets = [], ItemComponent, itemPropsGenerator, itemIdGenerator, ItemProps = {}, ItemSkeleton, ItemSkeletonProps = {}, onNextData, onPreviousData, FeedSidebarProps = {}, CustomAdvProps = {}, enabledCustomAdvPositions = [types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR, types_1.SCCustomAdvPosition.POSITION_FEED], requireAuthentication = false, cacheStrategy = utils_1.CacheStrategies.NETWORK_ONLY, prefetchedData, scrollableTargetId, VirtualizedScrollerProps = {}, disablePaginationLinks = false, hidePaginationLinks = true, paginationLinksPageQueryParam = Pagination_1.DEFAULT_PAGINATION_QUERY_PARAM_NAME, PaginationLinkProps = {}, hideAdvs = false, emptyFeedPlaceholder } = props;
|
|
81
81
|
// CONTEXT
|
|
82
82
|
const scPreferences = (0, react_1.useContext)(react_core_1.SCPreferencesContext);
|
|
83
83
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
@@ -388,7 +388,8 @@ const Feed = (inProps, ref) => {
|
|
|
388
388
|
const previousOffset = parseInt((0, utils_1.getQueryStringParameter)(feedDataObject.previous, 'offset') || offset) + 1;
|
|
389
389
|
feedDataObject.updateState({
|
|
390
390
|
previous: (0, utils_1.updateQueryStringParameter)(feedDataObject.previous, 'offset', previousOffset),
|
|
391
|
-
next: (0, utils_1.updateQueryStringParameter)(feedDataObject.next, 'offset', nextOffset)
|
|
391
|
+
next: (0, utils_1.updateQueryStringParameter)(feedDataObject.next, 'offset', nextOffset),
|
|
392
|
+
count: feedDataObject.count + 1
|
|
392
393
|
});
|
|
393
394
|
}
|
|
394
395
|
},
|
|
@@ -421,6 +422,7 @@ const Feed = (inProps, ref) => {
|
|
|
421
422
|
FooterComponent ? react_1.default.createElement(FooterComponent, Object.assign({}, FooterComponentProps)) : null), refreshFunction: refresh, pullDownToRefresh: true, pullDownToRefreshThreshold: 1000, pullDownToRefreshContent: null, releaseToRefreshContent: react_1.default.createElement(Widget_1.default, { variant: "outlined", className: classes.refresh },
|
|
422
423
|
react_1.default.createElement(material_1.CardContent, null, refreshMessage)), style: { overflow: 'visible' } }, (scrollableTargetId && { scrollableTarget: scrollableTargetId })),
|
|
423
424
|
renderHeaderComponent(),
|
|
425
|
+
feedDataObject.count === 0 && emptyFeedPlaceholder && emptyFeedPlaceholder,
|
|
424
426
|
react_1.default.createElement(VirtualizedScroller_1.default, Object.assign({ className: classes.leftItems, items: feedDataLeft, itemComponent: InnerItem, onMount: onScrollerMount, onScrollerStateChange: onScrollerStateChange, getItemId: getScrollItemId, preserveScrollPosition: true, preserveScrollPositionOnPrependItems: true, cacheScrollStateKey: react_core_1.SCCache.getVirtualizedScrollStateCacheKey(id), cacheScrollerPositionKey: react_core_1.SCCache.getFeedSPCacheKey(id), cacheStrategy: cacheStrategy }, (scrollableTargetId && { getScrollableContainer: () => document.getElementById(scrollableTargetId) }), VirtualizedScrollerProps)))),
|
|
425
427
|
feedDataRight.length > 0 && !hideAdvs && (react_1.default.createElement(material_1.Hidden, { smDown: true },
|
|
426
428
|
react_1.default.createElement(material_1.Grid, { item: true, xs: 12, md: 5 },
|
|
@@ -62,7 +62,7 @@ function Share(props) {
|
|
|
62
62
|
const scPreferencesContext = (0, react_1.useContext)(react_core_1.SCPreferencesContext);
|
|
63
63
|
const facebookShareEnabled = react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED in scPreferencesContext.preferences &&
|
|
64
64
|
scPreferencesContext.preferences[react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED].value;
|
|
65
|
-
const
|
|
65
|
+
const xShareEnabled = react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_TWITTER_ENABLED in scPreferencesContext.preferences &&
|
|
66
66
|
scPreferencesContext.preferences[react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_TWITTER_ENABLED].value;
|
|
67
67
|
const linkedinShareEnabled = react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED in scPreferencesContext.preferences &&
|
|
68
68
|
scPreferencesContext.preferences[react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED].value;
|
|
@@ -201,10 +201,10 @@ function Share(props) {
|
|
|
201
201
|
react_1.default.createElement(ListItemIcon_1.default, null,
|
|
202
202
|
react_1.default.createElement(Icon_1.default, { fontSize: "small" }, "facebook")),
|
|
203
203
|
react_1.default.createElement(material_1.ListItemText, { primary: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.facebook", defaultMessage: "ui.feedObject.share.facebook" }) }))),
|
|
204
|
-
|
|
204
|
+
xShareEnabled && (react_1.default.createElement(MenuItem_1.default, { onClick: () => window.open(SocialShare_1.X_SHARE + url, 'x-share-dialog', 'width=626,height=436') },
|
|
205
205
|
react_1.default.createElement(ListItemIcon_1.default, null,
|
|
206
206
|
react_1.default.createElement(Icon_1.default, { fontSize: "small" }, "twitter")),
|
|
207
|
-
react_1.default.createElement(material_1.ListItemText, { primary: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.
|
|
207
|
+
react_1.default.createElement(material_1.ListItemText, { primary: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.x", defaultMessage: "ui.feedObject.share.x" }) }))),
|
|
208
208
|
linkedinShareEnabled && (react_1.default.createElement(MenuItem_1.default, { onClick: () => window.open(SocialShare_1.LINKEDIN_SHARE + url, 'linkedin-share-dialog', 'width=626,height=436') },
|
|
209
209
|
react_1.default.createElement(ListItemIcon_1.default, null,
|
|
210
210
|
react_1.default.createElement(Icon_1.default, { fontSize: "small" }, "linkedin")),
|
|
@@ -145,13 +145,13 @@ function IncubatorDetail(inProps) {
|
|
|
145
145
|
const scPreferencesContext = (0, react_1.useContext)(react_core_1.SCPreferencesContext);
|
|
146
146
|
const facebookShareEnabled = react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED in scPreferencesContext.preferences &&
|
|
147
147
|
scPreferencesContext.preferences[react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED].value;
|
|
148
|
-
const
|
|
148
|
+
const xShareEnabled = react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_TWITTER_ENABLED in scPreferencesContext.preferences &&
|
|
149
149
|
scPreferencesContext.preferences[react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_TWITTER_ENABLED].value;
|
|
150
150
|
const linkedinShareEnabled = react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED in scPreferencesContext.preferences &&
|
|
151
151
|
scPreferencesContext.preferences[react_core_1.SCPreferences.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED].value;
|
|
152
152
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
153
153
|
const portal = scContext.settings.portal + scRoutingContext.url(react_core_1.SCRoutes.INCUBATOR_ROUTE_NAME, scIncubator);
|
|
154
|
-
const isSocialShareEnabled = facebookShareEnabled ||
|
|
154
|
+
const isSocialShareEnabled = facebookShareEnabled || xShareEnabled || linkedinShareEnabled;
|
|
155
155
|
// INTL
|
|
156
156
|
const intl = (0, react_intl_1.useIntl)();
|
|
157
157
|
// HANDLERS
|
|
@@ -278,7 +278,7 @@ function IncubatorDetail(inProps) {
|
|
|
278
278
|
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.incubatorDetail.shareSection.invite", defaultMessage: "ui.incubatorDetail.shareSection.invite" }))),
|
|
279
279
|
react_1.default.createElement(material_1.Box, { className: classes.shareSection },
|
|
280
280
|
facebookShareEnabled && (react_1.default.createElement(Icon_1.default, { classes: { root: classes.shareMenuIcon }, fontSize: "small", onClick: () => window.open(SocialShare_1.FACEBOOK_SHARE + portal, 'facebook-share-dialog', 'width=626,height=436') }, "facebook")),
|
|
281
|
-
|
|
281
|
+
xShareEnabled && (react_1.default.createElement(Icon_1.default, { classes: { root: classes.shareMenuIcon }, fontSize: "small", onClick: () => window.open(SocialShare_1.X_SHARE + portal, 'x-share-dialog', 'width=626,height=436') }, "x")),
|
|
282
282
|
linkedinShareEnabled && (react_1.default.createElement(Icon_1.default, { classes: { root: classes.shareMenuIcon }, fontSize: "small", onClick: () => window.open(SocialShare_1.LINKEDIN_SHARE + portal, 'linkedin-share-dialog', 'width=626,height=436') }, "linkedin"))))))),
|
|
283
283
|
openAlert && react_1.default.createElement(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })));
|
|
284
284
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SCCategoryType, SCGroupType, SCMediaType, SCPollType, SCTagType } from '@selfcommunity/types';
|
|
1
|
+
import { SCCategoryType, SCFeedTypologyType, SCGroupType, SCMediaType, SCPollType, SCTagType } from '@selfcommunity/types';
|
|
2
2
|
import { SCMediaObjectType } from '../../types/media';
|
|
3
3
|
import { WidgetProps } from '../Widget';
|
|
4
4
|
export interface InlineComposerWidgetProps extends Omit<WidgetProps, 'defaultValue'> {
|
|
@@ -31,6 +31,11 @@ export interface InlineComposerWidgetProps extends Omit<WidgetProps, 'defaultVal
|
|
|
31
31
|
* The label showed inside the composer
|
|
32
32
|
*/
|
|
33
33
|
label?: any;
|
|
34
|
+
/**
|
|
35
|
+
* The feed where the component is rendered
|
|
36
|
+
* @default SCFeedTypologyType.HOME
|
|
37
|
+
*/
|
|
38
|
+
feedType?: SCFeedTypologyType;
|
|
34
39
|
}
|
|
35
40
|
/**
|
|
36
41
|
* > API documentation for the Community-JS Inline Composer component. Learn about the available props and the CSS API.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const types_1 = require("@selfcommunity/types");
|
|
5
6
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
6
7
|
const material_1 = require("@mui/material");
|
|
7
8
|
const styles_1 = require("@mui/material/styles");
|
|
@@ -55,7 +56,7 @@ function InlineComposerWidget(inProps) {
|
|
|
55
56
|
props: inProps,
|
|
56
57
|
name: constants_1.PREFIX
|
|
57
58
|
});
|
|
58
|
-
const { mediaObjectTypes = [Media_1.File, Media_1.Link], defaultValue, onSuccess = null, label } = props, rest = tslib_1.__rest(props, ["mediaObjectTypes", "defaultValue", "onSuccess", "label"]);
|
|
59
|
+
const { mediaObjectTypes = [Media_1.File, Media_1.Link], defaultValue, onSuccess = null, label, feedType = types_1.SCFeedTypologyType.HOME } = props, rest = tslib_1.__rest(props, ["mediaObjectTypes", "defaultValue", "onSuccess", "label", "feedType"]);
|
|
59
60
|
// Context
|
|
60
61
|
const scContext = (0, react_core_1.useSCContext)();
|
|
61
62
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
@@ -108,6 +109,6 @@ function InlineComposerWidget(inProps) {
|
|
|
108
109
|
react_1.default.createElement(material_1.Button, { variant: "text", disableFocusRipple: true, disableRipple: true, disableElevation: true, onClick: handleOpen, fullWidth: true, color: "inherit" }, label !== null && label !== void 0 ? label : react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.label", defaultMessage: "ui.inlineComposerWidget.label" }))),
|
|
109
110
|
react_1.default.createElement(material_1.Box, { className: classes.avatar }, !scUserContext.user ? (react_1.default.createElement(material_1.Avatar, { variant: "circular" })) : (react_1.default.createElement(react_core_1.Link, { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) },
|
|
110
111
|
react_1.default.createElement(material_1.Avatar, { alt: scUserContext.user.username, variant: "circular", src: scUserContext.user.avatar })))))),
|
|
111
|
-
react_1.default.createElement(Composer_1.default, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess })));
|
|
112
|
+
react_1.default.createElement(Composer_1.default, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess, feedType: feedType })));
|
|
112
113
|
}
|
|
113
114
|
exports.default = InlineComposerWidget;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { VirtualScrollerItemProps } from '../../types/virtualScroller';
|
|
2
3
|
export interface PlatformWidgetProps extends VirtualScrollerItemProps {
|
|
3
4
|
/**
|
|
@@ -10,6 +11,19 @@ export interface PlatformWidgetProps extends VirtualScrollerItemProps {
|
|
|
10
11
|
* @default null
|
|
11
12
|
*/
|
|
12
13
|
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Overrides or extends the styles applied to the component.
|
|
16
|
+
* @default null
|
|
17
|
+
*/
|
|
18
|
+
title?: React.ReactNode | null;
|
|
19
|
+
/**
|
|
20
|
+
* Actions to be inserted before
|
|
21
|
+
*/
|
|
22
|
+
startActions?: React.ReactNode | null;
|
|
23
|
+
/**
|
|
24
|
+
* Actions to be inserted after
|
|
25
|
+
*/
|
|
26
|
+
endActions?: React.ReactNode | null;
|
|
13
27
|
/**
|
|
14
28
|
* Other props
|
|
15
29
|
*/
|
|
@@ -56,7 +56,7 @@ function PlatformWidget(inProps) {
|
|
|
56
56
|
props: inProps,
|
|
57
57
|
name: constants_1.PREFIX
|
|
58
58
|
});
|
|
59
|
-
const { autoHide, className, onHeightChange, onStateChange } = props, rest = tslib_1.__rest(props, ["autoHide", "className", "onHeightChange", "onStateChange"]);
|
|
59
|
+
const { autoHide, className, title = null, startActions = null, endActions = null, onHeightChange, onStateChange } = props, rest = tslib_1.__rest(props, ["autoHide", "className", "title", "startActions", "endActions", "onHeightChange", "onStateChange"]);
|
|
60
60
|
// CONTEXT
|
|
61
61
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
62
62
|
const scLocaleContext = (0, react_core_1.useSCLocale)();
|
|
@@ -88,18 +88,16 @@ function PlatformWidget(inProps) {
|
|
|
88
88
|
* Renders platform card
|
|
89
89
|
*/
|
|
90
90
|
const c = (react_1.default.createElement(material_1.Grid, { container: true, spacing: isAdmin ? 1 : 3, justifyContent: "center" },
|
|
91
|
-
react_1.default.createElement(material_1.Grid, { item: true, xs: 12 },
|
|
92
|
-
react_1.default.createElement(
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
react_1.default.createElement(material_1.Grid, { item: true, xs: 12 }, title ? (title) : (react_1.default.createElement(material_1.Typography, { className: classes.title, component: "h3", align: "center" },
|
|
92
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.platformWidget.title", defaultMessage: "ui.platformWidget.title" }),
|
|
93
|
+
react_1.default.createElement(Icon_1.default, { fontSize: "small" }, "lock")))),
|
|
94
|
+
startActions,
|
|
95
95
|
isAdmin && (react_1.default.createElement(material_1.Grid, { item: true, xs: "auto" },
|
|
96
96
|
react_1.default.createElement(material_1.Button, { variant: "outlined", size: "small", onClick: () => fetchPlatform('') },
|
|
97
97
|
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.platformWidget.adm", defaultMessage: "ui.platformWidget.adm" })))),
|
|
98
98
|
react_1.default.createElement(material_1.Grid, { item: true, xs: "auto" },
|
|
99
99
|
react_1.default.createElement(material_1.Button, { variant: "outlined", size: "small", onClick: () => fetchPlatform('/moderation/flags/') }, isAdmin || isModerator ? (react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.platformWidget.mod", defaultMessage: "ui.platformWidget.mod" })) : (react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.platformWidget.edt", defaultMessage: "ui.platformWidget.edt" })))),
|
|
100
|
-
|
|
101
|
-
react_1.default.createElement(material_1.Button, { variant: "outlined", size: "small", href: `https://support.selfcommunity.com/hc/${language}`, target: "_blank" },
|
|
102
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.platformWidget.hc", defaultMessage: "ui.platformWidget.hc" })))));
|
|
100
|
+
endActions));
|
|
103
101
|
/**
|
|
104
102
|
* Renders root object (if not hidden by autoHide prop)
|
|
105
103
|
*/
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Social media urls for contribute share
|
|
3
3
|
*/
|
|
4
4
|
export declare const FACEBOOK_SHARE = "https://www.facebook.com/sharer.php?u=";
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const X_SHARE = "https://x.com/intent/tweet?url=";
|
|
6
6
|
export declare const LINKEDIN_SHARE = "https://www.linkedin.com/sharing/share-offsite/?url=";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Social media urls for contribute share
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LINKEDIN_SHARE = exports.
|
|
6
|
+
exports.LINKEDIN_SHARE = exports.X_SHARE = exports.FACEBOOK_SHARE = void 0;
|
|
7
7
|
exports.FACEBOOK_SHARE = 'https://www.facebook.com/sharer.php?u=';
|
|
8
|
-
exports.
|
|
8
|
+
exports.X_SHARE = 'https://x.com/intent/tweet?url=';
|
|
9
9
|
exports.LINKEDIN_SHARE = 'https://www.linkedin.com/sharing/share-offsite/?url=';
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -127,7 +127,7 @@ import UserSubscribedGroupsWidget, { UserSubscribedGroupsWidgetProps, UserSubscr
|
|
|
127
127
|
*/
|
|
128
128
|
import { DEFAULT_WIDGETS_NUMBER } from './constants/Feed';
|
|
129
129
|
import { DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET, DEFAULT_PAGINATION_QUERY_PARAM_NAME } from './constants/Pagination';
|
|
130
|
-
import { FACEBOOK_SHARE, LINKEDIN_SHARE,
|
|
130
|
+
import { FACEBOOK_SHARE, LINKEDIN_SHARE, X_SHARE } from './constants/SocialShare';
|
|
131
131
|
import { DEFAULT_PRELOAD_OFFSET_VIEWPORT, MAX_PRELOAD_OFFSET_VIEWPORT, MIN_PRELOAD_OFFSET_VIEWPORT } from './constants/LazyLoad';
|
|
132
132
|
import { LEGAL_POLICIES } from './constants/LegalPolicies';
|
|
133
133
|
import { DEFAULT_FIELDS } from './constants/UserProfile';
|
|
@@ -146,4 +146,4 @@ import FeedObjectMediaPreview, { FeedObjectMediaPreviewProps } from './component
|
|
|
146
146
|
/**
|
|
147
147
|
* List all exports
|
|
148
148
|
*/
|
|
149
|
-
export { AccountDataPortability, AccountDataPortabilityProps, AccountDataPortabilityButton, AccountDataPortabilityButtonProps, AccountDelete, AccountDeleteProps, AccountDeleteButton, AccountDeleteButtonProps, AccountRecover, AccountRecoverProps, AccountReset, AccountResetProps, AccountVerify, AccountVerifyProps, AccountChangeMailValidation, AccountChangeMailValidationProps, NavigationSettingsIconButton, NavigationSettingsIconButtonProps, NavigationSettingsItem, NavigationToolbarMobile, NavigationToolbarMobileProps, NavigationToolbarMobileSkeleton, NavigationToolbar, NavigationToolbarProps, NavigationToolbarSkeleton, NavigationMenuIconButton, NavigationMenuContent, NavigationMenuIconButtonProps, BottomNavigation, BottomNavigationProps, BroadcastMessages, BroadcastMessagesProps, BroadcastMessagesSkeleton, Category, CategoryProps, CategorySkeleton, CategoryAutocomplete, CategoryAutocompleteProps, CategoryFollowersButton, CategoryFollowersButtonProps, CategoryHeader, CategoryHeaderProps, CategoryHeaderSkeleton, Categories, CategoriesProps, CategoriesSkeleton, CategoriesSkeletonProps, UserFollowedCategoriesWidget, UserFollowedCategoriesWidgetProps, UserFollowedCategoriesWidgetSkeleton, CategoriesPopularWidget, CategoriesPopularWidgetSkeleton, CategoriesSuggestionWidget, CategoriesSuggestionWidgetProps, CategoriesSuggestionWidgetSkeleton, ChangeCover, ChangePicture, ChangePictureProps, ChangeCoverProps, Composer, ComposerProps, ComposerIconButton, ComposerIconButtonProps, Editor, EditorProps, EditorSkeleton, FriendshipUserButton, FriendshipButtonProps, Feed, FeedRef, FeedProps, FeedSidebarProps, FeedSkeleton, CategoryFollowButton, CategoryFollowButtonProps, FollowUserButton, FollowUserButtonProps, ConnectionUserButton, FeedObject, FeedObjectProps, FeedObjectSkeleton, FeedObjectMediaPreview, FeedObjectMediaPreviewProps, FeedUpdatesWidget, FeedUpdatesWidgetProps, FeedUpdatesWidgetSkeleton, GenericSkeleton, AvatarGroupSkeleton, CommentObject, CommentsObject, CommentsObjectProps, CommentObjectProps, CommentsObjectSkeleton, CommentObjectSkeleton, CommentObjectReply, CommentObjectReplyProps, CommentsFeedObject, CommentsFeedObjectProps, CommentsFeedObjectSkeleton, ReplyComment, InlineComposerWidget, InlineComposerWidgetProps, InlineComposerWidgetSkeleton, Notification, NotificationProps, NotificationSkeleton, UserSuggestionWidget, UserSuggestionWidgetProps, UserSuggestionWidgetSkeleton, PlatformWidget, PlatformWidgetProps, PlatformWidgetSkeleton, LocationAutocomplete, LocationAutocompleteProps, LoyaltyProgramWidget, LoyaltyProgramWidgetProps, LoyaltyProgramWidgetSkeleton, CategoryTrendingFeedWidget, CategoryTrendingFeedWidgetProps, CategoryTrendingFeedWidgetSkeleton, CategoryTrendingUsersWidget, CategoryTrendingUsersWidgetProps, CategoryTrendingPeopleWidgetSkeleton, RelatedFeedObjectsWidget, RelatedFeedObjectWidgetProps, RelatedFeedObjectsWidgetSkeleton, UserActionIconButton, UserActionIconButtonProps, UserCounters, UserCountersProps, UserProfileHeader, UserProfileHeaderProps, UserProfileHeaderSkeleton, UserInfoDialog, UserInfoDialogProps, UserInfo, UserInfoProps, UserInfoSkeleton, UserProfileBlocked, UserProfileBlockedProps, SCUserProfileFields, SCUserProfileSettings, UserProfileEdit, UserProfileEditProps, UserProfileEditSkeleton, UserProfileEditSectionPublicInfo, UserProfileEditSectionPublicInfoProps, UserProfileEditSectionSettings, UserProfileEditSectionSettingsProps, UserProfileEditSectionAccount, UserProfileEditSectionAccountProps, UserFollowedUsersWidget, UserFollowedUsersWidgetProps, UserFollowedUsersWidgetSkeleton, UserFollowersWidget, UserFollowersWidgetProps, UserFollowersWidgetSkeleton, UserConnectionsWidget, UserConnectionsWidgetProps, UserConnectionsWidgetSkeleton, UserConnectionsRequestsWidget, UserConnectionsRequestsWidgetProps, UserConnectionsRequestsWidgetSkeleton, UserConnectionsRequestsSentWidget, UserConnectionsRequestsSentWidgetProps, UserConnectionsRequestsSentWidgetSkeleton, UserSocialAssociation, UserSocialAssociationProps, SCUserSocialAssociations, VirtualScrollerItemProps, CustomAdv, CustomAdvProps, CustomAdvSkeleton, User, UserProps, UserSkeleton, PrivateMessageThread, PrivateMessageThreadProps, PrivateMessageThreadSkeleton, PrivateMessageThreadItem, PrivateMessageThreadItemProps, PrivateMessageThreadItemSkeleton, PrivateMessageSnippetItem, PrivateMessageSnippetItemProps, PrivateMessageSnippetItemSkeleton, PrivateMessageEditor, PrivateMessageEditorProps, PrivateMessageEditorSkeleton, PrivateMessageSnippets, PrivateMessageSnippetsProps, PrivateMessageSnippetsSkeleton, PrivateMessageComponent, PrivateMessageComponentProps, PrivateMessageComponentSkeleton, PrivateMessageSettingsIconButton, PrivateMessageSettingsIconButtonProps, ToastNotifications, ToastNotificationsProps, ToastNotificationsSkeleton, SnippetNotifications, SnippetNotificationsProps, SnippetNotificationsSkeleton, SearchAutocomplete, SearchAutocompleteProps, SearchDialog, SearchDialogProps, Widget, WidgetProps, SCFeedWidgetType, SCFeedObjectTemplateType, SCCommentsOrderBy, SCFeedObjectActivitiesType, SCMediaObjectType, SCMediaChunkType, SCNotificationObjectTemplateType, SCBroadcastMessageTemplateType, ChangeGroupCover, ChangeGroupCoverProps, ChangeGroupPicture, ChangeGroupPictureProps, GroupHeader, GroupHeaderProps, GroupHeaderSkeleton, GroupMembersButton, GroupMembersButtonProps, CreateGroupButton, CreateGroupButtonProps, EditGroupButton, EditGroupButtonProps, GroupInviteButton, GroupInviteButtonProps, GroupInfoWidget, GroupInfoWidgetProps, GroupInfoWidgetSkeleton, Group, GroupProps, GroupSkeleton, GroupSubscribeButton, GroupSubscribeButtonProps, GroupMembersWidget, GroupMembersWidgetProps, GroupMembersWidgetSkeleton, GroupRequestsWidget, GroupRequestsWidgetProps, GroupRequestsWidgetSkeleton, Groups, GroupsProps, GroupsSkeleton, GroupForm, GroupFormProps, GroupInvitedWidget, GroupInvitedWidgetProps, GroupInvitedWidgetSkeleton, UserSubscribedGroupsWidget, UserSubscribedGroupsWidgetProps, UserSubscribedGroupsWidgetSkeleton, HiddenPlaceholder, UrlTextField, UsernameTextField, EmailTextField, PasswordTextField, PhoneTextField, MetadataField, InfiniteScroll, StickyBox, useStickyBox, StickyBoxProps, StickyBoxComponent, UseStickyBoxProps, TagChip, TagChipProps, UserDeletedSnackBar, UserDeletedSnackBarProps, UserAvatar, UserAvatarProps, Lightbox, CentralProgress, ConfirmDialog, LanguageSwitcher, MediaChunkUploader, MediaChunkUploaderProps, File, Link, Share, EditMediaProps, MEDIA_TYPE_EMBED, FACEBOOK_SHARE,
|
|
149
|
+
export { AccountDataPortability, AccountDataPortabilityProps, AccountDataPortabilityButton, AccountDataPortabilityButtonProps, AccountDelete, AccountDeleteProps, AccountDeleteButton, AccountDeleteButtonProps, AccountRecover, AccountRecoverProps, AccountReset, AccountResetProps, AccountVerify, AccountVerifyProps, AccountChangeMailValidation, AccountChangeMailValidationProps, NavigationSettingsIconButton, NavigationSettingsIconButtonProps, NavigationSettingsItem, NavigationToolbarMobile, NavigationToolbarMobileProps, NavigationToolbarMobileSkeleton, NavigationToolbar, NavigationToolbarProps, NavigationToolbarSkeleton, NavigationMenuIconButton, NavigationMenuContent, NavigationMenuIconButtonProps, BottomNavigation, BottomNavigationProps, BroadcastMessages, BroadcastMessagesProps, BroadcastMessagesSkeleton, Category, CategoryProps, CategorySkeleton, CategoryAutocomplete, CategoryAutocompleteProps, CategoryFollowersButton, CategoryFollowersButtonProps, CategoryHeader, CategoryHeaderProps, CategoryHeaderSkeleton, Categories, CategoriesProps, CategoriesSkeleton, CategoriesSkeletonProps, UserFollowedCategoriesWidget, UserFollowedCategoriesWidgetProps, UserFollowedCategoriesWidgetSkeleton, CategoriesPopularWidget, CategoriesPopularWidgetSkeleton, CategoriesSuggestionWidget, CategoriesSuggestionWidgetProps, CategoriesSuggestionWidgetSkeleton, ChangeCover, ChangePicture, ChangePictureProps, ChangeCoverProps, Composer, ComposerProps, ComposerIconButton, ComposerIconButtonProps, Editor, EditorProps, EditorSkeleton, FriendshipUserButton, FriendshipButtonProps, Feed, FeedRef, FeedProps, FeedSidebarProps, FeedSkeleton, CategoryFollowButton, CategoryFollowButtonProps, FollowUserButton, FollowUserButtonProps, ConnectionUserButton, FeedObject, FeedObjectProps, FeedObjectSkeleton, FeedObjectMediaPreview, FeedObjectMediaPreviewProps, FeedUpdatesWidget, FeedUpdatesWidgetProps, FeedUpdatesWidgetSkeleton, GenericSkeleton, AvatarGroupSkeleton, CommentObject, CommentsObject, CommentsObjectProps, CommentObjectProps, CommentsObjectSkeleton, CommentObjectSkeleton, CommentObjectReply, CommentObjectReplyProps, CommentsFeedObject, CommentsFeedObjectProps, CommentsFeedObjectSkeleton, ReplyComment, InlineComposerWidget, InlineComposerWidgetProps, InlineComposerWidgetSkeleton, Notification, NotificationProps, NotificationSkeleton, UserSuggestionWidget, UserSuggestionWidgetProps, UserSuggestionWidgetSkeleton, PlatformWidget, PlatformWidgetProps, PlatformWidgetSkeleton, LocationAutocomplete, LocationAutocompleteProps, LoyaltyProgramWidget, LoyaltyProgramWidgetProps, LoyaltyProgramWidgetSkeleton, CategoryTrendingFeedWidget, CategoryTrendingFeedWidgetProps, CategoryTrendingFeedWidgetSkeleton, CategoryTrendingUsersWidget, CategoryTrendingUsersWidgetProps, CategoryTrendingPeopleWidgetSkeleton, RelatedFeedObjectsWidget, RelatedFeedObjectWidgetProps, RelatedFeedObjectsWidgetSkeleton, UserActionIconButton, UserActionIconButtonProps, UserCounters, UserCountersProps, UserProfileHeader, UserProfileHeaderProps, UserProfileHeaderSkeleton, UserInfoDialog, UserInfoDialogProps, UserInfo, UserInfoProps, UserInfoSkeleton, UserProfileBlocked, UserProfileBlockedProps, SCUserProfileFields, SCUserProfileSettings, UserProfileEdit, UserProfileEditProps, UserProfileEditSkeleton, UserProfileEditSectionPublicInfo, UserProfileEditSectionPublicInfoProps, UserProfileEditSectionSettings, UserProfileEditSectionSettingsProps, UserProfileEditSectionAccount, UserProfileEditSectionAccountProps, UserFollowedUsersWidget, UserFollowedUsersWidgetProps, UserFollowedUsersWidgetSkeleton, UserFollowersWidget, UserFollowersWidgetProps, UserFollowersWidgetSkeleton, UserConnectionsWidget, UserConnectionsWidgetProps, UserConnectionsWidgetSkeleton, UserConnectionsRequestsWidget, UserConnectionsRequestsWidgetProps, UserConnectionsRequestsWidgetSkeleton, UserConnectionsRequestsSentWidget, UserConnectionsRequestsSentWidgetProps, UserConnectionsRequestsSentWidgetSkeleton, UserSocialAssociation, UserSocialAssociationProps, SCUserSocialAssociations, VirtualScrollerItemProps, CustomAdv, CustomAdvProps, CustomAdvSkeleton, User, UserProps, UserSkeleton, PrivateMessageThread, PrivateMessageThreadProps, PrivateMessageThreadSkeleton, PrivateMessageThreadItem, PrivateMessageThreadItemProps, PrivateMessageThreadItemSkeleton, PrivateMessageSnippetItem, PrivateMessageSnippetItemProps, PrivateMessageSnippetItemSkeleton, PrivateMessageEditor, PrivateMessageEditorProps, PrivateMessageEditorSkeleton, PrivateMessageSnippets, PrivateMessageSnippetsProps, PrivateMessageSnippetsSkeleton, PrivateMessageComponent, PrivateMessageComponentProps, PrivateMessageComponentSkeleton, PrivateMessageSettingsIconButton, PrivateMessageSettingsIconButtonProps, ToastNotifications, ToastNotificationsProps, ToastNotificationsSkeleton, SnippetNotifications, SnippetNotificationsProps, SnippetNotificationsSkeleton, SearchAutocomplete, SearchAutocompleteProps, SearchDialog, SearchDialogProps, Widget, WidgetProps, SCFeedWidgetType, SCFeedObjectTemplateType, SCCommentsOrderBy, SCFeedObjectActivitiesType, SCMediaObjectType, SCMediaChunkType, SCNotificationObjectTemplateType, SCBroadcastMessageTemplateType, ChangeGroupCover, ChangeGroupCoverProps, ChangeGroupPicture, ChangeGroupPictureProps, GroupHeader, GroupHeaderProps, GroupHeaderSkeleton, GroupMembersButton, GroupMembersButtonProps, CreateGroupButton, CreateGroupButtonProps, EditGroupButton, EditGroupButtonProps, GroupInviteButton, GroupInviteButtonProps, GroupInfoWidget, GroupInfoWidgetProps, GroupInfoWidgetSkeleton, Group, GroupProps, GroupSkeleton, GroupSubscribeButton, GroupSubscribeButtonProps, GroupMembersWidget, GroupMembersWidgetProps, GroupMembersWidgetSkeleton, GroupRequestsWidget, GroupRequestsWidgetProps, GroupRequestsWidgetSkeleton, Groups, GroupsProps, GroupsSkeleton, GroupForm, GroupFormProps, GroupInvitedWidget, GroupInvitedWidgetProps, GroupInvitedWidgetSkeleton, UserSubscribedGroupsWidget, UserSubscribedGroupsWidgetProps, UserSubscribedGroupsWidgetSkeleton, HiddenPlaceholder, UrlTextField, UsernameTextField, EmailTextField, PasswordTextField, PhoneTextField, MetadataField, InfiniteScroll, StickyBox, useStickyBox, StickyBoxProps, StickyBoxComponent, UseStickyBoxProps, TagChip, TagChipProps, UserDeletedSnackBar, UserDeletedSnackBarProps, UserAvatar, UserAvatarProps, Lightbox, CentralProgress, ConfirmDialog, LanguageSwitcher, MediaChunkUploader, MediaChunkUploaderProps, File, Link, Share, EditMediaProps, MEDIA_TYPE_EMBED, FACEBOOK_SHARE, X_SHARE, LINKEDIN_SHARE, DEFAULT_PRELOAD_OFFSET_VIEWPORT, MIN_PRELOAD_OFFSET_VIEWPORT, MAX_PRELOAD_OFFSET_VIEWPORT, ConsentSolution, ConsentSolutionProps, ConsentSolutionSkeleton, ConsentSolutionButton, ConsentSolutionButtonProps, LEGAL_POLICIES, DEFAULT_FIELDS, DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PAGINATION_OFFSET, DEFAULT_PAGINATION_LIMIT, DEFAULT_WIDGETS_NUMBER, PollSuggestionWidget, PollSuggestionWidgetProps, Incubator, IncubatorSubscribeButton, IncubatorSubscribeButtonProps, IncubatorProps, IncubatorListWidget, IncubatorListWidgetProps, IncubatorDetail, IncubatorDetailProps, IncubatorSuggestionWidget, IncubatorSuggestionWidgetProps, ContributionUtils, bytesToSize, getUnseenNotification, getUnseenNotificationCounter, MessageUploaderUtils, getRelativeTime, Footer, FooterProps, FooterSkeleton, BaseItem, BaseItemProps, BaseDialog, BaseDialogProps, GroupSettingsIconButton, GroupSettingsIconButtonProps };
|
package/lib/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GenericSkeleton = exports.FeedUpdatesWidgetSkeleton = exports.FeedUpdatesWidget = exports.FeedObjectMediaPreview = exports.FeedObjectSkeleton = exports.FeedObject = exports.ConnectionUserButton = exports.FollowUserButton = exports.CategoryFollowButton = exports.FeedSkeleton = exports.Feed = exports.FriendshipUserButton = exports.EditorSkeleton = exports.Editor = exports.ComposerIconButton = exports.Composer = exports.ChangePicture = exports.ChangeCover = exports.CategoriesSuggestionWidgetSkeleton = exports.CategoriesSuggestionWidget = exports.CategoriesPopularWidgetSkeleton = exports.CategoriesPopularWidget = exports.UserFollowedCategoriesWidgetSkeleton = exports.UserFollowedCategoriesWidget = exports.CategoriesSkeleton = exports.Categories = exports.CategoryHeaderSkeleton = exports.CategoryHeader = exports.CategoryFollowersButton = exports.CategoryAutocomplete = exports.CategorySkeleton = exports.Category = exports.BroadcastMessagesSkeleton = exports.BroadcastMessages = exports.BottomNavigation = exports.NavigationMenuContent = exports.NavigationMenuIconButton = exports.NavigationToolbarSkeleton = exports.NavigationToolbar = exports.NavigationToolbarMobileSkeleton = exports.NavigationToolbarMobile = exports.NavigationSettingsIconButton = exports.AccountChangeMailValidation = exports.AccountVerify = exports.AccountReset = exports.AccountRecover = exports.AccountDeleteButton = exports.AccountDelete = exports.AccountDataPortabilityButton = exports.AccountDataPortability = void 0;
|
|
4
4
|
exports.UserConnectionsRequestsSentWidget = exports.UserConnectionsRequestsWidgetSkeleton = exports.UserConnectionsRequestsWidget = exports.UserConnectionsWidgetSkeleton = exports.UserConnectionsWidget = exports.UserFollowersWidgetSkeleton = exports.UserFollowersWidget = exports.UserFollowedUsersWidgetSkeleton = exports.UserFollowedUsersWidget = exports.UserProfileEditSectionAccount = exports.UserProfileEditSectionSettings = exports.UserProfileEditSectionPublicInfo = exports.UserProfileEditSkeleton = exports.UserProfileEdit = exports.SCUserProfileSettings = exports.SCUserProfileFields = exports.UserProfileBlocked = exports.UserInfoSkeleton = exports.UserInfo = exports.UserInfoDialog = exports.UserProfileHeaderSkeleton = exports.UserProfileHeader = exports.UserCounters = exports.UserActionIconButton = exports.RelatedFeedObjectsWidgetSkeleton = exports.RelatedFeedObjectsWidget = exports.CategoryTrendingPeopleWidgetSkeleton = exports.CategoryTrendingUsersWidget = exports.CategoryTrendingFeedWidgetSkeleton = exports.CategoryTrendingFeedWidget = exports.LoyaltyProgramWidgetSkeleton = exports.LoyaltyProgramWidget = exports.LocationAutocomplete = exports.PlatformWidgetSkeleton = exports.PlatformWidget = exports.UserSuggestionWidgetSkeleton = exports.UserSuggestionWidget = exports.NotificationSkeleton = exports.Notification = exports.InlineComposerWidgetSkeleton = exports.InlineComposerWidget = exports.ReplyComment = exports.CommentsFeedObjectSkeleton = exports.CommentsFeedObject = exports.CommentObjectReply = exports.CommentObjectSkeleton = exports.CommentsObjectSkeleton = exports.CommentsObject = exports.CommentObject = exports.AvatarGroupSkeleton = void 0;
|
|
5
5
|
exports.Groups = exports.GroupRequestsWidgetSkeleton = exports.GroupRequestsWidget = exports.GroupMembersWidgetSkeleton = exports.GroupMembersWidget = exports.GroupSubscribeButton = exports.GroupSkeleton = exports.Group = exports.GroupInfoWidgetSkeleton = exports.GroupInfoWidget = exports.GroupInviteButton = exports.EditGroupButton = exports.CreateGroupButton = exports.GroupMembersButton = exports.GroupHeaderSkeleton = exports.GroupHeader = exports.ChangeGroupPicture = exports.ChangeGroupCover = exports.SCBroadcastMessageTemplateType = exports.SCNotificationObjectTemplateType = exports.SCFeedObjectActivitiesType = exports.SCCommentsOrderBy = exports.SCFeedObjectTemplateType = exports.Widget = exports.SearchDialog = exports.SearchAutocomplete = exports.SnippetNotificationsSkeleton = exports.SnippetNotifications = exports.ToastNotificationsSkeleton = exports.ToastNotifications = exports.PrivateMessageSettingsIconButton = exports.PrivateMessageComponentSkeleton = exports.PrivateMessageComponent = exports.PrivateMessageSnippetsSkeleton = exports.PrivateMessageSnippets = exports.PrivateMessageEditorSkeleton = exports.PrivateMessageEditor = exports.PrivateMessageSnippetItemSkeleton = exports.PrivateMessageSnippetItem = exports.PrivateMessageThreadItemSkeleton = exports.PrivateMessageThreadItem = exports.PrivateMessageThreadSkeleton = exports.PrivateMessageThread = exports.UserSkeleton = exports.User = exports.CustomAdvSkeleton = exports.CustomAdv = exports.SCUserSocialAssociations = exports.UserSocialAssociation = exports.UserConnectionsRequestsSentWidgetSkeleton = void 0;
|
|
6
|
-
exports.ContributionUtils = exports.IncubatorSuggestionWidget = exports.IncubatorDetail = exports.IncubatorListWidget = exports.IncubatorSubscribeButton = exports.Incubator = exports.PollSuggestionWidget = exports.DEFAULT_WIDGETS_NUMBER = exports.DEFAULT_PAGINATION_LIMIT = exports.DEFAULT_PAGINATION_OFFSET = exports.DEFAULT_PAGINATION_QUERY_PARAM_NAME = exports.DEFAULT_FIELDS = exports.LEGAL_POLICIES = exports.ConsentSolutionButton = exports.ConsentSolutionSkeleton = exports.ConsentSolution = exports.MAX_PRELOAD_OFFSET_VIEWPORT = exports.MIN_PRELOAD_OFFSET_VIEWPORT = exports.DEFAULT_PRELOAD_OFFSET_VIEWPORT = exports.LINKEDIN_SHARE = exports.
|
|
6
|
+
exports.ContributionUtils = exports.IncubatorSuggestionWidget = exports.IncubatorDetail = exports.IncubatorListWidget = exports.IncubatorSubscribeButton = exports.Incubator = exports.PollSuggestionWidget = exports.DEFAULT_WIDGETS_NUMBER = exports.DEFAULT_PAGINATION_LIMIT = exports.DEFAULT_PAGINATION_OFFSET = exports.DEFAULT_PAGINATION_QUERY_PARAM_NAME = exports.DEFAULT_FIELDS = exports.LEGAL_POLICIES = exports.ConsentSolutionButton = exports.ConsentSolutionSkeleton = exports.ConsentSolution = exports.MAX_PRELOAD_OFFSET_VIEWPORT = exports.MIN_PRELOAD_OFFSET_VIEWPORT = exports.DEFAULT_PRELOAD_OFFSET_VIEWPORT = exports.LINKEDIN_SHARE = exports.X_SHARE = exports.FACEBOOK_SHARE = exports.MEDIA_TYPE_EMBED = exports.Share = exports.Link = exports.File = exports.MediaChunkUploader = exports.LanguageSwitcher = exports.ConfirmDialog = exports.CentralProgress = exports.Lightbox = exports.UserAvatar = exports.UserDeletedSnackBar = exports.TagChip = exports.useStickyBox = exports.StickyBox = exports.InfiniteScroll = exports.MetadataField = exports.PhoneTextField = exports.PasswordTextField = exports.EmailTextField = exports.UsernameTextField = exports.UrlTextField = exports.HiddenPlaceholder = exports.UserSubscribedGroupsWidgetSkeleton = exports.UserSubscribedGroupsWidget = exports.GroupInvitedWidgetSkeleton = exports.GroupInvitedWidget = exports.GroupForm = exports.GroupsSkeleton = void 0;
|
|
7
7
|
exports.GroupSettingsIconButton = exports.BaseDialog = exports.BaseItem = exports.FooterSkeleton = exports.Footer = exports.getRelativeTime = exports.MessageUploaderUtils = exports.getUnseenNotificationCounter = exports.getUnseenNotification = exports.bytesToSize = void 0;
|
|
8
8
|
const tslib_1 = require("tslib");
|
|
9
9
|
/**
|
|
@@ -330,7 +330,7 @@ Object.defineProperty(exports, "DEFAULT_PAGINATION_QUERY_PARAM_NAME", { enumerab
|
|
|
330
330
|
const SocialShare_1 = require("./constants/SocialShare");
|
|
331
331
|
Object.defineProperty(exports, "FACEBOOK_SHARE", { enumerable: true, get: function () { return SocialShare_1.FACEBOOK_SHARE; } });
|
|
332
332
|
Object.defineProperty(exports, "LINKEDIN_SHARE", { enumerable: true, get: function () { return SocialShare_1.LINKEDIN_SHARE; } });
|
|
333
|
-
Object.defineProperty(exports, "
|
|
333
|
+
Object.defineProperty(exports, "X_SHARE", { enumerable: true, get: function () { return SocialShare_1.X_SHARE; } });
|
|
334
334
|
const LazyLoad_1 = require("./constants/LazyLoad");
|
|
335
335
|
Object.defineProperty(exports, "DEFAULT_PRELOAD_OFFSET_VIEWPORT", { enumerable: true, get: function () { return LazyLoad_1.DEFAULT_PRELOAD_OFFSET_VIEWPORT; } });
|
|
336
336
|
Object.defineProperty(exports, "MAX_PRELOAD_OFFSET_VIEWPORT", { enumerable: true, get: function () { return LazyLoad_1.MAX_PRELOAD_OFFSET_VIEWPORT; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SyntheticEvent } from 'react';
|
|
2
|
-
import { SCCategoryType, SCContributionType, SCFeedDiscussionType, SCFeedPostType, SCFeedStatusType, SCGroupType, SCMediaType, SCPollType, SCTagType } from '@selfcommunity/types';
|
|
2
|
+
import { SCCategoryType, SCContributionType, SCFeedDiscussionType, SCFeedPostType, SCFeedStatusType, SCFeedTypologyType, SCGroupType, SCMediaType, SCPollType, SCTagType } from '@selfcommunity/types';
|
|
3
3
|
import { DialogProps } from '@mui/material';
|
|
4
4
|
import { EditorProps } from '../Editor';
|
|
5
5
|
import { SCMediaObjectType } from '../../types/media';
|
|
@@ -54,6 +54,11 @@ export interface ComposerProps extends Omit<DialogProps, 'defaultValue' | 'scrol
|
|
|
54
54
|
* @default null
|
|
55
55
|
*/
|
|
56
56
|
onClose?: (event: SyntheticEvent) => void;
|
|
57
|
+
/**
|
|
58
|
+
* The feed where the component is rendered
|
|
59
|
+
* @default SCFeedTypologyType.HOME
|
|
60
|
+
*/
|
|
61
|
+
feedType?: SCFeedTypologyType;
|
|
57
62
|
}
|
|
58
63
|
/**
|
|
59
64
|
* > API documentation for the Community-JS Composer component. Learn about the available props and the CSS API.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { forwardRef, useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'react';
|
|
3
|
-
import { SCContributionType, SCFeatureName } from '@selfcommunity/types';
|
|
3
|
+
import { SCContributionType, SCFeatureName, SCFeedTypologyType } from '@selfcommunity/types';
|
|
4
4
|
import { Endpoints, formatHttpErrorCode, http } from '@selfcommunity/api-services';
|
|
5
5
|
import { SCPreferences, UserUtils, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
6
6
|
import { FormattedMessage } from 'react-intl';
|
|
@@ -71,6 +71,10 @@ const reducer = (state, action) => {
|
|
|
71
71
|
switch (action.type) {
|
|
72
72
|
case 'reset':
|
|
73
73
|
return Object.assign(Object.assign({}, COMPOSER_INITIAL_STATE), { key: random() });
|
|
74
|
+
case 'resetGroupFeed':
|
|
75
|
+
return Object.assign(Object.assign({}, COMPOSER_INITIAL_STATE), { group: state.group, key: random() });
|
|
76
|
+
case 'resetCategoryFeed':
|
|
77
|
+
return Object.assign(Object.assign({}, COMPOSER_INITIAL_STATE), { categories: state.categories, key: random() });
|
|
74
78
|
case 'multiple':
|
|
75
79
|
return Object.assign(Object.assign({}, state), action.value);
|
|
76
80
|
default:
|
|
@@ -121,7 +125,7 @@ export default function Composer(inProps) {
|
|
|
121
125
|
props: inProps,
|
|
122
126
|
name: PREFIX
|
|
123
127
|
});
|
|
124
|
-
const { feedObjectId = null, feedObjectType = null, feedObject = null, defaultValue = {}, mediaObjectTypes = [File, Link, Share], EditorProps = {}, onClose = null, onSuccess = null, maxWidth } = props, rest = __rest(props, ["feedObjectId", "feedObjectType", "feedObject", "defaultValue", "mediaObjectTypes", "EditorProps", "onClose", "onSuccess", "maxWidth"]);
|
|
128
|
+
const { feedObjectId = null, feedObjectType = null, feedObject = null, defaultValue = {}, mediaObjectTypes = [File, Link, Share], EditorProps = {}, onClose = null, onSuccess = null, maxWidth, feedType } = props, rest = __rest(props, ["feedObjectId", "feedObjectType", "feedObject", "defaultValue", "mediaObjectTypes", "EditorProps", "onClose", "onSuccess", "maxWidth", "feedType"]);
|
|
125
129
|
// Context
|
|
126
130
|
const { preferences, features } = useSCPreferences();
|
|
127
131
|
const scUserContext = useSCUser();
|
|
@@ -436,7 +440,11 @@ export default function Composer(inProps) {
|
|
|
436
440
|
if (unloadRef.current) {
|
|
437
441
|
window.onbeforeunload = null;
|
|
438
442
|
}
|
|
439
|
-
|
|
443
|
+
feedType && feedType === SCFeedTypologyType.CATEGORY
|
|
444
|
+
? dispatch({ type: 'resetCategoryFeed' })
|
|
445
|
+
: feedType === SCFeedTypologyType.GROUP
|
|
446
|
+
? dispatch({ type: 'resetGroupFeed' })
|
|
447
|
+
: dispatch({ type: 'reset' });
|
|
440
448
|
})
|
|
441
449
|
.catch((error) => {
|
|
442
450
|
dispatch({ type: 'multiple', value: formatHttpErrorCode(error) });
|
|
@@ -457,7 +465,11 @@ export default function Composer(inProps) {
|
|
|
457
465
|
onSave: () => {
|
|
458
466
|
onClose && onClose(event);
|
|
459
467
|
setLayer(null);
|
|
460
|
-
|
|
468
|
+
feedType && feedType === SCFeedTypologyType.CATEGORY
|
|
469
|
+
? dispatch({ type: 'resetCategoryFeed' })
|
|
470
|
+
: feedType === SCFeedTypologyType.GROUP
|
|
471
|
+
? dispatch({ type: 'resetGroupFeed' })
|
|
472
|
+
: dispatch({ type: 'reset' });
|
|
461
473
|
}
|
|
462
474
|
}
|
|
463
475
|
});
|
|
@@ -465,7 +477,11 @@ export default function Composer(inProps) {
|
|
|
465
477
|
else {
|
|
466
478
|
onClose && onClose(event);
|
|
467
479
|
setLayer(null);
|
|
468
|
-
|
|
480
|
+
feedType && feedType === SCFeedTypologyType.CATEGORY
|
|
481
|
+
? dispatch({ type: 'resetCategoryFeed' })
|
|
482
|
+
: feedType === SCFeedTypologyType.GROUP
|
|
483
|
+
? dispatch({ type: 'resetGroupFeed' })
|
|
484
|
+
: dispatch({ type: 'reset' });
|
|
469
485
|
}
|
|
470
486
|
}, [onClose, canSubmit, handleRemoveLayer]);
|
|
471
487
|
const handleClosePrompt = useCallback((event) => {
|
|
@@ -42,6 +42,11 @@ export interface FeedProps {
|
|
|
42
42
|
* @default `<FormattedMessage id="ui.feed.noOtherFeedObject" defaultMessage="ui.feed.noOtherFeedObject" />`
|
|
43
43
|
*/
|
|
44
44
|
endMessage?: ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Empty feed placeholder, rendered when no feed item can be displayed
|
|
47
|
+
* @default null
|
|
48
|
+
*/
|
|
49
|
+
emptyFeedPlaceholder?: ReactNode;
|
|
45
50
|
/**
|
|
46
51
|
* Refresh message, rendered when no more feed item can be displayed
|
|
47
52
|
* @default `<FormattedMessage id="ui.feed.refreshRelease" defaultMessage="ui.feed.refreshRelease" />`
|
|
@@ -74,7 +74,7 @@ const Feed = (inProps, ref) => {
|
|
|
74
74
|
props: inProps,
|
|
75
75
|
name: PREFIX
|
|
76
76
|
});
|
|
77
|
-
const { id = 'feed', className, endpoint, endpointQueryParams = { limit: DEFAULT_PAGINATION_LIMIT, offset: DEFAULT_PAGINATION_OFFSET }, endMessage = React.createElement(FormattedMessage, { id: "ui.feed.noOtherFeedObject", defaultMessage: "ui.feed.noOtherFeedObject" }), refreshMessage = React.createElement(FormattedMessage, { id: "ui.feed.refreshRelease", defaultMessage: "ui.feed.refreshRelease" }), HeaderComponent, FooterComponent = Footer, FooterComponentProps = {}, widgets = [], ItemComponent, itemPropsGenerator, itemIdGenerator, ItemProps = {}, ItemSkeleton, ItemSkeletonProps = {}, onNextData, onPreviousData, FeedSidebarProps = {}, CustomAdvProps = {}, enabledCustomAdvPositions = [SCCustomAdvPosition.POSITION_FEED_SIDEBAR, SCCustomAdvPosition.POSITION_FEED], requireAuthentication = false, cacheStrategy = CacheStrategies.NETWORK_ONLY, prefetchedData, scrollableTargetId, VirtualizedScrollerProps = {}, disablePaginationLinks = false, hidePaginationLinks = true, paginationLinksPageQueryParam = DEFAULT_PAGINATION_QUERY_PARAM_NAME, PaginationLinkProps = {}, hideAdvs = false } = props;
|
|
77
|
+
const { id = 'feed', className, endpoint, endpointQueryParams = { limit: DEFAULT_PAGINATION_LIMIT, offset: DEFAULT_PAGINATION_OFFSET }, endMessage = React.createElement(FormattedMessage, { id: "ui.feed.noOtherFeedObject", defaultMessage: "ui.feed.noOtherFeedObject" }), refreshMessage = React.createElement(FormattedMessage, { id: "ui.feed.refreshRelease", defaultMessage: "ui.feed.refreshRelease" }), HeaderComponent, FooterComponent = Footer, FooterComponentProps = {}, widgets = [], ItemComponent, itemPropsGenerator, itemIdGenerator, ItemProps = {}, ItemSkeleton, ItemSkeletonProps = {}, onNextData, onPreviousData, FeedSidebarProps = {}, CustomAdvProps = {}, enabledCustomAdvPositions = [SCCustomAdvPosition.POSITION_FEED_SIDEBAR, SCCustomAdvPosition.POSITION_FEED], requireAuthentication = false, cacheStrategy = CacheStrategies.NETWORK_ONLY, prefetchedData, scrollableTargetId, VirtualizedScrollerProps = {}, disablePaginationLinks = false, hidePaginationLinks = true, paginationLinksPageQueryParam = DEFAULT_PAGINATION_QUERY_PARAM_NAME, PaginationLinkProps = {}, hideAdvs = false, emptyFeedPlaceholder } = props;
|
|
78
78
|
// CONTEXT
|
|
79
79
|
const scPreferences = useContext(SCPreferencesContext);
|
|
80
80
|
const scUserContext = useContext(SCUserContext);
|
|
@@ -385,7 +385,8 @@ const Feed = (inProps, ref) => {
|
|
|
385
385
|
const previousOffset = parseInt(getQueryStringParameter(feedDataObject.previous, 'offset') || offset) + 1;
|
|
386
386
|
feedDataObject.updateState({
|
|
387
387
|
previous: updateQueryStringParameter(feedDataObject.previous, 'offset', previousOffset),
|
|
388
|
-
next: updateQueryStringParameter(feedDataObject.next, 'offset', nextOffset)
|
|
388
|
+
next: updateQueryStringParameter(feedDataObject.next, 'offset', nextOffset),
|
|
389
|
+
count: feedDataObject.count + 1
|
|
389
390
|
});
|
|
390
391
|
}
|
|
391
392
|
},
|
|
@@ -418,6 +419,7 @@ const Feed = (inProps, ref) => {
|
|
|
418
419
|
FooterComponent ? React.createElement(FooterComponent, Object.assign({}, FooterComponentProps)) : null), refreshFunction: refresh, pullDownToRefresh: true, pullDownToRefreshThreshold: 1000, pullDownToRefreshContent: null, releaseToRefreshContent: React.createElement(Widget, { variant: "outlined", className: classes.refresh },
|
|
419
420
|
React.createElement(CardContent, null, refreshMessage)), style: { overflow: 'visible' } }, (scrollableTargetId && { scrollableTarget: scrollableTargetId })),
|
|
420
421
|
renderHeaderComponent(),
|
|
422
|
+
feedDataObject.count === 0 && emptyFeedPlaceholder && emptyFeedPlaceholder,
|
|
421
423
|
React.createElement(VirtualizedScroller, Object.assign({ className: classes.leftItems, items: feedDataLeft, itemComponent: InnerItem, onMount: onScrollerMount, onScrollerStateChange: onScrollerStateChange, getItemId: getScrollItemId, preserveScrollPosition: true, preserveScrollPositionOnPrependItems: true, cacheScrollStateKey: SCCache.getVirtualizedScrollStateCacheKey(id), cacheScrollerPositionKey: SCCache.getFeedSPCacheKey(id), cacheStrategy: cacheStrategy }, (scrollableTargetId && { getScrollableContainer: () => document.getElementById(scrollableTargetId) }), VirtualizedScrollerProps)))),
|
|
422
424
|
feedDataRight.length > 0 && !hideAdvs && (React.createElement(Hidden, { smDown: true },
|
|
423
425
|
React.createElement(Grid, { item: true, xs: 12, md: 5 },
|
|
@@ -18,7 +18,7 @@ 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';
|
|
20
20
|
import { getContributionRouteName, getRouteData } from '../../../../utils/contribution';
|
|
21
|
-
import { FACEBOOK_SHARE, LINKEDIN_SHARE,
|
|
21
|
+
import { FACEBOOK_SHARE, LINKEDIN_SHARE, X_SHARE } from '../../../../constants/SocialShare';
|
|
22
22
|
import Composer from '../../../Composer';
|
|
23
23
|
import { PREFIX } from '../../constants';
|
|
24
24
|
const messages = defineMessages({
|
|
@@ -60,7 +60,7 @@ export default function Share(props) {
|
|
|
60
60
|
const scPreferencesContext = useContext(SCPreferencesContext);
|
|
61
61
|
const facebookShareEnabled = SCPreferences.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED in scPreferencesContext.preferences &&
|
|
62
62
|
scPreferencesContext.preferences[SCPreferences.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED].value;
|
|
63
|
-
const
|
|
63
|
+
const xShareEnabled = SCPreferences.ADDONS_SHARE_POST_ON_TWITTER_ENABLED in scPreferencesContext.preferences &&
|
|
64
64
|
scPreferencesContext.preferences[SCPreferences.ADDONS_SHARE_POST_ON_TWITTER_ENABLED].value;
|
|
65
65
|
const linkedinShareEnabled = SCPreferences.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED in scPreferencesContext.preferences &&
|
|
66
66
|
scPreferencesContext.preferences[SCPreferences.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED].value;
|
|
@@ -199,10 +199,10 @@ export default function Share(props) {
|
|
|
199
199
|
React.createElement(ListItemIcon, null,
|
|
200
200
|
React.createElement(Icon, { fontSize: "small" }, "facebook")),
|
|
201
201
|
React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.facebook", defaultMessage: "ui.feedObject.share.facebook" }) }))),
|
|
202
|
-
|
|
202
|
+
xShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(X_SHARE + url, 'x-share-dialog', 'width=626,height=436') },
|
|
203
203
|
React.createElement(ListItemIcon, null,
|
|
204
204
|
React.createElement(Icon, { fontSize: "small" }, "twitter")),
|
|
205
|
-
React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.
|
|
205
|
+
React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.x", defaultMessage: "ui.feedObject.share.x" }) }))),
|
|
206
206
|
linkedinShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(LINKEDIN_SHARE + url, 'linkedin-share-dialog', 'width=626,height=436') },
|
|
207
207
|
React.createElement(ListItemIcon, null,
|
|
208
208
|
React.createElement(Icon, { fontSize: "small" }, "linkedin")),
|
|
@@ -17,7 +17,7 @@ import InfiniteScroll from '../../shared/InfiniteScroll';
|
|
|
17
17
|
import User from '../User';
|
|
18
18
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
19
19
|
import Icon from '@mui/material/Icon';
|
|
20
|
-
import { FACEBOOK_SHARE,
|
|
20
|
+
import { FACEBOOK_SHARE, X_SHARE, LINKEDIN_SHARE } from '../../constants/SocialShare';
|
|
21
21
|
import UserDeletedSnackBar from '../../shared/UserDeletedSnackBar';
|
|
22
22
|
const messages = defineMessages({
|
|
23
23
|
intro: {
|
|
@@ -143,13 +143,13 @@ export default function IncubatorDetail(inProps) {
|
|
|
143
143
|
const scPreferencesContext = useContext(SCPreferencesContext);
|
|
144
144
|
const facebookShareEnabled = SCPreferences.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED in scPreferencesContext.preferences &&
|
|
145
145
|
scPreferencesContext.preferences[SCPreferences.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED].value;
|
|
146
|
-
const
|
|
146
|
+
const xShareEnabled = SCPreferences.ADDONS_SHARE_POST_ON_TWITTER_ENABLED in scPreferencesContext.preferences &&
|
|
147
147
|
scPreferencesContext.preferences[SCPreferences.ADDONS_SHARE_POST_ON_TWITTER_ENABLED].value;
|
|
148
148
|
const linkedinShareEnabled = SCPreferences.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED in scPreferencesContext.preferences &&
|
|
149
149
|
scPreferencesContext.preferences[SCPreferences.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED].value;
|
|
150
150
|
const scRoutingContext = useSCRouting();
|
|
151
151
|
const portal = scContext.settings.portal + scRoutingContext.url(SCRoutes.INCUBATOR_ROUTE_NAME, scIncubator);
|
|
152
|
-
const isSocialShareEnabled = facebookShareEnabled ||
|
|
152
|
+
const isSocialShareEnabled = facebookShareEnabled || xShareEnabled || linkedinShareEnabled;
|
|
153
153
|
// INTL
|
|
154
154
|
const intl = useIntl();
|
|
155
155
|
// HANDLERS
|
|
@@ -276,7 +276,7 @@ export default function IncubatorDetail(inProps) {
|
|
|
276
276
|
React.createElement(FormattedMessage, { id: "ui.incubatorDetail.shareSection.invite", defaultMessage: "ui.incubatorDetail.shareSection.invite" }))),
|
|
277
277
|
React.createElement(Box, { className: classes.shareSection },
|
|
278
278
|
facebookShareEnabled && (React.createElement(Icon, { classes: { root: classes.shareMenuIcon }, fontSize: "small", onClick: () => window.open(FACEBOOK_SHARE + portal, 'facebook-share-dialog', 'width=626,height=436') }, "facebook")),
|
|
279
|
-
|
|
279
|
+
xShareEnabled && (React.createElement(Icon, { classes: { root: classes.shareMenuIcon }, fontSize: "small", onClick: () => window.open(X_SHARE + portal, 'x-share-dialog', 'width=626,height=436') }, "x")),
|
|
280
280
|
linkedinShareEnabled && (React.createElement(Icon, { classes: { root: classes.shareMenuIcon }, fontSize: "small", onClick: () => window.open(LINKEDIN_SHARE + portal, 'linkedin-share-dialog', 'width=626,height=436') }, "linkedin"))))))),
|
|
281
281
|
openAlert && React.createElement(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })));
|
|
282
282
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SCCategoryType, SCGroupType, SCMediaType, SCPollType, SCTagType } from '@selfcommunity/types';
|
|
1
|
+
import { SCCategoryType, SCFeedTypologyType, SCGroupType, SCMediaType, SCPollType, SCTagType } from '@selfcommunity/types';
|
|
2
2
|
import { SCMediaObjectType } from '../../types/media';
|
|
3
3
|
import { WidgetProps } from '../Widget';
|
|
4
4
|
export interface InlineComposerWidgetProps extends Omit<WidgetProps, 'defaultValue'> {
|
|
@@ -31,6 +31,11 @@ export interface InlineComposerWidgetProps extends Omit<WidgetProps, 'defaultVal
|
|
|
31
31
|
* The label showed inside the composer
|
|
32
32
|
*/
|
|
33
33
|
label?: any;
|
|
34
|
+
/**
|
|
35
|
+
* The feed where the component is rendered
|
|
36
|
+
* @default SCFeedTypologyType.HOME
|
|
37
|
+
*/
|
|
38
|
+
feedType?: SCFeedTypologyType;
|
|
34
39
|
}
|
|
35
40
|
/**
|
|
36
41
|
* > API documentation for the Community-JS Inline Composer component. Learn about the available props and the CSS API.
|