@selfcommunity/react-templates 0.5.0-alpha.3 → 0.5.0-alpha.30

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 +27 -9
  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 +48 -30
  8. package/lib/cjs/components/EventFeed/Skeleton.js +2 -2
  9. package/lib/cjs/components/ExploreFeed/ExploreFeed.js +19 -11
  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 +39 -20
  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 +19 -11
  23. package/lib/cjs/components/MainFeed/Skeleton.js +2 -2
  24. package/lib/cjs/components/NotificationFeed/NotificationFeed.js +13 -6
  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 +18 -10
  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 +29 -11
  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 +49 -31
  37. package/lib/esm/components/EventFeed/Skeleton.js +1 -1
  38. package/lib/esm/components/ExploreFeed/ExploreFeed.js +19 -11
  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 +41 -22
  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 +19 -11
  52. package/lib/esm/components/MainFeed/Skeleton.js +1 -1
  53. package/lib/esm/components/NotificationFeed/NotificationFeed.js +13 -6
  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 +18 -10
  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
@@ -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 react_ui_1 = require("@selfcommunity/react-ui");
8
7
  const CategoryFeed_1 = tslib_1.__importDefault(require("../CategoryFeed"));
@@ -15,7 +14,7 @@ const classes = {
15
14
  root: `${constants_1.PREFIX}-root`,
16
15
  feed: `${constants_1.PREFIX}-feed`
17
16
  };
