@selfcommunity/react-templates 0.5.0-alpha.9 → 0.5.0-mui7.14
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/CategoryFeed/CategoryFeed.js +18 -11
- package/lib/cjs/components/Course/Course.d.ts +1 -1
- package/lib/cjs/components/EventFeed/EventFeed.js +8 -11
- package/lib/cjs/components/ExploreFeed/ExploreFeed.js +18 -6
- package/lib/cjs/components/FeedObjectDetail/FeedObjectDetail.js +1 -1
- package/lib/cjs/components/FeedObjectDetail/Skeleton.js +1 -1
- package/lib/cjs/components/GroupFeed/GroupFeed.js +10 -13
- package/lib/cjs/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +2 -2
- package/lib/cjs/components/LoyaltyProgramDetail/PointsList.js +2 -2
- package/lib/cjs/components/LoyaltyProgramDetail/Skeleton.js +1 -1
- package/lib/cjs/components/MainFeed/MainFeed.js +17 -5
- package/lib/cjs/components/UserFeed/UserFeed.js +3 -3
- package/lib/cjs/components/UserProfile/UserProfile.js +1 -1
- package/lib/esm/components/CategoryFeed/CategoryFeed.js +21 -14
- package/lib/esm/components/Course/Course.d.ts +1 -1
- package/lib/esm/components/EventFeed/EventFeed.js +8 -11
- package/lib/esm/components/ExploreFeed/ExploreFeed.js +20 -8
- package/lib/esm/components/FeedObjectDetail/FeedObjectDetail.js +2 -2
- package/lib/esm/components/FeedObjectDetail/Skeleton.js +1 -1
- package/lib/esm/components/GroupFeed/GroupFeed.js +10 -13
- package/lib/esm/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +2 -2
- package/lib/esm/components/LoyaltyProgramDetail/PointsList.js +2 -2
- package/lib/esm/components/LoyaltyProgramDetail/Skeleton.js +1 -1
- package/lib/esm/components/MainFeed/MainFeed.js +19 -7
- package/lib/esm/components/UserFeed/UserFeed.js +3 -3
- package/lib/esm/components/UserProfile/UserProfile.js +1 -1
- package/lib/umd/212.js +2 -0
- package/lib/umd/{589.js.LICENSE.txt → 212.js.LICENSE.txt} +1 -14
- package/lib/umd/3ffb7beb33b58142e791.js +2 -0
- package/lib/umd/739.js +2 -0
- package/lib/umd/react-templates.js +1 -1
- package/lib/umd/react-templates.js.LICENSE.txt +1 -1
- package/package.json +131 -131
- package/lib/umd/589.js +0 -2
- package/lib/umd/738.js +0 -2
- package/lib/umd/73cbb3dbfaa3ddd4df47.js +0 -2
- /package/lib/umd/{738.js.LICENSE.txt → 3ffb7beb33b58142e791.js.LICENSE.txt} +0 -0
- /package/lib/umd/{73cbb3dbfaa3ddd4df47.js.LICENSE.txt → 739.js.LICENSE.txt} +0 -0
|
@@ -74,24 +74,31 @@ function CategoryFeed(inProps) {
|
|
|
74
74
|
// CONTEXT
|
|
75
75
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
76
76
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
77
|
-
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
78
77
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
79
78
|
// REF
|
|
80
|
-
const feedRef = (0, react_1.useRef)();
|
|
79
|
+
const feedRef = (0, react_1.useRef)(null);
|
|
81
80
|
// Hooks
|
|
82
81
|
const { scCategory } = (0, react_core_1.useSCFetchCategory)({ id: categoryId, category });
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
const isAdvertisingCustomAdvEnabled = (0, react_core_1.useSCPreferenceEnabled)(react_core_1.SCPreferences.ADVERTISING_CUSTOM_ADV_ENABLED);
|
|
83
|
+
const isAdvertisingCustomAdvOnlyForAnonUsersEnabled = (0, react_core_1.useSCPreferenceEnabled)(react_core_1.SCPreferences.ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED);
|
|
84
|
+
const isPaymentsEnabled = (0, react_core_1.useSCPreferencesAndFeaturesEnabled)([react_core_1.SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED], [types_1.SCFeatureName.PAYMENTS]);
|
|
85
|
+
/**
|
|
86
|
+
* Render advertising above the feed
|
|
87
|
+
*/
|
|
88
|
+
function renderAdvertising() {
|
|
89
|
+
if (isAdvertisingCustomAdvEnabled &&
|
|
90
|
+
((isAdvertisingCustomAdvOnlyForAnonUsersEnabled && scUserContext.user === null) || !isAdvertisingCustomAdvOnlyForAnonUsersEnabled)) {
|
|
91
|
+
return (0, jsx_runtime_1.jsx)(react_ui_1.CustomAdv, { position: types_1.SCCustomAdvPosition.POSITION_ABOVE_FEED_CATEGORY, categoriesId: [scCategory.id] });
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
88
95
|
// HANDLERS
|
|
89
96
|
const handleComposerSuccess = (feedObject) => {
|
|
90
97
|
// Not insert if the category does not match
|
|
91
98
|
if (feedObject.categories.findIndex((c) => c.id === scCategory.id) === -1) {
|
|
92
99
|
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
93
100
|
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
94
|
-
action: (
|
|
101
|
+
action: () => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], react_ui_1.ContributionUtils.getRouteData(feedObject)) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }) }))),
|
|
95
102
|
variant: 'success',
|
|
96
103
|
autoHideDuration: 7000
|
|
97
104
|
});
|
|
@@ -101,7 +108,7 @@ function CategoryFeed(inProps) {
|
|
|
101
108
|
const feedUnit = {
|
|
102
109
|
type: feedObject.type,
|
|
103
110
|
[feedObject.type]: feedObject,
|
|
104
|
-
|
|
111
|
+
seen: false,
|
|
105
112
|
has_boost: false
|
|
106
113
|
};
|
|
107
114
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -123,10 +130,10 @@ function CategoryFeed(inProps) {
|
|
|
123
130
|
feedObject: item[item.type],
|
|
124
131
|
feedObjectType: item.type,
|
|
125
132
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
126
|
-
markRead: scUser ? !item.
|
|
133
|
+
markRead: scUser ? !item.seen : null
|
|
127
134
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
128
135
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
129
|
-
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.
|
|
136
|
+
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [((scCategory.content_only_staff && react_core_1.UserUtils.isStaff(scUserContext.user)) || !scCategory.content_only_staff) && ((0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: types_1.SCFeedTypologyType.CATEGORY })), renderAdvertising()] }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
|
|
130
137
|
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
131
138
|
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
132
139
|
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -92,7 +92,7 @@ function EventFeed(inProps) {
|
|
|
92
92
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
93
93
|
const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
94
94
|
// REF
|
|
95
|
-
const feedRef = (0, react_1.useRef)();
|
|
95
|
+
const feedRef = (0, react_1.useRef)(null);
|
|
96
96
|
// CONST
|
|
97
97
|
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
98
98
|
(0, react_1.useEffect)(() => {
|
|
@@ -119,7 +119,7 @@ function EventFeed(inProps) {
|
|
|
119
119
|
const feedUnit = {
|
|
120
120
|
type: feedObject.type,
|
|
121
121
|
[feedObject.type]: feedObject,
|
|
122
|
-
|
|
122
|
+
seen: false,
|
|
123
123
|
has_boost: false
|
|
124
124
|
};
|
|
125
125
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -146,15 +146,12 @@ function EventFeed(inProps) {
|
|
|
146
146
|
status !== types_1.SCEventSubscriptionStatusType.NOT_GOING))) {
|
|
147
147
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(react_ui_1.EventInfoWidget, { className: classes.root, event: scEvent }) })));
|
|
148
148
|
}
|
|
149
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.GetEventFeed), { url: () => api_services_1.Endpoints.GetEventFeed.url({ id: scEvent.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
markRead: scUser ? !((_a = item === null || item === void 0 ? void 0 : item.seen_by_id) === null || _a === void 0 ? void 0 : _a.includes(scUser.id)) : null
|
|
156
|
-
});
|
|
157
|
-
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
149
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.GetEventFeed), { url: () => api_services_1.Endpoints.GetEventFeed.url({ id: scEvent.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
150
|
+
feedObject: item[item.type],
|
|
151
|
+
feedObjectType: item.type,
|
|
152
|
+
feedObjectActivities: item.activities ? item.activities : null,
|
|
153
|
+
markRead: scUser ? !(item === null || item === void 0 ? void 0 : item.seen) : null
|
|
154
|
+
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
158
155
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
159
156
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.EventInfoWidget, { className: classes.root, event: scEvent }), Boolean(scEvent &&
|
|
160
157
|
((!scUserContext.user && scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC) ||
|
|
@@ -84,10 +84,22 @@ function ExploreFeed(inProps) {
|
|
|
84
84
|
});
|
|
85
85
|
const { id = 'explore_feed', className, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
86
86
|
// CONTEXT
|
|
87
|
-
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
88
87
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
88
|
+
const isAdvertisingCustomAdvEnabled = (0, react_core_1.useSCPreferenceEnabled)(react_core_1.SCPreferences.ADVERTISING_CUSTOM_ADV_ENABLED);
|
|
89
|
+
const isAdvertisingCustomAdvOnlyForAnonUsersEnabled = (0, react_core_1.useSCPreferenceEnabled)(react_core_1.SCPreferences.ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED);
|
|
90
|
+
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
89
91
|
// REF
|
|
90
|
-
const feedRef = (0, react_1.useRef)();
|
|
92
|
+
const feedRef = (0, react_1.useRef)(null);
|
|
93
|
+
/**
|
|
94
|
+
* Render advertising above the feed
|
|
95
|
+
*/
|
|
96
|
+
function renderAdvertising() {
|
|
97
|
+
if (isAdvertisingCustomAdvEnabled &&
|
|
98
|
+
((isAdvertisingCustomAdvOnlyForAnonUsersEnabled && scUserContext.user === null) || !isAdvertisingCustomAdvOnlyForAnonUsersEnabled)) {
|
|
99
|
+
return (0, jsx_runtime_1.jsx)(react_ui_1.CustomAdv, { position: types_1.SCCustomAdvPosition.POSITION_ABOVE_FEED });
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
91
103
|
// HANDLERS
|
|
92
104
|
const handleComposerSuccess = (feedObject) => {
|
|
93
105
|
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
|
|
@@ -99,7 +111,7 @@ function ExploreFeed(inProps) {
|
|
|
99
111
|
const feedUnit = {
|
|
100
112
|
type: feedObject.type,
|
|
101
113
|
[feedObject.type]: feedObject,
|
|
102
|
-
|
|
114
|
+
seen: false,
|
|
103
115
|
has_boost: false
|
|
104
116
|
};
|
|
105
117
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -112,7 +124,7 @@ function ExploreFeed(inProps) {
|
|
|
112
124
|
const feedUnit = {
|
|
113
125
|
type: feedObject.type,
|
|
114
126
|
[feedObject.type]: feedObject,
|
|
115
|
-
|
|
127
|
+
seen: false,
|
|
116
128
|
has_boost: false
|
|
117
129
|
};
|
|
118
130
|
feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -128,10 +140,10 @@ function ExploreFeed(inProps) {
|
|
|
128
140
|
feedObject: item[item.type],
|
|
129
141
|
feedObjectType: item.type,
|
|
130
142
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
131
|
-
markRead: scUser ? !item.
|
|
143
|
+
markRead: scUser ? !item.seen : null
|
|
132
144
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
133
145
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
134
|
-
}, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), react_core_1.UserUtils.isAdmin(scUserContext.user) && (0, jsx_runtime_1.jsx)(react_ui_1.OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
|
|
146
|
+
}, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), react_core_1.UserUtils.isAdmin(scUserContext.user) && (0, jsx_runtime_1.jsx)(react_ui_1.OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent }), renderAdvertising()] }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
|
|
135
147
|
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
136
148
|
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
137
149
|
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -98,6 +98,6 @@ function FeedObjectDetail(inProps) {
|
|
|
98
98
|
if (!obj) {
|
|
99
99
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
100
100
|
}
|
|
101
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ container: true, spacing: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({
|
|
101
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ container: true, width: "100%", spacing: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ size: { md: 7 } }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.FeedObject, Object.assign({}, FeedObjectProps, { feedObject: obj, template: react_ui_1.SCFeedObjectTemplateType.DETAIL, onReply: handleReply })), renderAdvertising(), commentsEnabled && ((0, jsx_runtime_1.jsx)(react_ui_1.CommentsFeedObject, Object.assign({ showTitle: true, feedObject: obj, comments: comments }, CommentsFeedObjectProps), `comments_${obj.id}`))] })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ size: { md: 5 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: { sx: 'none', md: 'block' } } }, { children: (0, jsx_runtime_1.jsx)(react_ui_1.StickyBox, Object.assign({}, FeedSidebarProps, { children: (0, jsx_runtime_1.jsx)(react_ui_1.RelatedFeedObjectsWidget, Object.assign({ feedObject: obj, feedObjectId: obj.id }, RelatedFeedObjectProps), `related_${obj.id}`) })) })) }))] })) })));
|
|
102
102
|
}
|
|
103
103
|
exports.default = FeedObjectDetail;
|
|
@@ -33,6 +33,6 @@ const Root = (0, material_1.styled)(material_1.Box, {
|
|
|
33
33
|
*/
|
|
34
34
|
function FeedObjectDetailSkeleton(props) {
|
|
35
35
|
const { FeedObjectSkeletonProps = {}, CommentsFeedObjectSkeletonProps = {}, RelatedFeedObjectsSkeletonProps = {} } = props;
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ container: true, spacing: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ container: true, width: "100%", spacing: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ size: { md: 7 } }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.FeedObjectSkeleton, Object.assign({ template: react_ui_1.SCFeedObjectTemplateType.DETAIL }, FeedObjectSkeletonProps)), (0, jsx_runtime_1.jsx)(react_ui_1.CommentsFeedObjectSkeleton, Object.assign({ count: 4 }, CommentsFeedObjectSkeletonProps))] })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ size: { md: 5 } }, { children: (0, jsx_runtime_1.jsx)(react_ui_1.RelatedFeedObjectsWidgetSkeleton, Object.assign({}, RelatedFeedObjectsSkeletonProps)) }))] })) })));
|
|
37
37
|
}
|
|
38
38
|
exports.default = FeedObjectDetailSkeleton;
|
|
@@ -76,9 +76,9 @@ function GroupFeed(inProps) {
|
|
|
76
76
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
77
77
|
const scGroupsManager = scUserContext.managers.groups;
|
|
78
78
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
79
|
-
const { scGroup
|
|
79
|
+
const { scGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
|
|
80
80
|
// REF
|
|
81
|
-
const feedRef = (0, react_1.useRef)();
|
|
81
|
+
const feedRef = (0, react_1.useRef)(null);
|
|
82
82
|
// CONST
|
|
83
83
|
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
84
84
|
(0, react_1.useEffect)(() => {
|
|
@@ -95,7 +95,7 @@ function GroupFeed(inProps) {
|
|
|
95
95
|
var _a;
|
|
96
96
|
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
97
97
|
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
98
|
-
action: (
|
|
98
|
+
action: () => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], react_ui_1.ContributionUtils.getRouteData(feedObject)) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }) }))),
|
|
99
99
|
variant: 'success',
|
|
100
100
|
autoHideDuration: 7000
|
|
101
101
|
});
|
|
@@ -104,7 +104,7 @@ function GroupFeed(inProps) {
|
|
|
104
104
|
const feedUnit = {
|
|
105
105
|
type: feedObject.type,
|
|
106
106
|
[feedObject.type]: feedObject,
|
|
107
|
-
|
|
107
|
+
seen: false,
|
|
108
108
|
has_boost: false
|
|
109
109
|
};
|
|
110
110
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -123,15 +123,12 @@ function GroupFeed(inProps) {
|
|
|
123
123
|
else if (scGroup && status !== types_1.SCGroupSubscriptionStatusType.SUBSCRIBED) {
|
|
124
124
|
return (0, jsx_runtime_1.jsx)(react_ui_1.GroupInfoWidget, { className: classes.root, groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id });
|
|
125
125
|
}
|
|
126
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.GetGroupFeed), { url: () => api_services_1.Endpoints.GetGroupFeed.url({ id: scGroup.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
markRead: scUser ? !((_a = item === null || item === void 0 ? void 0 : item.seen_by_id) === null || _a === void 0 ? void 0 : _a.includes(scUser.id)) : null
|
|
133
|
-
});
|
|
134
|
-
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
126
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.GetGroupFeed), { url: () => api_services_1.Endpoints.GetGroupFeed.url({ id: scGroup.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
127
|
+
feedObject: item[item.type],
|
|
128
|
+
feedObjectType: item.type,
|
|
129
|
+
feedObjectActivities: item.activities ? item.activities : null,
|
|
130
|
+
markRead: scUser ? !(item === null || item === void 0 ? void 0 : item.seen) : null
|
|
131
|
+
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
135
132
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
136
133
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: scGroup &&
|
|
137
134
|
scGroup.subscription_status === types_1.SCGroupSubscriptionStatusType.SUBSCRIBED && ((0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { group: scGroup }, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.groupFeed.composer.label", defaultMessage: "templates.groupFeed.composer.label" }), feedType: types_1.SCFeedTypologyType.GROUP })), CustomAdvProps: { position: types_1.SCCustomAdvPosition.POSITION_FEED, groupsId: [scGroup.id] }, enabledCustomAdvPositions: [
|
|
@@ -117,7 +117,7 @@ function LoyaltyProgramDetail(inProps) {
|
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
})
|
|
120
|
-
.catch((
|
|
120
|
+
.catch(() => {
|
|
121
121
|
setOpen(false);
|
|
122
122
|
let _snackBar = enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.prize.request.error", defaultMessage: "templates.loyaltyProgramDetail.prize.request.error" }), {
|
|
123
123
|
variant: 'error',
|
|
@@ -184,6 +184,6 @@ function LoyaltyProgramDetail(inProps) {
|
|
|
184
184
|
if (loading) {
|
|
185
185
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
186
186
|
}
|
|
187
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [points !== 0 && ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.title, variant: "h5" }, { children: [!isMobile && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.loyaltyProgramWidget.title", defaultMessage: "ui.loyaltyProgramWidget.title" }), (0, jsx_runtime_1.jsx)(material_1.Chip, { className: classes.userPoints, component: "span", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.userPoints", defaultMessage: "templates.loyaltyProgramDetail.userPoints", values: { total: points } }) })] }))), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.community", defaultMessage: "templates.loyaltyProgramDetail.community" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionInfo }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.description", defaultMessage: "templates.loyaltyProgramDetail.description" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.listTitle", defaultMessage: "templates.loyaltyProgramDetail.listTitle" }) })), (0, jsx_runtime_1.jsx)(PointsList_1.default, { className: classes.pointsSection }), prizes.length !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.prizes", defaultMessage: "templates.loyaltyProgramDetail.prizes" }) }))), (0, jsx_runtime_1.jsx)(react_ui_1.InfiniteScroll, Object.assign({ dataLength: prizes.length, next: handleNext, hasMoreNext: Boolean(next), loaderNext: (0, jsx_runtime_1.jsx)(PrizeItemSkeleton_1.default, {}), endMessage: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: prizes.length !== 0 ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.endMessage }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.content.end.message", defaultMessage: "templates.loyaltyProgramDetail.content.end.message" }), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: 'secondary', onClick: handleScrollUp }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.content.end.button", defaultMessage: "templates.loyaltyProgramDetail.content.end.button" }) }))] }))) : null }) }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, spacing: !isMobile ? 3 : 0, direction: isMobile ? 'column' : 'row', className: classes.prizeSection }, { children: prizes.map((prize) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({
|
|
187
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [points !== 0 && ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.title, variant: "h5" }, { children: [!isMobile && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.loyaltyProgramWidget.title", defaultMessage: "ui.loyaltyProgramWidget.title" }), (0, jsx_runtime_1.jsx)(material_1.Chip, { className: classes.userPoints, component: "span", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.userPoints", defaultMessage: "templates.loyaltyProgramDetail.userPoints", values: { total: points } }) })] }))), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.community", defaultMessage: "templates.loyaltyProgramDetail.community" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionInfo }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.description", defaultMessage: "templates.loyaltyProgramDetail.description" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.listTitle", defaultMessage: "templates.loyaltyProgramDetail.listTitle" }) })), (0, jsx_runtime_1.jsx)(PointsList_1.default, { className: classes.pointsSection }), prizes.length !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.prizes", defaultMessage: "templates.loyaltyProgramDetail.prizes" }) }))), (0, jsx_runtime_1.jsx)(react_ui_1.InfiniteScroll, Object.assign({ dataLength: prizes.length, next: handleNext, hasMoreNext: Boolean(next), loaderNext: (0, jsx_runtime_1.jsx)(PrizeItemSkeleton_1.default, {}), endMessage: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: prizes.length !== 0 ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.endMessage }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.content.end.message", defaultMessage: "templates.loyaltyProgramDetail.content.end.message" }), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: 'secondary', onClick: handleScrollUp }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.content.end.button", defaultMessage: "templates.loyaltyProgramDetail.content.end.button" }) }))] }))) : null }) }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, width: "100%", spacing: !isMobile ? 3 : 0, direction: isMobile ? 'column' : 'row', className: classes.prizeSection }, { children: prizes.map((prize) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ size: { md: 6, lg: 4, xl: 3 } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Card, Object.assign({ className: classes.card }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: prize.image }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.prizePoints }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { className: points <= prize.points ? classes.notRequestable : null, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.prize.points", defaultMessage: "templates.loyaltyProgramDetail.prize.points", values: { total: prize.points } }) }) })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.cardTitle }, { children: prize.title })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", className: classes.cardContent }, { children: prize.description }))] }), (0, jsx_runtime_1.jsxs)(material_1.CardActions, { children: [prize.link && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "medium", color: "secondary", href: prize.link, target: "_blank", className: classes.actionButton }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.button.more", defaultMessage: "templates.loyaltyProgramDetail.button.more" }) }))), ((!prize.link && prize.active && points >= prize.points) || (prize.active && points >= prize.points)) && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", className: classes.actionButton, disabled: points < prize.points, onClick: () => handleOpenAlert(prize.id) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.button.request", defaultMessage: "templates.loyaltyProgramDetail.button.request" }) })))] })] })) }), prize.id))) })) })), open && ((0, jsx_runtime_1.jsx)(react_ui_1.ConfirmDialog, { open: open, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.dialog.msg", defaultMessage: "templates.loyaltyProgramDetail.dialog.msg" }), btnConfirm: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.dialog.confirm", defaultMessage: "templates.loyaltyProgramDetail.dialog.confirm" }), onConfirm: () => requestPrize(prizeRequested), onClose: () => setOpen(false) }))] })));
|
|
188
188
|
}
|
|
189
189
|
exports.default = LoyaltyProgramDetail;
|
|
@@ -25,7 +25,7 @@ const classes = {
|
|
|
25
25
|
};
|
|
26
26
|
function PointElement({ message, points }) {
|
|
27
27
|
if (points > 0) {
|
|
28
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Grid, Object.assign({ size: { md: 6 } }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "div", className: classes.element }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: message }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { children: ["+", (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points", defaultMessage: "templates.loyaltyProgramDetail.points", values: { total: points } })] })] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.PointElement = PointElement;
|
|
@@ -51,6 +51,6 @@ function PointsList(props) {
|
|
|
51
51
|
/**
|
|
52
52
|
* Renders the component (if not hidden by autoHide prop)
|
|
53
53
|
*/
|
|
54
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), container: true, spacing: 2 }, rest, { children: [preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED].value && ((0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.post", defaultMessage: "templates.loyaltyProgramDetail.points.post" }), points: _preferences[react_core_1.SCPreferences.POINTS_MAKE_POST] })), preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED].value && ((0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.discussion", defaultMessage: "templates.loyaltyProgramDetail.points.discussion" }), points: _preferences[react_core_1.SCPreferences.POINTS_MAKE_DISCUSSION] })), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.comment", defaultMessage: "templates.loyaltyProgramDetail.points.comment" }), points: _preferences[react_core_1.SCPreferences.POINTS_MAKE_COMMENT] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.appreciation", defaultMessage: "templates.loyaltyProgramDetail.points.appreciation" }), points: _preferences[react_core_1.SCPreferences.POINTS_RECEIVE_VOTE] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.follower", defaultMessage: "templates.loyaltyProgramDetail.points.follower" }), points: _preferences[react_core_1.SCPreferences.POINTS_CONNECTION_OR_FOLLOWER] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.share", defaultMessage: "templates.loyaltyProgramDetail.points.share" }), points: _preferences[react_core_1.SCPreferences.POINTS_SOCIAL_SHARE] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.app", defaultMessage: "templates.loyaltyProgramDetail.points.app" }), points: _preferences[react_core_1.SCPreferences.POINTS_APP_USED] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.visit", defaultMessage: "templates.loyaltyProgramDetail.points.visit" }), points: _preferences[react_core_1.SCPreferences.POINTS_DAILY_VISIT] })] })));
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), container: true, width: "100%", spacing: 2 }, rest, { children: [preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED].value && ((0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.post", defaultMessage: "templates.loyaltyProgramDetail.points.post" }), points: _preferences[react_core_1.SCPreferences.POINTS_MAKE_POST] })), preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED].value && ((0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.discussion", defaultMessage: "templates.loyaltyProgramDetail.points.discussion" }), points: _preferences[react_core_1.SCPreferences.POINTS_MAKE_DISCUSSION] })), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.comment", defaultMessage: "templates.loyaltyProgramDetail.points.comment" }), points: _preferences[react_core_1.SCPreferences.POINTS_MAKE_COMMENT] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.appreciation", defaultMessage: "templates.loyaltyProgramDetail.points.appreciation" }), points: _preferences[react_core_1.SCPreferences.POINTS_RECEIVE_VOTE] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.follower", defaultMessage: "templates.loyaltyProgramDetail.points.follower" }), points: _preferences[react_core_1.SCPreferences.POINTS_CONNECTION_OR_FOLLOWER] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.share", defaultMessage: "templates.loyaltyProgramDetail.points.share" }), points: _preferences[react_core_1.SCPreferences.POINTS_SOCIAL_SHARE] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.app", defaultMessage: "templates.loyaltyProgramDetail.points.app" }), points: _preferences[react_core_1.SCPreferences.POINTS_APP_USED] }), (0, jsx_runtime_1.jsx)(PointElement, { message: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.loyaltyProgramDetail.points.visit", defaultMessage: "templates.loyaltyProgramDetail.points.visit" }), points: _preferences[react_core_1.SCPreferences.POINTS_DAILY_VISIT] })] })));
|
|
55
55
|
}
|
|
56
56
|
exports.default = PointsList;
|
|
@@ -45,6 +45,6 @@ const Root = (0, material_1.styled)(material_1.Box, {
|
|
|
45
45
|
function LoyaltyProgramDetailSkeleton() {
|
|
46
46
|
const theme = (0, material_1.useTheme)();
|
|
47
47
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
48
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.title, component: 'div' }, { children: [!isMobile && (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 30, width: 140, variant: "text" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "circular", width: 172, height: 30, className: classes.chip })] })), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 20, width: '50%', variant: "text" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 17, width: '80%', variant: "text", className: classes.subTitle })] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 20, width: 146 }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, spacing: 2, className: classes.pointsList }, { children: [...Array(8)].map((
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.title, component: 'div' }, { children: [!isMobile && (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 30, width: 140, variant: "text" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "circular", width: 172, height: 30, className: classes.chip })] })), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 20, width: '50%', variant: "text" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 17, width: '80%', variant: "text", className: classes.subTitle })] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 20, width: 146 }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, width: "100%", spacing: 2, className: classes.pointsList }, { children: [...Array(8)].map((_prize, index) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ size: { md: 6 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 15, width: "100%" }) }), index))) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.sectionTitle }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 20, width: 140, variant: "text" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, width: "100%", spacing: isMobile ? 3 : 6 }, { children: [...Array(6)].map((_prize, index) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ size: { md: 6, lg: 4 } }, { children: (0, jsx_runtime_1.jsx)(PrizeItemSkeleton_1.default, {}) }), index))) }))] })));
|
|
49
49
|
}
|
|
50
50
|
exports.default = LoyaltyProgramDetailSkeleton;
|
|
@@ -85,9 +85,21 @@ function MainFeed(inProps) {
|
|
|
85
85
|
const { id = 'main_feed', className, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
86
86
|
//CONTEXT
|
|
87
87
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
88
|
+
const isAdvertisingCustomAdvEnabled = (0, react_core_1.useSCPreferenceEnabled)(react_core_1.SCPreferences.ADVERTISING_CUSTOM_ADV_ENABLED);
|
|
89
|
+
const isAdvertisingCustomAdvOnlyForAnonUsersEnabled = (0, react_core_1.useSCPreferenceEnabled)(react_core_1.SCPreferences.ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED);
|
|
88
90
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
89
91
|
// REF
|
|
90
|
-
const feedRef = (0, react_1.useRef)();
|
|
92
|
+
const feedRef = (0, react_1.useRef)(null);
|
|
93
|
+
/**
|
|
94
|
+
* Render advertising above the feed
|
|
95
|
+
*/
|
|
96
|
+
function renderAdvertising() {
|
|
97
|
+
if (isAdvertisingCustomAdvEnabled &&
|
|
98
|
+
((isAdvertisingCustomAdvOnlyForAnonUsersEnabled && scUserContext.user === null) || !isAdvertisingCustomAdvOnlyForAnonUsersEnabled)) {
|
|
99
|
+
return (0, jsx_runtime_1.jsx)(react_ui_1.CustomAdv, { position: types_1.SCCustomAdvPosition.POSITION_ABOVE_FEED });
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
91
103
|
// Ckeck user is authenticated
|
|
92
104
|
if (!scUserContext.user) {
|
|
93
105
|
return null;
|
|
@@ -103,7 +115,7 @@ function MainFeed(inProps) {
|
|
|
103
115
|
const feedUnit = {
|
|
104
116
|
type: feedObject.type,
|
|
105
117
|
[feedObject.type]: feedObject,
|
|
106
|
-
|
|
118
|
+
seen: false,
|
|
107
119
|
has_boost: false
|
|
108
120
|
};
|
|
109
121
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -116,7 +128,7 @@ function MainFeed(inProps) {
|
|
|
116
128
|
const feedUnit = {
|
|
117
129
|
type: feedObject.type,
|
|
118
130
|
[feedObject.type]: feedObject,
|
|
119
|
-
|
|
131
|
+
seen: false,
|
|
120
132
|
has_boost: false
|
|
121
133
|
};
|
|
122
134
|
feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -128,10 +140,10 @@ function MainFeed(inProps) {
|
|
|
128
140
|
feedObject: item[item.type],
|
|
129
141
|
feedObjectType: item.type,
|
|
130
142
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
131
|
-
markRead: scUser ? !item.
|
|
143
|
+
markRead: scUser ? !item.seen : null
|
|
132
144
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
133
145
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
134
|
-
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), react_core_1.UserUtils.isAdmin(scUserContext.user) && (0, jsx_runtime_1.jsx)(react_ui_1.OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), requireAuthentication: true, disablePaginationLinks: true, enabledCustomAdvPositions: [
|
|
146
|
+
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), react_core_1.UserUtils.isAdmin(scUserContext.user) && (0, jsx_runtime_1.jsx)(react_ui_1.OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent }), renderAdvertising()] }), requireAuthentication: true, disablePaginationLinks: true, enabledCustomAdvPositions: [
|
|
135
147
|
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
136
148
|
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
137
149
|
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -89,7 +89,7 @@ function UserFeed(inProps) {
|
|
|
89
89
|
// Hooks
|
|
90
90
|
const { scUser } = (0, react_core_1.useSCFetchUser)({ id: userId, user });
|
|
91
91
|
// REF
|
|
92
|
-
const feedRef = (0, react_1.useRef)();
|
|
92
|
+
const feedRef = (0, react_1.useRef)(null);
|
|
93
93
|
// HANDLERS
|
|
94
94
|
const handleComposerSuccess = (feedObject) => {
|
|
95
95
|
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
|
|
@@ -101,7 +101,7 @@ function UserFeed(inProps) {
|
|
|
101
101
|
const feedUnit = {
|
|
102
102
|
type: feedObject.type,
|
|
103
103
|
[feedObject.type]: feedObject,
|
|
104
|
-
|
|
104
|
+
seen: false,
|
|
105
105
|
has_boost: false
|
|
106
106
|
};
|
|
107
107
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -113,7 +113,7 @@ function UserFeed(inProps) {
|
|
|
113
113
|
if (scUser === null) {
|
|
114
114
|
return (0, jsx_runtime_1.jsx)(index_1.UserFeedSkeleton, {});
|
|
115
115
|
}
|
|
116
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.UserFeed), { url: () => api_services_1.Endpoints.UserFeed.url({ id: scUser.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (
|
|
116
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.UserFeed), { url: () => api_services_1.Endpoints.UserFeed.url({ id: scUser.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (_scUser, item) => ({
|
|
117
117
|
feedObject: item[item.type],
|
|
118
118
|
feedObjectType: item.type,
|
|
119
119
|
feedObjectActivities: item.activities ? item.activities : null
|
|
@@ -256,6 +256,6 @@ function UserProfile(inProps) {
|
|
|
256
256
|
})
|
|
257
257
|
} }) }))), scUser.location && ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.info }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "add_location_alt" }), " ", scUser.location] }))), taggingEnabled && ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "row", spacing: 2, className: classes.tags }, { children: scUser.tags
|
|
258
258
|
.filter((t) => t.visible)
|
|
259
|
-
.map((tag) => ((0, jsx_runtime_1.jsx)(react_ui_1.TagChip, { tag: tag, clickable: false, disposable: false }, tag.id))) }), `tags_${scUser.id}`)), (0, jsx_runtime_1.jsx)(UserFeed_1.default, Object.assign({ className: classes.feed, user: scUser, widgets: _widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, UserFeedProps), `feed_${scUser.id}`)] })) })) }))] })));
|
|
259
|
+
.map((tag) => ((0, jsx_runtime_1.jsx)(react_ui_1.TagChip, { tag: tag, clickable: false, disposable: false, showDescription: true }, tag.id))) }), `tags_${scUser.id}`)), (0, jsx_runtime_1.jsx)(UserFeed_1.default, Object.assign({ className: classes.feed, user: scUser, widgets: _widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, UserFeedProps), `feed_${scUser.id}`)] })) })) }))] })));
|
|
260
260
|
}
|
|
261
261
|
exports.default = UserProfile;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useRef } from 'react';
|
|
3
3
|
import { styled } from '@mui/material';
|
|
4
|
-
import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, HiddenPurchasableContent, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
|
|
4
|
+
import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, HiddenPurchasableContent, InlineComposerWidget, SCFeedObjectTemplateType, CustomAdv } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
|
-
import { Link, SCPreferences, SCRoutes, UserUtils, useSCFetchCategory,
|
|
6
|
+
import { Link, SCPreferences, SCRoutes, UserUtils, useSCFetchCategory, useSCPreferenceEnabled, useSCPreferencesAndFeaturesEnabled, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
7
|
import { SCCustomAdvPosition, SCFeatureName, SCFeedTypologyType } from '@selfcommunity/types';
|
|
8
8
|
import { CategoryFeedSkeleton } from './index';
|
|
9
9
|
import { useThemeProps } from '@mui/system';
|
|
@@ -71,24 +71,31 @@ export default function CategoryFeed(inProps) {
|
|
|
71
71
|
// CONTEXT
|
|
72
72
|
const scRoutingContext = useSCRouting();
|
|
73
73
|
const scUserContext = useSCUser();
|
|
74
|
-
const { preferences, features } = useSCPreferences();
|
|
75
74
|
const { enqueueSnackbar } = useSnackbar();
|
|
76
75
|
// REF
|
|
77
|
-
const feedRef = useRef();
|
|
76
|
+
const feedRef = useRef(null);
|
|
78
77
|
// Hooks
|
|
79
78
|
const { scCategory } = useSCFetchCategory({ id: categoryId, category });
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
const isAdvertisingCustomAdvEnabled = useSCPreferenceEnabled(SCPreferences.ADVERTISING_CUSTOM_ADV_ENABLED);
|
|
80
|
+
const isAdvertisingCustomAdvOnlyForAnonUsersEnabled = useSCPreferenceEnabled(SCPreferences.ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED);
|
|
81
|
+
const isPaymentsEnabled = useSCPreferencesAndFeaturesEnabled([SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED], [SCFeatureName.PAYMENTS]);
|
|
82
|
+
/**
|
|
83
|
+
* Render advertising above the feed
|
|
84
|
+
*/
|
|
85
|
+
function renderAdvertising() {
|
|
86
|
+
if (isAdvertisingCustomAdvEnabled &&
|
|
87
|
+
((isAdvertisingCustomAdvOnlyForAnonUsersEnabled && scUserContext.user === null) || !isAdvertisingCustomAdvOnlyForAnonUsersEnabled)) {
|
|
88
|
+
return _jsx(CustomAdv, { position: SCCustomAdvPosition.POSITION_ABOVE_FEED_CATEGORY, categoriesId: [scCategory.id] });
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
85
92
|
// HANDLERS
|
|
86
93
|
const handleComposerSuccess = (feedObject) => {
|
|
87
94
|
// Not insert if the category does not match
|
|
88
95
|
if (feedObject.categories.findIndex((c) => c.id === scCategory.id) === -1) {
|
|
89
96
|
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
90
97
|
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
91
|
-
action: (
|
|
98
|
+
action: () => (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], ContributionUtils.getRouteData(feedObject)) }, { children: _jsx(FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }) }))),
|
|
92
99
|
variant: 'success',
|
|
93
100
|
autoHideDuration: 7000
|
|
94
101
|
});
|
|
@@ -98,7 +105,7 @@ export default function CategoryFeed(inProps) {
|
|
|
98
105
|
const feedUnit = {
|
|
99
106
|
type: feedObject.type,
|
|
100
107
|
[feedObject.type]: feedObject,
|
|
101
|
-
|
|
108
|
+
seen: false,
|
|
102
109
|
has_boost: false
|
|
103
110
|
};
|
|
104
111
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -120,10 +127,10 @@ export default function CategoryFeed(inProps) {
|
|
|
120
127
|
feedObject: item[item.type],
|
|
121
128
|
feedObjectType: item.type,
|
|
122
129
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
123
|
-
markRead: scUser ? !item.
|
|
130
|
+
markRead: scUser ? !item.seen : null
|
|
124
131
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
125
132
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
126
|
-
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent:
|
|
133
|
+
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [((scCategory.content_only_staff && UserUtils.isStaff(scUserContext.user)) || !scCategory.content_only_staff) && (_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: SCFeedTypologyType.CATEGORY })), renderAdvertising()] }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
|
|
127
134
|
SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
128
135
|
SCCustomAdvPosition.POSITION_FEED,
|
|
129
136
|
SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -89,7 +89,7 @@ export default function EventFeed(inProps) {
|
|
|
89
89
|
const { enqueueSnackbar } = useSnackbar();
|
|
90
90
|
const { scEvent } = useSCFetchEvent({ id: eventId, event });
|
|
91
91
|
// REF
|
|
92
|
-
const feedRef = useRef();
|
|
92
|
+
const feedRef = useRef(null);
|
|
93
93
|
// CONST
|
|
94
94
|
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
95
95
|
useEffect(() => {
|
|
@@ -116,7 +116,7 @@ export default function EventFeed(inProps) {
|
|
|
116
116
|
const feedUnit = {
|
|
117
117
|
type: feedObject.type,
|
|
118
118
|
[feedObject.type]: feedObject,
|
|
119
|
-
|
|
119
|
+
seen: false,
|
|
120
120
|
has_boost: false
|
|
121
121
|
};
|
|
122
122
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -143,15 +143,12 @@ export default function EventFeed(inProps) {
|
|
|
143
143
|
status !== SCEventSubscriptionStatusType.NOT_GOING))) {
|
|
144
144
|
return (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(EventInfoWidget, { className: classes.root, event: scEvent }) })));
|
|
145
145
|
}
|
|
146
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.GetEventFeed), { url: () => Endpoints.GetEventFeed.url({ id: scEvent.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
markRead: scUser ? !((_a = item === null || item === void 0 ? void 0 : item.seen_by_id) === null || _a === void 0 ? void 0 : _a.includes(scUser.id)) : null
|
|
153
|
-
});
|
|
154
|
-
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
146
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.GetEventFeed), { url: () => Endpoints.GetEventFeed.url({ id: scEvent.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
147
|
+
feedObject: item[item.type],
|
|
148
|
+
feedObjectType: item.type,
|
|
149
|
+
feedObjectActivities: item.activities ? item.activities : null,
|
|
150
|
+
markRead: scUser ? !(item === null || item === void 0 ? void 0 : item.seen) : null
|
|
151
|
+
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
155
152
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
156
153
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(EventInfoWidget, { className: classes.root, event: scEvent }), Boolean(scEvent &&
|
|
157
154
|
((!scUserContext.user && scEvent.privacy === SCEventPrivacyType.PUBLIC) ||
|