@selfcommunity/react-templates 0.5.0-alpha.2 → 0.5.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/lib/cjs/components/Category/Category.js +1 -2
  2. package/lib/cjs/components/Category/Skeleton.js +1 -2
  3. package/lib/cjs/components/CategoryFeed/CategoryFeed.js +18 -7
  4. package/lib/cjs/components/CategoryFeed/Skeleton.js +2 -2
  5. package/lib/cjs/components/Event/Event.js +1 -2
  6. package/lib/cjs/components/Event/Skeleton.js +1 -2
  7. package/lib/cjs/components/EventFeed/EventFeed.js +37 -26
  8. package/lib/cjs/components/EventFeed/Skeleton.js +2 -2
  9. package/lib/cjs/components/ExploreFeed/ExploreFeed.js +8 -7
  10. package/lib/cjs/components/ExploreFeed/Skeleton.js +2 -2
  11. package/lib/cjs/components/FeedObjectDetail/FeedObjectDetail.js +5 -4
  12. package/lib/cjs/components/FeedObjectDetail/Skeleton.js +1 -2
  13. package/lib/cjs/components/Group/Group.js +1 -2
  14. package/lib/cjs/components/Group/Skeleton.js +1 -2
  15. package/lib/cjs/components/GroupFeed/GroupFeed.js +30 -18
  16. package/lib/cjs/components/GroupFeed/Skeleton.js +2 -2
  17. package/lib/cjs/components/Lesson/Lesson.js +2 -3
  18. package/lib/cjs/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +2 -4
  19. package/lib/cjs/components/LoyaltyProgramDetail/PointsList.js +1 -2
  20. package/lib/cjs/components/LoyaltyProgramDetail/PrizeItemSkeleton.js +1 -2
  21. package/lib/cjs/components/LoyaltyProgramDetail/Skeleton.js +1 -2
  22. package/lib/cjs/components/MainFeed/MainFeed.js +8 -7
  23. package/lib/cjs/components/MainFeed/Skeleton.js +2 -2
  24. package/lib/cjs/components/NotificationFeed/NotificationFeed.js +2 -2
  25. package/lib/cjs/components/NotificationFeed/Skeleton.js +2 -2
  26. package/lib/cjs/components/UserFeed/Skeleton.js +2 -2
  27. package/lib/cjs/components/UserFeed/UserFeed.js +6 -5
  28. package/lib/cjs/components/UserProfile/Skeleton.js +1 -2
  29. package/lib/cjs/components/UserProfile/UserProfile.js +6 -4
  30. package/lib/esm/components/Category/Category.js +1 -2
  31. package/lib/esm/components/Category/Skeleton.js +1 -2
  32. package/lib/esm/components/CategoryFeed/CategoryFeed.js +20 -9
  33. package/lib/esm/components/CategoryFeed/Skeleton.js +1 -1
  34. package/lib/esm/components/Event/Event.js +1 -2
  35. package/lib/esm/components/Event/Skeleton.js +1 -2
  36. package/lib/esm/components/EventFeed/EventFeed.js +37 -26
  37. package/lib/esm/components/EventFeed/Skeleton.js +1 -1
  38. package/lib/esm/components/ExploreFeed/ExploreFeed.js +7 -6
  39. package/lib/esm/components/ExploreFeed/Skeleton.js +1 -1
  40. package/lib/esm/components/FeedObjectDetail/FeedObjectDetail.js +5 -4
  41. package/lib/esm/components/FeedObjectDetail/Skeleton.js +1 -2
  42. package/lib/esm/components/Group/Group.js +1 -2
  43. package/lib/esm/components/Group/Skeleton.js +1 -2
  44. package/lib/esm/components/GroupFeed/GroupFeed.js +31 -19
  45. package/lib/esm/components/GroupFeed/Skeleton.js +1 -1
  46. package/lib/esm/components/Lesson/Lesson.js +1 -2
  47. package/lib/esm/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +1 -3
  48. package/lib/esm/components/LoyaltyProgramDetail/PointsList.js +1 -2
  49. package/lib/esm/components/LoyaltyProgramDetail/PrizeItemSkeleton.js +1 -2
  50. package/lib/esm/components/LoyaltyProgramDetail/Skeleton.js +1 -2
  51. package/lib/esm/components/MainFeed/MainFeed.js +7 -6
  52. package/lib/esm/components/MainFeed/Skeleton.js +1 -1
  53. package/lib/esm/components/NotificationFeed/NotificationFeed.js +1 -1
  54. package/lib/esm/components/NotificationFeed/Skeleton.js +1 -1
  55. package/lib/esm/components/UserFeed/Skeleton.js +1 -1
  56. package/lib/esm/components/UserFeed/UserFeed.js +5 -4
  57. package/lib/esm/components/UserProfile/Skeleton.js +1 -2
  58. package/lib/esm/components/UserProfile/UserProfile.js +6 -4
  59. package/lib/umd/{c473ce30406a3dad83e1.eot → 30b299174b4fa1fb9ce8.eot} +0 -0
  60. package/lib/umd/{b6dbec3d5816ff8baef1.woff → 3b49304a98beb1239bc7.ttf} +0 -0
  61. package/lib/umd/589.js +2 -0
  62. package/lib/umd/738.js +1 -1
  63. package/lib/umd/73cbb3dbfaa3ddd4df47.js +2 -0
  64. package/lib/umd/73cbb3dbfaa3ddd4df47.js.LICENSE.txt +21 -0
  65. package/lib/umd/ab247f43e550f5f6d0f8.woff2 +0 -0
  66. package/lib/umd/{ba74e493633796d551d1.ttf → ce10db0c87e7112cb315.woff} +0 -0
  67. package/lib/umd/{6158171e38cbff3c3340.svg → fff8590360ed9eed64ae.svg} +75 -69
  68. package/lib/umd/react-templates.js +1 -1
  69. package/package.json +9 -6
  70. package/lib/umd/60a7fdeaadfe844bc015.woff2 +0 -0
  71. package/lib/umd/916.js +0 -2
  72. /package/lib/umd/{916.js.LICENSE.txt → 589.js.LICENSE.txt} +0 -0