18
- const Root = (0, styles_1.styled)(material_1.Box, {
17
+ const Root = (0, material_1.styled)(material_1.Box, {
19
18
  name: constants_1.PREFIX,
20
19
  slot: 'Root'
21
20
  })(() => ({}));
@@ -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 Skeleton_1 = tslib_1.__importDefault(require("../CategoryFeed/Skeleton"));
8
7
  const react_ui_1 = require("@selfcommunity/react-ui");
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,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");
@@ -17,7 +17,7 @@ const constants_1 = require("./constants");
17
17
  const classes = {
18
18
  root: `${constants_1.PREFIX}-root`
19
19
  };
20
- const Root = (0, styles_1.styled)(react_ui_1.Feed, {
20
+ const Root = (0, material_1.styled)(react_ui_1.Feed, {
21
21
  name: constants_1.PREFIX,
22
22
  slot: 'Root'
23
23
  })(() => ({}));
@@ -25,17 +25,24 @@ const Root = (0, styles_1.styled)(react_ui_1.Feed, {
25
25
  const WIDGETS = [
26
26
  {
27
27
  type: 'widget',
28
- component: react_ui_1.CategoryTrendingUsersWidget,
28
+ component: react_ui_1.FooterWidget,
29
29
  componentProps: {},
30
30
  column: 'right',
31
31
  position: 0
32
32
  },
33
33
  {
34
34
  type: 'widget',
35
- component: react_ui_1.CategoryTrendingFeedWidget,
35
+ component: react_ui_1.CategoryTrendingUsersWidget,
36
36
  componentProps: {},
37
37
  column: 'right',
38
38
  position: 1
39
+ },
40
+ {
41
+ type: 'widget',
42
+ component: react_ui_1.CategoryTrendingFeedWidget,
43
+ componentProps: {},
44
+ column: 'right',
45
+ position: 2
39
46
  }
40
47
  ];
41
48
  /**
@@ -64,6 +71,7 @@ const WIDGETS = [
64
71
  * @param inProps
65
72
  */
66
73
  function CategoryFeed(inProps) {
74
+ var _a;
67
75
  // PROPS
68
76
  const props = (0, system_1.useThemeProps)({
69
77
  props: inProps,
@@ -73,17 +81,24 @@ function CategoryFeed(inProps) {
73
81
  // CONTEXT
74
82
  const scRoutingContext = (0, react_core_1.useSCRouting)();
75
83
  const scUserContext = (0, react_core_1.useSCUser)();
84
+ const { preferences, features } = (0, react_core_1.useSCPreferences)();
76
85
  const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
77
86
  // REF
78
87
  const feedRef = (0, react_1.useRef)();
79
88
  // Hooks
80
89
  const { scCategory } = (0, react_core_1.useSCFetchCategory)({ id: categoryId, category });
90
+ const isPaymentsEnabled = (0, react_1.useMemo)(() => preferences &&
91
+ features &&
92
+ features.includes(types_1.SCFeatureName.PAYMENTS) &&
93
+ react_core_1.SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED in preferences &&
94
+ preferences[react_core_1.SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED].value, [preferences]);
81
95
  // HANDLERS
82
96
  const handleComposerSuccess = (feedObject) => {
83
97
  // Not insert if the category does not match
84
98
  if (feedObject.categories.findIndex((c) => c.id === scCategory.id) === -1) {
85
- enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
86
- action: (snackbarId) => ((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
+ const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
100
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
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" }) }))),
87
102
  variant: 'success',
88
103
  autoHideDuration: 7000
89
104
  });
@@ -93,10 +108,10 @@ function CategoryFeed(inProps) {
93
108
  const feedUnit = {
94
109
  type: feedObject.type,
95
110
  [feedObject.type]: feedObject,
96
- seen_by_id: [],
111
+ seen: false,
97
112
  has_boost: false
98
113
  };
99
- feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
114
+ !feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
100
115
  };
101
116
  // WIDGETS
102
117
  const _widgets = (0, react_1.useMemo)(() => widgets.map((w) => {
@@ -108,11 +123,14 @@ function CategoryFeed(inProps) {
108
123
  if (!scCategory) {
109
124
  return (0, jsx_runtime_1.jsx)(index_1.CategoryFeedSkeleton, {});
110
125
  }
126
+ else if (scCategory && isPaymentsEnabled && !scCategory.followed && !scCategory.payment_order && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0) {
127
+ return (0, jsx_runtime_1.jsx)(react_ui_1.HiddenPurchasableContent, {});
128
+ }
111
129
  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.CategoryFeed), { url: () => api_services_1.Endpoints.CategoryFeed.url({ id: scCategory.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => ({
112
130
  feedObject: item[item.type],
113
131
  feedObjectType: item.type,
114
132
  feedObjectActivities: item.activities ? item.activities : null,
115
- markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
133
+ markRead: scUser ? !item.seen : null
116
134
  }), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
117
135
  template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
118
136
  }, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsx)(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 })) }), CustomAdvProps: { categoriesId: [scCategory.id] }, 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
  })(() => ({}));
@@ -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 react_ui_1 = require("@selfcommunity/react-ui");
8
7
  const react_core_1 = require("@selfcommunity/react-core");
@@ -16,7 +15,7 @@ const classes = {
16
15
  root: `${constants_1.PREFIX}-root`,
17
16
  feed: `${constants_1.PREFIX}-feed`
18
17
  };
19
- const Root = (0, styles_1.styled)(material_1.Box, {
18
+ const Root = (0, material_1.styled)(material_1.Box, {
20
19
  name: constants_1.PREFIX,
21
20
  slot: 'Root'
22
21
  })(() => ({}));
@@ -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 Skeleton_1 = tslib_1.__importDefault(require("../EventFeed/Skeleton"));
8
7
  const react_ui_1 = require("@selfcommunity/react-ui");
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,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,11 +14,10 @@ const react_intl_1 = require("react-intl");
14
14
  const notistack_1 = require("notistack");
15
15
  const constants_1 = require("./constants");
16
16
  const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
17
- const material_1 = require("@mui/material");
18
17
  const classes = {
19
18
  root: `${constants_1.PREFIX}-root`
20
19
  };
21
- const Root = (0, styles_1.styled)(react_ui_1.Feed, {
20
+ const Root = (0, material_1.styled)(react_ui_1.Feed, {
22
21
  name: constants_1.PREFIX,
23
22
  slot: 'Root'
24
23
  })(() => ({}));
@@ -26,31 +25,38 @@ const Root = (0, styles_1.styled)(react_ui_1.Feed, {
26
25
  const WIDGETS = [
27
26
  {
28
27
  type: 'widget',
29
- component: react_ui_1.EventLocationWidget,
28
+ component: react_ui_1.FooterWidget,
30
29
  componentProps: {},
31
30
  column: 'right',
32
31
  position: 0
33
32
  },
34
33
  {
35
34
  type: 'widget',
36
- component: react_ui_1.EventMembersWidget,
35
+ component: react_ui_1.EventLocationWidget,
37
36
  componentProps: {},
38
37
  column: 'right',
39
38
  position: 1
40
39
  },
41
40
  {
42
41
  type: 'widget',
43
- component: react_ui_1.EventMediaWidget,
42
+ component: react_ui_1.EventMembersWidget,
44
43
  componentProps: {},
45
44
  column: 'right',
46
45
  position: 2
47
46
  },
48
47
  {
49
48
  type: 'widget',
50
- component: react_ui_1.RelatedEventsWidget,
49
+ component: react_ui_1.EventMediaWidget,
51
50
  componentProps: {},
52
51
  column: 'right',
53
52
  position: 3
53
+ },
54
+ {
55
+ type: 'widget',
56
+ component: react_ui_1.RelatedEventsWidget,
57
+ componentProps: {},
58
+ column: 'right',
59
+ position: 4
54
60
  }
55
61
  ];
56
62
  /**
@@ -84,18 +90,33 @@ function EventFeed(inProps) {
84
90
  name: constants_1.PREFIX
85
91
  });
86
92
  const { id = 'event_feed', className, event, eventId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
93
+ // STATUS
94
+ const [status, setStatus] = (0, react_1.useState)(undefined);
87
95
  // CONTEXT
88
96
  const scRoutingContext = (0, react_core_1.useSCRouting)();
89
97
  const scUserContext = (0, react_core_1.useSCUser)();
98
+ const scEventsManager = scUserContext.managers.events;
90
99
  const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
100
+ const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
91
101
  // REF
92
102
  const feedRef = (0, react_1.useRef)();
93
- // Hooks
94
- const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
103
+ // CONST
104
+ const authUserId = scUserContext.user ? scUserContext.user.id : null;
105
+ (0, react_1.useEffect)(() => {
106
+ var _a;
107
+ /**
108
+ * Call scEventsManager.subscriptionStatus inside an effect
109
+ * to avoid warning rendering child during update parent state
110
+ */
111
+ if (authUserId) {
112
+ setStatus((_a = scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus) === null || _a === void 0 ? void 0 : _a.call(scEventsManager, scEvent));
113
+ }
114
+ }, [authUserId, scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus, scEvent]);
95
115
  // HANDLERS
96
116
  const handleComposerSuccess = (feedObject) => {
97
117
  var _a;
98
- enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
118
+ const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
119
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
99
120
  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" }) }))),
100
121
  variant: 'success',
101
122
  autoHideDuration: 7000
@@ -105,10 +126,10 @@ function EventFeed(inProps) {
105
126
  const feedUnit = {
106
127
  type: feedObject.type,
107
128
  [feedObject.type]: feedObject,
108
- seen_by_id: [],
129
+ seen: false,
109
130
  has_boost: false
110
131
  };
111
- feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
132
+ !feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
112
133
  }
113
134
  };
114
135
  // WIDGETS
@@ -119,35 +140,32 @@ function EventFeed(inProps) {
119
140
  return w;
120
141
  }), [widgets, scEvent]);
121
142
  if (scUserContext.user === undefined ||
143
+ (scUserContext.user && status === undefined) ||
122
144
  !scEvent ||
123
- (scUserContext.user &&
124
- ((scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC && !scEvent.subscription_status) ||
125
- scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.INVITED)) ||
145
+ (scUserContext.user && scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC && !status) ||
126
146
  (scEvent && ((eventId !== undefined && scEvent.id !== eventId) || (event && scEvent.id !== event.id)))) {
127
147
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
128
148
  }
129
149
  else if (scEvent.privacy === types_1.SCEventPrivacyType.PRIVATE &&
130
- scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.SUBSCRIBED &&
131
- scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.GOING &&
132
- scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.NOT_GOING) {
150
+ (status === types_1.SCEventSubscriptionStatusType.INVITED ||
151
+ (status !== types_1.SCEventSubscriptionStatusType.SUBSCRIBED &&
152
+ status !== types_1.SCEventSubscriptionStatusType.GOING &&
153
+ status !== types_1.SCEventSubscriptionStatusType.NOT_GOING))) {
133
154
  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 }) })));
134
155
  }
135
- 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) => {
136
- var _a;
137
- return ({
138
- feedObject: item[item.type],
139
- feedObjectType: item.type,
140
- feedObjectActivities: item.activities ? item.activities : null,
141
- 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
142
- });
143
- }, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
156
+ 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) => ({
157
+ feedObject: item[item.type],
158
+ feedObjectType: item.type,
159
+ feedObjectActivities: item.activities ? item.activities : null,
160
+ markRead: scUser ? !(item === null || item === void 0 ? void 0 : item.seen) : null
161
+ }), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
144
162
  template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
145
163
  }, 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 &&
146
164
  ((!scUserContext.user && scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC) ||
147
165
  (scUserContext.user &&
148
- (scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.SUBSCRIBED ||
149
- scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.GOING ||
150
- scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.NOT_GOING)))) && ((0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { event: scEvent }, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.eventFeed.composer.label", defaultMessage: "templates.eventFeed.composer.label" }), feedType: types_1.SCFeedTypologyType.EVENT }))] }), CustomAdvProps: { position: types_1.SCCustomAdvPosition.POSITION_FEED, groupsId: [scEvent.id] }, enabledCustomAdvPositions: [
166
+ (status === types_1.SCEventSubscriptionStatusType.SUBSCRIBED ||
167
+ status === types_1.SCEventSubscriptionStatusType.GOING ||
168
+ status === types_1.SCEventSubscriptionStatusType.NOT_GOING)))) && ((0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { event: scEvent }, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.eventFeed.composer.label", defaultMessage: "templates.eventFeed.composer.label" }), feedType: types_1.SCFeedTypologyType.EVENT }))] }), CustomAdvProps: { position: types_1.SCCustomAdvPosition.POSITION_FEED, groupsId: [scEvent.id] }, enabledCustomAdvPositions: [
151
169
  types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
152
170
  types_1.SCCustomAdvPosition.POSITION_FEED,
153
171
  types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
@@ -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 system_1 = require("@mui/system");
@@ -16,7 +16,7 @@ const react_core_1 = require("@selfcommunity/react-core");
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
  })(() => ({}));
@@ -24,31 +24,38 @@ const Root = (0, styles_1.styled)(react_ui_1.Feed, {
24
24
  const WIDGETS = [
25
25
  {
26
26
  type: 'widget',
27
- component: react_ui_1.PlatformWidget,
27
+ component: react_ui_1.FooterWidget,
28
28
  componentProps: {},
29
29
  column: 'right',
30
30
  position: 0
31
31
  },
32
32
  {
33
33
  type: 'widget',
34
- component: react_ui_1.LoyaltyProgramWidget,
34
+ component: react_ui_1.PlatformWidget,
35
35
  componentProps: {},
36
36
  column: 'right',
37
37
  position: 1
38
38
  },
39
39
  {
40
40
  type: 'widget',
41
- component: react_ui_1.CategoriesPopularWidget,
41
+ component: react_ui_1.LoyaltyProgramWidget,
42
42
  componentProps: {},
43
43
  column: 'right',
44
44
  position: 2
45
45
  },
46
46
  {
47
47
  type: 'widget',
48
- component: react_ui_1.UserSuggestionWidget,
48
+ component: react_ui_1.CategoriesPopularWidget,
49
49
  componentProps: {},
50
50
  column: 'right',
51
51
  position: 3
52
+ },
53
+ {
54
+ type: 'widget',
55
+ component: react_ui_1.UserSuggestionWidget,
56
+ componentProps: {},
57
+ column: 'right',
58
+ position: 4
52
59
  }
53
60
  ];
54
61
  /**
@@ -90,7 +97,8 @@ function ExploreFeed(inProps) {
90
97
  const feedRef = (0, react_1.useRef)();
91
98
  // HANDLERS
92
99
  const handleComposerSuccess = (feedObject) => {
93
- enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.success", defaultMessage: "ui.inlineComposerWidget.success" }), {
100
+ const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
101
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
94
102
  variant: 'success',
95
103
  autoHideDuration: 3000
96
104
  });
@@ -98,10 +106,10 @@ function ExploreFeed(inProps) {
98
106
  const feedUnit = {
99
107
  type: feedObject.type,
100
108
  [feedObject.type]: feedObject,
101
- seen_by_id: [],
109
+ seen: false,
102
110
  has_boost: false
103
111
  };
104
- feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
112
+ !feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
105
113
  };
106
114
  const handleAddGenerationContent = (feedObjects) => {
107
115
  if (feedRef && feedRef.current) {
@@ -111,7 +119,7 @@ function ExploreFeed(inProps) {
111
119
  const feedUnit = {
112
120
  type: feedObject.type,
113
121
  [feedObject.type]: feedObject,
114
- seen_by_id: [],
122
+ seen: false,
115
123
  has_boost: false
116
124
  };
117
125
  feedRef.current.addFeedData(feedUnit, true);
@@ -127,7 +135,7 @@ function ExploreFeed(inProps) {
127
135
  feedObject: item[item.type],
128
136
  feedObjectType: item.type,
129
137
  feedObjectActivities: item.activities ? item.activities : null,
130
- markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
138
+ markRead: scUser ? !item.seen : null
131
139
  }), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
132
140
  template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
133
141
  }, 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: [
@@ -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,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 Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
@@ -16,7 +15,7 @@ const constants_1 = require("./constants");
16
15
  const classes = {
17
16
  root: `${constants_1.PREFIX}-root`
18
17
  };
19
- const Root = (0, styles_1.styled)(material_1.Box, {
18
+ const Root = (0, material_1.styled)(material_1.Box, {
20
19
  name: constants_1.PREFIX,
21
20
  slot: 'Root'
22
21
  })(() => ({}));
@@ -57,8 +56,10 @@ function FeedObjectDetail(inProps) {
57
56
  const scUserContext = (0, react_core_1.useSCUser)();
58
57
  const scPreferences = (0, react_core_1.useSCPreferences)();
59
58
  // RETRIVE OBJECTS
60
- const { obj, setObj, error } = (0, react_core_1.useSCFetchFeedObject)({ id: feedObjectId, feedObject, feedObjectType });
59
+ const { obj, error } = (0, react_core_1.useSCFetchFeedObject)({ id: feedObjectId, feedObject, feedObjectType });
61
60
  const [comments, setComments] = (0, react_1.useState)([]);
61
+ const commentsEnabled = react_core_1.SCPreferences.CONFIGURATIONS_COMMENTS_ENABLED in scPreferences.preferences &&
62
+ scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_COMMENTS_ENABLED].value;
62
63
  /**
63
64
  * Compute preferences
64
65
  */
@@ -97,6 +98,6 @@ function FeedObjectDetail(inProps) {
97
98
  if (!obj) {
98
99
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
99
100
  }
100
- 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({ item: true, xs: 12, 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(), (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({ item: true, xs: 12, md: 5 }, { children: (0, jsx_runtime_1.jsx)(material_1.Hidden, Object.assign({ mdDown: true }, { 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}`) })) })) }))] })) })));
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({ item: true, xs: 12, 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({ item: true, xs: 12, md: 5 }, { children: (0, jsx_runtime_1.jsx)(material_1.Hidden, Object.assign({ mdDown: true }, { 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}`) })) })) }))] })) })));
101
102
  }