@@ -3,12 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const styles_1 = require("@mui/material/styles");
7
6
  const api_services_1 = require("@selfcommunity/api-services");
8
7
  const react_core_1 = require("@selfcommunity/react-core");
9
8
  const material_1 = require("@mui/material");
10
9
  const react_intl_1 = require("react-intl");
11
- const Chip_1 = tslib_1.__importDefault(require("@mui/material/Chip"));
12
10
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
13
11
  const system_1 = require("@mui/system");
14
12
  const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
@@ -33,7 +31,7 @@ const classes = {
33
31
  notRequestable: `${constants_1.PREFIX}-not-requestable`,
34
32
  endMessage: `${constants_1.PREFIX}-end-message`
35
33
  };
36
- const Root = (0, styles_1.styled)(material_1.Box, {
34
+ const Root = (0, material_1.styled)(material_1.Box, {
37
35
  name: constants_1.PREFIX,
38
36
  slot: 'Root'
39
37
  })(() => ({}));
@@ -186,6 +184,6 @@ function LoyaltyProgramDetail(inProps) {
186
184
  if (loading) {
187
185
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
188
186
  }
189
- 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)(Chip_1.default, { 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({ item: true, xs: 12, sm: 12, 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)(Chip_1.default, { 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) }))] })));
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({ item: true, xs: 12, sm: 12, 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) }))] })));
190
188
  }
191
189
  exports.default = LoyaltyProgramDetail;
@@ -4,7 +4,6 @@ exports.PointElement = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("react");
7
- const styles_1 = require("@mui/material/styles");
8
7
  const react_core_1 = require("@selfcommunity/react-core");
9
8
  const material_1 = require("@mui/material");
10
9
  const react_intl_1 = require("react-intl");
@@ -30,7 +29,7 @@ function PointElement({ message, points }) {
30
29
  }
31
30
  }
32
31
  exports.PointElement = PointElement;
33
- const Root = (0, styles_1.styled)(material_1.Grid, {
32
+ const Root = (0, material_1.styled)(material_1.Grid, {
34
33
  name: constants_1.PREFIX,
35
34
  slot: 'PointsListRoot'
36
35
  })(() => ({}));
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
- const styles_1 = require("@mui/material/styles");
5
4
  const material_1 = require("@mui/material");
6
5
  const react_ui_1 = require("@selfcommunity/react-ui");
7
6
  const constants_1 = require("./constants");
@@ -10,7 +9,7 @@ const classes = {
10
9
  content: `${constants_1.PREFIX}-content`,
11
10
  actions: `${constants_1.PREFIX}-actions`
12
11
  };
13
- const Root = (0, styles_1.styled)(react_ui_1.Widget, {
12
+ const Root = (0, material_1.styled)(react_ui_1.Widget, {
14
13
  name: constants_1.PREFIX,
15
14
  slot: 'PrizeItemSkeletonRoot'
16
15
  })(() => ({}));
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const styles_1 = require("@mui/material/styles");
6
5
  const material_1 = require("@mui/material");
7
6
  const PrizeItemSkeleton_1 = tslib_1.__importDefault(require("./PrizeItemSkeleton"));
8
7
  const constants_1 = require("./constants");
@@ -14,7 +13,7 @@ const classes = {
14
13
  pointsList: `${constants_1.PREFIX}-points-list`,
15
14
  chip: `${constants_1.PREFIX}-chip`
16
15
  };
17
- const Root = (0, styles_1.styled)(material_1.Box, {
16
+ const Root = (0, material_1.styled)(material_1.Box, {
18
17
  name: constants_1.PREFIX,
19
18
  slot: 'SkeletonRoot'
20
19
  })(() => ({}));
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const styles_1 = require("@mui/material/styles");
6
+ const material_1 = require("@mui/material");
7
7
  const react_ui_1 = require("@selfcommunity/react-ui");
8
8
  const api_services_1 = require("@selfcommunity/api-services");
9
9
  const react_core_1 = require("@selfcommunity/react-core");
@@ -16,7 +16,7 @@ const constants_1 = require("./constants");
16
16
  const classes = {
17
17
  root: `${constants_1.PREFIX}-root`
18
18
  };
19
- const Root = (0, styles_1.styled)(react_ui_1.Feed, {
19
+ const Root = (0, material_1.styled)(react_ui_1.Feed, {
20
20
  name: constants_1.PREFIX,
21
21
  slot: 'Root'
22
22
  })(() => ({}));
@@ -94,7 +94,8 @@ function MainFeed(inProps) {
94
94
  }
95
95
  // HANDLERS
96
96
  const handleComposerSuccess = (feedObject) => {
97
- enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.success", defaultMessage: "ui.inlineComposerWidget.success" }), {
97
+ const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
98
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
98
99
  variant: 'success',
99
100
  autoHideDuration: 3000
100
101
  });
@@ -102,10 +103,10 @@ function MainFeed(inProps) {
102
103
  const feedUnit = {
103
104
  type: feedObject.type,
104
105
  [feedObject.type]: feedObject,
105
- seen_by_id: [],
106
+ seen: false,
106
107
  has_boost: false
107
108
  };
108
- feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
109
+ !feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
109
110
  };
110
111
  const handleAddGenerationContent = (feedObjects) => {
111
112
  if (feedRef && feedRef.current) {
@@ -115,7 +116,7 @@ function MainFeed(inProps) {
115
116
  const feedUnit = {
116
117
  type: feedObject.type,
117
118
  [feedObject.type]: feedObject,
118
- seen_by_id: [],
119
+ seen: false,
119
120
  has_boost: false
120
121
  };
121
122
  feedRef.current.addFeedData(feedUnit, true);
@@ -127,7 +128,7 @@ function MainFeed(inProps) {
127
128
  feedObject: item[item.type],
128
129
  feedObjectType: item.type,
129
130
  feedObjectActivities: item.activities ? item.activities : null,
130
- markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
131
+ markRead: scUser ? !item.seen : null
131
132
  }), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
132
133
  template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
133
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: [
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
- const styles_1 = require("@mui/material/styles");
6
+ const material_1 = require("@mui/material");
7
7
  const react_ui_1 = require("@selfcommunity/react-ui");
8
8
  const constants_1 = require("./constants");
9
9
  const classes = {
10
10
  root: `${constants_1.PREFIX}-skeleton-root`
11
11
  };
12
- const Root = (0, styles_1.styled)(react_ui_1.FeedSkeleton, {
12
+ const Root = (0, material_1.styled)(react_ui_1.FeedSkeleton, {
13
13
  name: constants_1.PREFIX,
14
14
  slot: 'SkeletonRoot'
15
15
  })(() => ({}));
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const styles_1 = require("@mui/material/styles");
6
+ const material_1 = require("@mui/material");
7
7
  const react_ui_1 = require("@selfcommunity/react-ui");
8
8
  const api_services_1 = require("@selfcommunity/api-services");
9
9
  const react_core_1 = require("@selfcommunity/react-core");
@@ -14,7 +14,7 @@ const constants_1 = require("./constants");
14
14
  const classes = {
15
15
  root: `${constants_1.PREFIX}-root`
16
16
  };
17
- const Root = (0, styles_1.styled)(react_ui_1.Feed, {
17
+ const Root = (0, material_1.styled)(react_ui_1.Feed, {
18
18
  name: constants_1.PREFIX,
19
19
  slot: 'Root'
20
20
  })(() => ({}));
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
- const styles_1 = require("@mui/material/styles");
6
+ const material_1 = require("@mui/material");
7
7
  const react_ui_1 = require("@selfcommunity/react-ui");
8
8
  const constants_1 = require("./constants");
9
9
  const classes = {
10
10
  root: `${constants_1.PREFIX}-skeleton-root`
11
11
  };
12
- const Root = (0, styles_1.styled)(react_ui_1.FeedSkeleton, {
12
+ const Root = (0, material_1.styled)(react_ui_1.FeedSkeleton, {
13
13
  name: constants_1.PREFIX,
14
14
  slot: 'SkeletonRoot'
15
15
  })(() => ({}));
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
- const styles_1 = require("@mui/material/styles");
6
+ const material_1 = require("@mui/material");
7
7
  const react_ui_1 = require("@selfcommunity/react-ui");
8
8
  const constants_1 = require("./constants");
9
9
  const classes = {
10
10
  root: `${constants_1.PREFIX}-skeleton-root`
11
11
  };
12
- const Root = (0, styles_1.styled)(react_ui_1.FeedSkeleton, {
12
+ const Root = (0, material_1.styled)(react_ui_1.FeedSkeleton, {
13
13
  name: constants_1.PREFIX,
14
14
  slot: 'SkeletonRoot'
15
15
  })(() => ({}));
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const styles_1 = require("@mui/material/styles");
6
+ const material_1 = require("@mui/material");
7
7
  const api_services_1 = require("@selfcommunity/api-services");
8
8
  const react_core_1 = require("@selfcommunity/react-core");
9
9
  const react_ui_1 = require("@selfcommunity/react-ui");
@@ -16,7 +16,7 @@ const constants_1 = require("./constants");
16
16
  const classes = {
17
17
  root: `${constants_1.PREFIX}-root`
18
18
  };
19
- const Root = (0, styles_1.styled)(react_ui_1.Feed, {
19
+ const Root = (0, material_1.styled)(react_ui_1.Feed, {
20
20
  name: constants_1.PREFIX,
21
21
  slot: 'Root'
22
22
  })(() => ({}));
@@ -92,7 +92,8 @@ function UserFeed(inProps) {
92
92
  const feedRef = (0, react_1.useRef)();
93
93
  // HANDLERS
94
94
  const handleComposerSuccess = (feedObject) => {
95
- enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.success", defaultMessage: "ui.inlineComposerWidget.success" }), {
95
+ const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
96
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
96
97
  variant: 'success',
97
98
  autoHideDuration: 3000
98
99
  });
@@ -100,10 +101,10 @@ function UserFeed(inProps) {
100
101
  const feedUnit = {
101
102
  type: feedObject.type,
102
103
  [feedObject.type]: feedObject,
103
- seen_by_id: [],
104
+ seen: false,
104
105
  has_boost: false
105
106
  };
106
- feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
107
+ !feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
107
108
  };
108
109
  // WIDGETS
109
110
  const _widgets = (0, react_1.useMemo)(() => widgets.map((w) => {
@@ -3,14 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
- const styles_1 = require("@mui/material/styles");
7
6
  const react_ui_1 = require("@selfcommunity/react-ui");
8
7
  const Skeleton_1 = tslib_1.__importDefault(require("../UserFeed/Skeleton"));
9
8
  const constants_1 = require("./constants");
10
9
  const classes = {
11
10
  root: `${constants_1.PREFIX}-skeleton-root`
12
11
  };
13
- const Root = (0, styles_1.styled)(material_1.Box, {
12
+ const Root = (0, material_1.styled)(material_1.Box, {
14
13
  name: constants_1.PREFIX,
15
14
  slot: 'SkeletonRoot'
16
15
  })(() => ({}));
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const styles_1 = require("@mui/material/styles");
7
6
  const material_1 = require("@mui/material");
8
7
  const react_ui_1 = require("@selfcommunity/react-ui");
9
8
  const UserFeed_1 = tslib_1.__importDefault(require("../UserFeed"));
@@ -23,7 +22,7 @@ const classes = {
23
22
  feed: `${constants_1.PREFIX}-feed`,
24
23
  actions: `${constants_1.PREFIX}-actions`
25
24
  };
26
- const Root = (0, styles_1.styled)(material_1.Box, {
25
+ const Root = (0, material_1.styled)(material_1.Box, {
27
26
  name: constants_1.PREFIX,
28
27
  slot: 'Root'
29
28
  })(() => ({}));
@@ -186,13 +185,16 @@ function UserProfile(inProps) {
186
185
  const isMe = (0, react_1.useMemo)(() => scUserContext.user && (scUser === null || scUser === void 0 ? void 0 : scUser.id) === scUserContext.user.id, [scUserContext.user, scUser]);
187
186
  const followEnabled = (0, react_1.useMemo)(() => react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED in scPreferencesContext.preferences &&
188
187
  scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED].value, [scPreferencesContext.preferences]);
189
- const privateMessagingEnabled = (0, react_1.useMemo)(() => features.includes(types_1.SCFeatureName.PRIVATE_MESSAGING), [features]);
188
+ const connectionEnabled = react_core_1.SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED in scPreferencesContext.preferences &&
189
+ scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED].value;
190
+ const privateMessagingEnabled = (0, react_1.useMemo)(() => react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED in scPreferencesContext.preferences &&
191
+ scPreferencesContext.preferences[react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED].value, [scPreferencesContext.preferences]);
190
192
  const _widgets = (0, react_1.useMemo)(() => {
191
193
  var _a, _b;
192
194
  if (widgets !== null) {
193
195
  return widgets;
194
196
  }
195
- if (!scUser) {
197
+ if (!scUser || (!followEnabled && !connectionEnabled)) {
196
198
  return [];
197
199
  }
198
200
  let _widgets = [];
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { styled } from '@mui/material/styles';
3
- import { Box } from '@mui/material';
2
+ import { Box, styled } from '@mui/material';
4
3
  import { CategoryHeader } from '@selfcommunity/react-ui';
5
4
  import CategoryFeed from '../CategoryFeed';
6
5
  import { useSCFetchCategory } from '@selfcommunity/react-core';
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box } from '@mui/material';
3
- import { styled } from '@mui/material/styles';
2
+ import { Box, styled } from '@mui/material';
4
3
  import CategoryFeedSkeleton from '../CategoryFeed/Skeleton';
5
4
  import { CategoryHeaderSkeleton } from '@selfcommunity/react-ui';
6
5
  import { PREFIX } from './constants';
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useMemo, useRef } from 'react';
3
- import { styled } from '@mui/material/styles';
4
- import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
3
+ import { styled } from '@mui/material';
4
+ import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, HiddenPurchasableContent, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
5
5
  import { Endpoints } from '@selfcommunity/api-services';
6
- import { Link, SCRoutes, UserUtils, useSCFetchCategory, useSCRouting, useSCUser } from '@selfcommunity/react-core';
7
- import { SCCustomAdvPosition, SCFeedTypologyType } from '@selfcommunity/types';
6
+ import { Link, SCPreferences, SCRoutes, UserUtils, useSCFetchCategory, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
7
+ import { SCCustomAdvPosition, SCFeatureName, SCFeedTypologyType } from '@selfcommunity/types';
8
8
  import { CategoryFeedSkeleton } from './index';
9
9
  import { useThemeProps } from '@mui/system';
10
10
  import classNames from 'classnames';
@@ -61,6 +61,7 @@ const WIDGETS = [
61
61
  * @param inProps
62
62
  */
63
63
  export default function CategoryFeed(inProps) {
64
+ var _a;
64
65
  // PROPS
65
66
  const props = useThemeProps({
66
67
  props: inProps,
@@ -70,17 +71,24 @@ export default function CategoryFeed(inProps) {
70
71
  // CONTEXT
71
72
  const scRoutingContext = useSCRouting();
72
73
  const scUserContext = useSCUser();
74
+ const { preferences, features } = useSCPreferences();
73
75
  const { enqueueSnackbar } = useSnackbar();
74
76
  // REF
75
77
  const feedRef = useRef();
76
78
  // Hooks
77
79
  const { scCategory } = useSCFetchCategory({ id: categoryId, category });
80
+ const isPaymentsEnabled = useMemo(() => preferences &&
81
+ features &&
82
+ features.includes(SCFeatureName.PAYMENTS) &&
83
+ SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED in preferences &&
84
+ preferences[SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED].value, [preferences]);
78
85
  // HANDLERS
79
86
  const handleComposerSuccess = (feedObject) => {
80
87
  // Not insert if the category does not match
81
88
  if (feedObject.categories.findIndex((c) => c.id === scCategory.id) === -1) {
82
- enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
83
- action: (snackbarId) => (_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" }) }))),
89
+ const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
90
+ enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
91
+ 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" }) }))),
84
92
  variant: 'success',
85
93
  autoHideDuration: 7000
86
94
  });
@@ -90,10 +98,10 @@ export default function CategoryFeed(inProps) {
90
98
  const feedUnit = {
91
99
  type: feedObject.type,
92
100
  [feedObject.type]: feedObject,
93
- seen_by_id: [],
101
+ seen: false,
94
102
  has_boost: false
95
103
  };
96
- feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
104
+ !feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
97
105
  };
98
106
  // WIDGETS
99
107
  const _widgets = useMemo(() => widgets.map((w) => {
@@ -105,11 +113,14 @@ export default function CategoryFeed(inProps) {
105
113
  if (!scCategory) {
106
114
  return _jsx(CategoryFeedSkeleton, {});
107
115
  }
116
+ else if (scCategory && isPaymentsEnabled && !scCategory.followed && !scCategory.payment_order && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0) {
117
+ return _jsx(HiddenPurchasableContent, {});
118
+ }
108
119
  return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className), ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.CategoryFeed), { url: () => Endpoints.CategoryFeed.url({ id: scCategory.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => ({
109
120
  feedObject: item[item.type],
110
121
  feedObjectType: item.type,
111
122
  feedObjectActivities: item.activities ? item.activities : null,
112
- markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
123
+ markRead: scUser ? !item.seen : null
113
124
  }), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
114
125
  template: SCFeedObjectTemplateType.PREVIEW
115
126
  }, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsx(_Fragment, { children: ((scCategory.content_only_staff && UserUtils.isStaff(scUserContext.user)) || !scCategory.content_only_staff) && (_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: SCFeedTypologyType.CATEGORY })) }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import { styled } from '@mui/material/styles';
3
+ import { styled } from '@mui/material';
4
4
  import { FeedObjectSkeleton, SCFeedObjectTemplateType, FeedSkeleton, GenericSkeleton, InlineComposerWidgetSkeleton } from '@selfcommunity/react-ui';
5
5
  import { PREFIX } from './constants';
6
6
  const classes = {
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { styled } from '@mui/material/styles';
3
- import { Box } from '@mui/material';
2
+ import { Box, styled } from '@mui/material';
4
3
  import { EventHeader } from '@selfcommunity/react-ui';
5
4
  import { useSCFetchEvent, useSCUser } from '@selfcommunity/react-core';
6
5
  import { SCEventPrivacyType, SCEventSubscriptionStatusType } from '@selfcommunity/types';
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box } from '@mui/material';
3
- import { styled } from '@mui/material/styles';
2
+ import { Box, styled } from '@mui/material';
4
3
  import EventFeedSkeleton from '../EventFeed/Skeleton';
5
4
  import { EventHeaderSkeleton } from '@selfcommunity/react-ui';
6
5
  import { PREFIX } from './constants';
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, useRef } from 'react';
3
- import { styled } from '@mui/material/styles';
2
+ import { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { styled, Box } from '@mui/material';
4
4
  import { ContributionUtils, EventInfoWidget, EventLocationWidget, EventMediaWidget, EventMembersWidget, Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, RelatedEventsWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
5
5
  import { Endpoints } from '@selfcommunity/api-services';
6
6
  import { Link, SCRoutes, useSCFetchEvent, useSCRouting, useSCUser } from '@selfcommunity/react-core';
@@ -11,7 +11,6 @@ import { FormattedMessage } from 'react-intl';
11
11
  import { useSnackbar } from 'notistack';
12
12
  import { PREFIX } from './constants';
13
13
  import EventFeedSkeleton from './Skeleton';
14
- import { Box } from '@mui/material';
15
14
  const classes = {
16
15
  root: `${PREFIX}-root`
17
16
  };
@@ -81,18 +80,33 @@ export default function EventFeed(inProps) {
81
80
  name: PREFIX
82
81
  });
83
82
  const { id = 'event_feed', className, event, eventId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
83
+ // STATUS
84
+ const [status, setStatus] = useState(undefined);
84
85
  // CONTEXT
85
86
  const scRoutingContext = useSCRouting();
86
87
  const scUserContext = useSCUser();
88
+ const scEventsManager = scUserContext.managers.events;
87
89
  const { enqueueSnackbar } = useSnackbar();
90
+ const { scEvent } = useSCFetchEvent({ id: eventId, event });
88
91
  // REF
89
92
  const feedRef = useRef();
90
- // Hooks
91
- const { scEvent } = useSCFetchEvent({ id: eventId, event });
93
+ // CONST
94
+ const authUserId = scUserContext.user ? scUserContext.user.id : null;
95
+ useEffect(() => {
96
+ var _a;
97
+ /**
98
+ * Call scEventsManager.subscriptionStatus inside an effect
99
+ * to avoid warning rendering child during update parent state
100
+ */
101
+ if (authUserId) {
102
+ setStatus((_a = scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus) === null || _a === void 0 ? void 0 : _a.call(scEventsManager, scEvent));
103
+ }
104
+ }, [authUserId, scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus, scEvent]);
92
105
  // HANDLERS
93
106
  const handleComposerSuccess = (feedObject) => {
94
107
  var _a;
95
- enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
108
+ const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
109
+ enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
96
110
  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" }) }))),
97
111
  variant: 'success',
98
112
  autoHideDuration: 7000
@@ -102,10 +116,10 @@ export default function EventFeed(inProps) {
102
116
  const feedUnit = {
103
117
  type: feedObject.type,
104
118
  [feedObject.type]: feedObject,
105
- seen_by_id: [],
119
+ seen: false,
106
120
  has_boost: false
107
121
  };
108
- feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
122
+ !feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
109
123
  }
110
124
  };
111
125
  // WIDGETS
@@ -116,35 +130,32 @@ export default function EventFeed(inProps) {
116
130
  return w;
117
131
  }), [widgets, scEvent]);
118
132
  if (scUserContext.user === undefined ||
133
+ (scUserContext.user && status === undefined) ||
119
134
  !scEvent ||
120
- (scUserContext.user &&
121
- ((scEvent.privacy === SCEventPrivacyType.PUBLIC && !scEvent.subscription_status) ||
122
- scEvent.subscription_status === SCEventSubscriptionStatusType.INVITED)) ||
135
+ (scUserContext.user && scEvent.privacy === SCEventPrivacyType.PUBLIC && !status) ||
123
136
  (scEvent && ((eventId !== undefined && scEvent.id !== eventId) || (event && scEvent.id !== event.id)))) {
124
137
  return _jsx(EventFeedSkeleton, {});
125
138
  }
126
139
  else if (scEvent.privacy === SCEventPrivacyType.PRIVATE &&
127
- scEvent.subscription_status !== SCEventSubscriptionStatusType.SUBSCRIBED &&
128
- scEvent.subscription_status !== SCEventSubscriptionStatusType.GOING &&
129
- scEvent.subscription_status !== SCEventSubscriptionStatusType.NOT_GOING) {
140
+ (status === SCEventSubscriptionStatusType.INVITED ||
141
+ (status !== SCEventSubscriptionStatusType.SUBSCRIBED &&
142
+ status !== SCEventSubscriptionStatusType.GOING &&
143
+ status !== SCEventSubscriptionStatusType.NOT_GOING))) {
130
144
  return (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(EventInfoWidget, { className: classes.root, event: scEvent }) })));
131
145
  }
132
- 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) => {
133
- var _a;
134
- return ({
135
- feedObject: item[item.type],
136
- feedObjectType: item.type,
137
- feedObjectActivities: item.activities ? item.activities : null,
138
- 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
139
- });
140
- }, 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: {
141
152
  template: SCFeedObjectTemplateType.PREVIEW
142
153
  }, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(EventInfoWidget, { className: classes.root, event: scEvent }), Boolean(scEvent &&
143
154
  ((!scUserContext.user && scEvent.privacy === SCEventPrivacyType.PUBLIC) ||
144
155
  (scUserContext.user &&
145
- (scEvent.subscription_status === SCEventSubscriptionStatusType.SUBSCRIBED ||
146
- scEvent.subscription_status === SCEventSubscriptionStatusType.GOING ||
147
- scEvent.subscription_status === SCEventSubscriptionStatusType.NOT_GOING)))) && (_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { event: scEvent }, label: _jsx(FormattedMessage, { id: "templates.eventFeed.composer.label", defaultMessage: "templates.eventFeed.composer.label" }), feedType: SCFeedTypologyType.EVENT }))] }), CustomAdvProps: { position: SCCustomAdvPosition.POSITION_FEED, groupsId: [scEvent.id] }, enabledCustomAdvPositions: [
156
+ (status === SCEventSubscriptionStatusType.SUBSCRIBED ||
157
+ status === SCEventSubscriptionStatusType.GOING ||
158
+ status === SCEventSubscriptionStatusType.NOT_GOING)))) && (_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { event: scEvent }, label: _jsx(FormattedMessage, { id: "templates.eventFeed.composer.label", defaultMessage: "templates.eventFeed.composer.label" }), feedType: SCFeedTypologyType.EVENT }))] }), CustomAdvProps: { position: SCCustomAdvPosition.POSITION_FEED, groupsId: [scEvent.id] }, enabledCustomAdvPositions: [
148
159
  SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
149
160
  SCCustomAdvPosition.POSITION_FEED,
150
161
  SCCustomAdvPosition.POSITION_BELOW_TOPBAR
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import { styled } from '@mui/material/styles';
3
+ import { styled } from '@mui/material';
4
4
  import { FeedObjectSkeleton, SCFeedObjectTemplateType, FeedSkeleton, GenericSkeleton, InlineComposerWidgetSkeleton } from '@selfcommunity/react-ui';
5
5
  import { PREFIX } from './constants';
6
6
  const classes = {