102
103
  exports.default = FeedObjectDetail;
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
4
  const react_ui_1 = require("@selfcommunity/react-ui");
5
5
  const material_1 = require("@mui/material");
6
- const styles_1 = require("@mui/material/styles");
7
6
  const constants_1 = require("./constants");
8
7
  const classes = {
9
8
  root: `${constants_1.PREFIX}-skeleton-root`
10
9
  };
11
- const Root = (0, styles_1.styled)(material_1.Box, {
10
+ const Root = (0, material_1.styled)(material_1.Box, {
12
11
  name: constants_1.PREFIX,
13
12
  slot: 'SkeletonRoot'
14
13
  })(() => ({}));
@@ -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 react_ui_1 = require("@selfcommunity/react-ui");
8
7
  const react_core_1 = require("@selfcommunity/react-core");
@@ -15,7 +14,7 @@ const classes = {
15
14
  root: `${constants_1.PREFIX}-root`,
16
15
  feed: `${constants_1.PREFIX}-feed`
17
16
  };
18
- const Root = (0, styles_1.styled)(material_1.Box, {
17
+ const Root = (0, material_1.styled)(material_1.Box, {
19
18
  name: constants_1.PREFIX,
20
19
  slot: 'Root'
21
20
  })(() => ({}));
@@ -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 Skeleton_1 = tslib_1.__importDefault(require("../GroupFeed/Skeleton"));
8
7
  const react_ui_1 = require("@selfcommunity/react-ui");
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
  })(() => ({}));