@selfcommunity/react-templates 0.3.55 → 0.4.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/lib/cjs/components/Category/Category.js +3 -5
  2. package/lib/cjs/components/Category/Skeleton.js +2 -4
  3. package/lib/cjs/components/CategoryFeed/CategoryFeed.js +7 -7
  4. package/lib/cjs/components/CategoryFeed/Skeleton.js +2 -5
  5. package/lib/cjs/components/Event/Event.d.ts +77 -0
  6. package/lib/cjs/components/Event/Event.js +62 -0
  7. package/lib/cjs/components/Event/Skeleton.d.ts +21 -0
  8. package/lib/cjs/components/Event/Skeleton.js +40 -0
  9. package/lib/cjs/components/Event/constants.d.ts +1 -0
  10. package/lib/cjs/components/Event/constants.js +4 -0
  11. package/lib/cjs/components/Event/index.d.ts +4 -0
  12. package/lib/cjs/components/Event/index.js +8 -0
  13. package/lib/cjs/components/EventFeed/EventFeed.d.ts +69 -0
  14. package/lib/cjs/components/EventFeed/EventFeed.js +146 -0
  15. package/lib/cjs/components/EventFeed/Skeleton.d.ts +21 -0
  16. package/lib/cjs/components/EventFeed/Skeleton.js +39 -0
  17. package/lib/cjs/components/EventFeed/constants.d.ts +1 -0
  18. package/lib/cjs/components/EventFeed/constants.js +4 -0
  19. package/lib/cjs/components/EventFeed/index.d.ts +4 -0
  20. package/lib/cjs/components/EventFeed/index.js +8 -0
  21. package/lib/cjs/components/ExploreFeed/ExploreFeed.js +23 -4
  22. package/lib/cjs/components/ExploreFeed/Skeleton.js +2 -5
  23. package/lib/cjs/components/FeedObjectDetail/FeedObjectDetail.js +6 -15
  24. package/lib/cjs/components/FeedObjectDetail/Skeleton.js +2 -9
  25. package/lib/cjs/components/Group/Group.js +3 -5
  26. package/lib/cjs/components/Group/Skeleton.js +2 -4
  27. package/lib/cjs/components/GroupFeed/GroupFeed.js +8 -8
  28. package/lib/cjs/components/GroupFeed/Skeleton.js +2 -5
  29. package/lib/cjs/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +6 -35
  30. package/lib/cjs/components/LoyaltyProgramDetail/PointsList.js +4 -17
  31. package/lib/cjs/components/LoyaltyProgramDetail/PrizeItemSkeleton.js +2 -14
  32. package/lib/cjs/components/LoyaltyProgramDetail/Skeleton.js +2 -16
  33. package/lib/cjs/components/MainFeed/MainFeed.js +21 -4
  34. package/lib/cjs/components/MainFeed/Skeleton.js +2 -5
  35. package/lib/cjs/components/NotificationFeed/NotificationFeed.js +3 -2
  36. package/lib/cjs/components/NotificationFeed/Skeleton.js +2 -3
  37. package/lib/cjs/components/UserFeed/Skeleton.js +2 -5
  38. package/lib/cjs/components/UserFeed/UserFeed.js +6 -5
  39. package/lib/cjs/components/UserProfile/Skeleton.js +2 -4
  40. package/lib/cjs/components/UserProfile/UserProfile.js +13 -30
  41. package/lib/cjs/index.d.ts +4 -2
  42. package/lib/cjs/index.js +10 -4
  43. package/lib/esm/components/Category/Category.js +3 -5
  44. package/lib/esm/components/Category/Skeleton.js +2 -4
  45. package/lib/esm/components/CategoryFeed/CategoryFeed.js +7 -7
  46. package/lib/esm/components/CategoryFeed/Skeleton.js +2 -5
  47. package/lib/esm/components/Event/Event.d.ts +77 -0
  48. package/lib/esm/components/Event/Event.js +58 -0
  49. package/lib/esm/components/Event/Skeleton.d.ts +21 -0
  50. package/lib/esm/components/Event/Skeleton.js +36 -0
  51. package/lib/esm/components/Event/constants.d.ts +1 -0
  52. package/lib/esm/components/Event/constants.js +1 -0
  53. package/lib/esm/components/Event/index.d.ts +4 -0
  54. package/lib/esm/components/Event/index.js +4 -0
  55. package/lib/esm/components/EventFeed/EventFeed.d.ts +69 -0
  56. package/lib/esm/components/EventFeed/EventFeed.js +142 -0
  57. package/lib/esm/components/EventFeed/Skeleton.d.ts +21 -0
  58. package/lib/esm/components/EventFeed/Skeleton.js +35 -0
  59. package/lib/esm/components/EventFeed/constants.d.ts +1 -0
  60. package/lib/esm/components/EventFeed/constants.js +1 -0
  61. package/lib/esm/components/EventFeed/index.d.ts +4 -0
  62. package/lib/esm/components/EventFeed/index.js +4 -0
  63. package/lib/esm/components/ExploreFeed/ExploreFeed.js +24 -5
  64. package/lib/esm/components/ExploreFeed/Skeleton.js +2 -5
  65. package/lib/esm/components/FeedObjectDetail/FeedObjectDetail.js +6 -15
  66. package/lib/esm/components/FeedObjectDetail/Skeleton.js +2 -8
  67. package/lib/esm/components/Group/Group.js +3 -5
  68. package/lib/esm/components/Group/Skeleton.js +2 -4
  69. package/lib/esm/components/GroupFeed/GroupFeed.js +8 -8
  70. package/lib/esm/components/GroupFeed/Skeleton.js +2 -5
  71. package/lib/esm/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +6 -35
  72. package/lib/esm/components/LoyaltyProgramDetail/PointsList.js +4 -17
  73. package/lib/esm/components/LoyaltyProgramDetail/PrizeItemSkeleton.js +2 -13
  74. package/lib/esm/components/LoyaltyProgramDetail/Skeleton.js +2 -16
  75. package/lib/esm/components/MainFeed/MainFeed.js +23 -6
  76. package/lib/esm/components/MainFeed/Skeleton.js +2 -5
  77. package/lib/esm/components/NotificationFeed/NotificationFeed.js +3 -2
  78. package/lib/esm/components/NotificationFeed/Skeleton.js +2 -3
  79. package/lib/esm/components/UserFeed/Skeleton.js +2 -5
  80. package/lib/esm/components/UserFeed/UserFeed.js +6 -5
  81. package/lib/esm/components/UserProfile/Skeleton.js +2 -4
  82. package/lib/esm/components/UserProfile/UserProfile.js +13 -30
  83. package/lib/esm/index.d.ts +4 -2
  84. package/lib/esm/index.js +4 -2
  85. package/lib/umd/341.js +2 -0
  86. package/lib/umd/{138.js.LICENSE.txt → 341.js.LICENSE.txt} +15 -0
  87. package/lib/umd/react-templates.js +1 -1
  88. package/package.json +6 -6
  89. package/lib/umd/138.js +0 -2
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
5
  const react_1 = tslib_1.__importDefault(require("react"));
5
6
  const styles_1 = require("@mui/material/styles");
6
7
  const react_ui_1 = require("@selfcommunity/react-ui");
@@ -33,10 +34,6 @@ const Root = (0, styles_1.styled)(react_ui_1.FeedSkeleton, {
33
34
  *
34
35
  */
35
36
  function UserFeedSkeleton() {
36
- return (react_1.default.createElement(Root, { className: classes.root, sidebar: react_1.default.createElement(react_1.default.Fragment, null,
37
- react_1.default.createElement(react_ui_1.GenericSkeleton, { sx: { mb: 2 } }),
38
- react_1.default.createElement(react_ui_1.GenericSkeleton, { sx: { mb: 2 } })) },
39
- react_1.default.createElement(react_ui_1.InlineComposerWidgetSkeleton, null),
40
- Array.from({ length: 5 }).map((e, i) => (react_1.default.createElement(react_ui_1.FeedObjectSkeleton, { key: i, template: react_ui_1.SCFeedObjectTemplateType.DETAIL })))));
37
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root, sidebar: (0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.GenericSkeleton, { sx: { mb: 2 } }), (0, jsx_runtime_1.jsx)(react_ui_1.GenericSkeleton, { sx: { mb: 2 } })] }) }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidgetSkeleton, {}), Array.from({ length: 5 }).map((e, i) => ((0, jsx_runtime_1.jsx)(react_ui_1.FeedObjectSkeleton, { template: react_ui_1.SCFeedObjectTemplateType.DETAIL }, i)))] })));
41
38
  }
42
39
  exports.default = UserFeedSkeleton;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const react_1 = tslib_1.__importStar(require("react"));
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
5
6
  const styles_1 = require("@mui/material/styles");
6
7
  const api_services_1 = require("@selfcommunity/api-services");
7
8
  const react_core_1 = require("@selfcommunity/react-core");
@@ -84,7 +85,7 @@ function UserFeed(inProps) {
84
85
  const feedRef = (0, react_1.useRef)();
85
86
  // HANDLERS
86
87
  const handleComposerSuccess = (feedObject) => {
87
- enqueueSnackbar(react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.success", defaultMessage: "ui.inlineComposerWidget.success" }), {
88
+ enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.success", defaultMessage: "ui.inlineComposerWidget.success" }), {
88
89
  variant: 'success',
89
90
  autoHideDuration: 3000
90
91
  });
@@ -102,14 +103,14 @@ function UserFeed(inProps) {
102
103
  return Object.assign(Object.assign({}, w), { componentProps: Object.assign(Object.assign({}, w.componentProps), { userId: scUser ? scUser.id : userId }) });
103
104
  }), [scUser, widgets]);
104
105
  if (scUser === null) {
105
- return react_1.default.createElement(index_1.UserFeedSkeleton, null);
106
+ return (0, jsx_runtime_1.jsx)(index_1.UserFeedSkeleton, {});
106
107
  }
107
- return (react_1.default.createElement(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) => ({
108
+ 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) => ({
108
109
  feedObject: item[item.type],
109
110
  feedObjectType: item.type,
110
111
  feedObjectActivities: item.activities ? item.activities : null
111
112
  }), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
112
113
  template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
113
- } }, (scUserContext.user ? { HeaderComponent: react_1.default.createElement(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }) } : {}), { FeedSidebarProps: FeedSidebarProps }, FeedProps)));
114
+ } }, (scUserContext.user ? { HeaderComponent: (0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }) } : {}), { FeedSidebarProps: FeedSidebarProps }, FeedProps)));
114
115
  }
115
116
  exports.default = UserFeed;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const react_1 = tslib_1.__importDefault(require("react"));
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const styles_1 = require("@mui/material/styles");
7
7
  const react_ui_1 = require("@selfcommunity/react-ui");
@@ -35,8 +35,6 @@ const Root = (0, styles_1.styled)(material_1.Box, {
35
35
  *
36
36
  */
37
37
  function UserProfileSkeleton() {
38
- return (react_1.default.createElement(Root, { className: classes.root },
39
- react_1.default.createElement(react_ui_1.UserProfileHeaderSkeleton, null),
40
- react_1.default.createElement(Skeleton_1.default, null)));
38
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.UserProfileHeaderSkeleton, {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, {})] })));
41
39
  }
42
40
  exports.default = UserProfileSkeleton;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const react_1 = tslib_1.__importStar(require("react"));
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
5
6
  const styles_1 = require("@mui/material/styles");
6
7
  const material_1 = require("@mui/material");
7
8
  const react_ui_1 = require("@selfcommunity/react-ui");
@@ -205,7 +206,7 @@ function UserProfile(inProps) {
205
206
  }
206
207
  }, [isConnection, scUserContext.managers.followers, scUserContext.managers.connections, followEnabled, isMe, user, scUserContext.user]);
207
208
  if (!scUser) {
208
- return react_1.default.createElement(Skeleton_1.default, null);
209
+ return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
209
210
  }
210
211
  // HANDLERS
211
212
  const handleEdit = () => {
@@ -219,37 +220,19 @@ function UserProfile(inProps) {
219
220
  if (privateMessagingEnabled && !isMe && user && user.can_send_pm_to) {
220
221
  actionItems = [
221
222
  {
222
- label: react_1.default.createElement(react_intl_1.FormattedMessage, { defaultMessage: "templates.userProfile.send.pm", id: "templates.userProfile.send.pm" }),
223
+ label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "templates.userProfile.send.pm", id: "templates.userProfile.send.pm" }),
223
224
  to: scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, scUser)
224
225
  }
225
226
  ];
226
227
  }
227
- return (react_1.default.createElement(Root, { id: id, className: (0, classnames_1.default)(classes.root, className) },
228
- react_1.default.createElement(react_ui_1.UserProfileHeader, Object.assign({ user: scUser }, UserProfileHeaderProps, { actions: !isMe && scUser && Boolean((scUserContext.user && scUserContext.managers.blockedUsers.isBlocked(scUser)) || blockedBy) ? null : (react_1.default.createElement(material_1.Stack, { key: `actions_${scUser.id}`, direction: "row", spacing: 2, className: classes.actions },
229
- startActions,
230
- isMe ? editStartActions : viewStartActions,
231
- isMe ? (react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: handleEdit },
232
- react_1.default.createElement(react_intl_1.FormattedMessage, { defaultMessage: "templates.userProfile.edit", id: "templates.userProfile.edit" }))) : (react_1.default.createElement(react_ui_1.ConnectionUserButton, { user: scUser })),
233
- isMe ? editEndActions : viewEndActions,
234
- endActions,
235
- react_1.default.createElement(react_ui_1.UserActionIconButton, { user: scUser, items: actionItems }))) })),
236
- scUserContext.user === undefined ||
237
- (scUserContext.user && ((loadingBlockedBy && blockedBy === null) || scUserContext.managers.blockedUsers.isLoading())) ? (react_1.default.createElement(Skeleton_2.default, null)) : (react_1.default.createElement(react_1.default.Fragment, null, loadingBlockedBy || (scUserContext.user && scUserContext.managers.blockedUsers.loading) ? null : (react_1.default.createElement(react_1.default.Fragment, null, !isMe && scUser && Boolean((scUserContext.user && scUserContext.managers.blockedUsers.isBlocked(scUser)) || blockedBy) ? (react_1.default.createElement(react_ui_1.UserProfileBlocked, { user: scUser, blockedByUser: blockedBy })) : (react_1.default.createElement(react_1.default.Fragment, null,
238
- react_1.default.createElement(react_ui_1.UserCounters, { className: classes.counters, userId: userId, user: scUser }),
239
- scUser.date_joined && (react_1.default.createElement(material_1.Typography, { className: classes.info },
240
- react_1.default.createElement(react_intl_1.FormattedMessage, { id: "templates.userProfile.dateJoined", defaultMessage: "templates.userProfile.dateJoined", values: {
241
- date: intl.formatDate(scUser.date_joined, {
242
- year: 'numeric',
243
- month: 'long'
244
- })
245
- } }))),
246
- scUser.location && (react_1.default.createElement(material_1.Typography, { className: classes.info },
247
- react_1.default.createElement(material_1.Icon, null, "add_location_alt"),
248
- " ",
249
- scUser.location)),
250
- taggingEnabled && (react_1.default.createElement(material_1.Stack, { key: `tags_${scUser.id}`, direction: "row", spacing: 2, className: classes.tags }, scUser.tags
251
- .filter((t) => t.visible)
252
- .map((tag) => (react_1.default.createElement(react_ui_1.TagChip, { key: tag.id, tag: tag, clickable: false, disposable: false }))))),
253
- react_1.default.createElement(UserFeed_1.default, Object.assign({ key: `feed_${scUser.id}`, className: classes.feed, user: scUser, widgets: _widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, UserFeedProps))))))))));
228
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.UserProfileHeader, Object.assign({ user: scUser }, UserProfileHeaderProps, { actions: !isMe && scUser && Boolean((scUserContext.user && scUserContext.managers.blockedUsers.isBlocked(scUser)) || blockedBy) ? null : ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 2, className: classes.actions }, { children: [startActions, isMe ? editStartActions : viewStartActions, isMe ? ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", color: "secondary", onClick: handleEdit }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "templates.userProfile.edit", id: "templates.userProfile.edit" }) }))) : ((0, jsx_runtime_1.jsx)(react_ui_1.ConnectionUserButton, { user: scUser })), isMe ? editEndActions : viewEndActions, endActions, (0, jsx_runtime_1.jsx)(react_ui_1.UserActionIconButton, { user: scUser, items: actionItems })] }), `actions_${scUser.id}`)) })), scUserContext.user === undefined ||
229
+ (scUserContext.user && ((loadingBlockedBy && blockedBy === null) || scUserContext.managers.blockedUsers.isLoading())) ? ((0, jsx_runtime_1.jsx)(Skeleton_2.default, {})) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loadingBlockedBy || (scUserContext.user && scUserContext.managers.blockedUsers.loading) ? null : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !isMe && scUser && Boolean((scUserContext.user && scUserContext.managers.blockedUsers.isBlocked(scUser)) || blockedBy) ? ((0, jsx_runtime_1.jsx)(react_ui_1.UserProfileBlocked, { user: scUser, blockedByUser: blockedBy })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.UserCounters, { className: classes.counters, userId: userId, user: scUser }), scUser.date_joined && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.info }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.userProfile.dateJoined", defaultMessage: "templates.userProfile.dateJoined", values: {
230
+ date: intl.formatDate(scUser.date_joined, {
231
+ year: 'numeric',
232
+ month: 'long'
233
+ })
234
+ } }) }))), 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
235
+ .filter((t) => t.visible)
236
+ .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}`)] })) })) }))] })));
254
237
  }
255
238
  exports.default = UserProfile;
@@ -7,6 +7,8 @@ import NotificationFeed, { NotificationFeedProps, NotificationFeedSkeleton } fro
7
7
  import UserFeed, { UserFeedProps, UserFeedSkeleton } from './components/UserFeed';
8
8
  import UserProfile, { UserProfileProps, UserProfileSkeleton } from './components/UserProfile';
9
9
  import LoyaltyProgramDetail, { LoyaltyProgramDetailProps, LoyaltyProgramDetailSkeleton } from './components/LoyaltyProgramDetail';
10
- import GroupFeed, { GroupFeedProps, GroupFeedSkeleton } from './components/GroupFeed';
11
10
  import Group, { GroupProps, GroupSkeleton } from './components/Group';
12
- export { Category, CategoryProps, CategorySkeleton, CategoryFeed, CategoryFeedProps, CategoryFeedSkeleton, ExploreFeed, ExploreFeedProps, ExploreFeedSkeleton, FeedObjectDetail, FeedObjectDetailProps, FeedObjectDetailSkeleton, MainFeed, MainFeedProps, MainFeedSkeleton, NotificationFeed, NotificationFeedProps, NotificationFeedSkeleton, UserFeed, UserFeedProps, UserFeedSkeleton, UserProfile, UserProfileProps, UserProfileSkeleton, LoyaltyProgramDetail, LoyaltyProgramDetailProps, LoyaltyProgramDetailSkeleton, GroupFeed, GroupFeedProps, GroupFeedSkeleton, Group, GroupProps, GroupSkeleton };
11
+ import GroupFeed, { GroupFeedProps, GroupFeedSkeleton } from './components/GroupFeed';
12
+ import Event, { EventProps, EventSkeleton } from './components/Event';
13
+ import EventFeed, { EventFeedProps, EventFeedSkeleton } from './components/EventFeed';
14
+ export { Category, CategoryProps, CategorySkeleton, CategoryFeed, CategoryFeedProps, CategoryFeedSkeleton, ExploreFeed, ExploreFeedProps, ExploreFeedSkeleton, FeedObjectDetail, FeedObjectDetailProps, FeedObjectDetailSkeleton, MainFeed, MainFeedProps, MainFeedSkeleton, NotificationFeed, NotificationFeedProps, NotificationFeedSkeleton, UserFeed, UserFeedProps, UserFeedSkeleton, UserProfile, UserProfileProps, UserProfileSkeleton, LoyaltyProgramDetail, LoyaltyProgramDetailProps, LoyaltyProgramDetailSkeleton, GroupFeed, GroupFeedProps, GroupFeedSkeleton, Group, GroupProps, GroupSkeleton, Event, EventProps, EventSkeleton, EventFeed, EventFeedProps, EventFeedSkeleton };
package/lib/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GroupSkeleton = exports.Group = exports.GroupFeedSkeleton = exports.GroupFeed = exports.LoyaltyProgramDetailSkeleton = exports.LoyaltyProgramDetail = exports.UserProfileSkeleton = exports.UserProfile = exports.UserFeedSkeleton = exports.UserFeed = exports.NotificationFeedSkeleton = exports.NotificationFeed = exports.MainFeedSkeleton = exports.MainFeed = exports.FeedObjectDetailSkeleton = exports.FeedObjectDetail = exports.ExploreFeedSkeleton = exports.ExploreFeed = exports.CategoryFeedSkeleton = exports.CategoryFeed = exports.CategorySkeleton = exports.Category = void 0;
3
+ exports.EventFeedSkeleton = exports.EventFeed = exports.EventSkeleton = exports.Event = exports.GroupSkeleton = exports.Group = exports.GroupFeedSkeleton = exports.GroupFeed = exports.LoyaltyProgramDetailSkeleton = exports.LoyaltyProgramDetail = exports.UserProfileSkeleton = exports.UserProfile = exports.UserFeedSkeleton = exports.UserFeed = exports.NotificationFeedSkeleton = exports.NotificationFeed = exports.MainFeedSkeleton = exports.MainFeed = exports.FeedObjectDetailSkeleton = exports.FeedObjectDetail = exports.ExploreFeedSkeleton = exports.ExploreFeed = exports.CategoryFeedSkeleton = exports.CategoryFeed = exports.CategorySkeleton = exports.Category = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Category_1 = tslib_1.__importStar(require("./components/Category"));
6
6
  exports.Category = Category_1.default;
@@ -29,9 +29,15 @@ Object.defineProperty(exports, "UserProfileSkeleton", { enumerable: true, get: f
29
29
  const LoyaltyProgramDetail_1 = tslib_1.__importStar(require("./components/LoyaltyProgramDetail"));
30
30
  exports.LoyaltyProgramDetail = LoyaltyProgramDetail_1.default;
31
31
  Object.defineProperty(exports, "LoyaltyProgramDetailSkeleton", { enumerable: true, get: function () { return LoyaltyProgramDetail_1.LoyaltyProgramDetailSkeleton; } });
32
- const GroupFeed_1 = tslib_1.__importStar(require("./components/GroupFeed"));
33
- exports.GroupFeed = GroupFeed_1.default;
34
- Object.defineProperty(exports, "GroupFeedSkeleton", { enumerable: true, get: function () { return GroupFeed_1.GroupFeedSkeleton; } });
35
32
  const Group_1 = tslib_1.__importStar(require("./components/Group"));
36
33
  exports.Group = Group_1.default;
37
34
  Object.defineProperty(exports, "GroupSkeleton", { enumerable: true, get: function () { return Group_1.GroupSkeleton; } });
35
+ const GroupFeed_1 = tslib_1.__importStar(require("./components/GroupFeed"));
36
+ exports.GroupFeed = GroupFeed_1.default;
37
+ Object.defineProperty(exports, "GroupFeedSkeleton", { enumerable: true, get: function () { return GroupFeed_1.GroupFeedSkeleton; } });
38
+ const Event_1 = tslib_1.__importStar(require("./components/Event"));
39
+ exports.Event = Event_1.default;
40
+ Object.defineProperty(exports, "EventSkeleton", { enumerable: true, get: function () { return Event_1.EventSkeleton; } });
41
+ const EventFeed_1 = tslib_1.__importStar(require("./components/EventFeed"));
42
+ exports.EventFeed = EventFeed_1.default;
43
+ Object.defineProperty(exports, "EventFeedSkeleton", { enumerable: true, get: function () { return EventFeed_1.EventFeedSkeleton; } });
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { styled } from '@mui/material/styles';
3
3
  import { Box } from '@mui/material';
4
4
  import { CategoryHeader } from '@selfcommunity/react-ui';
@@ -52,9 +52,7 @@ export default function Category(inProps) {
52
52
  // Hooks
53
53
  const { scCategory } = useSCFetchCategory({ id: categoryId, category });
54
54
  if (!scCategory) {
55
- return React.createElement(CategorySkeleton, null);
55
+ return _jsx(CategorySkeleton, {});
56
56
  }
57
- return (React.createElement(Root, { id: id, className: classNames(classes.root, className) },
58
- React.createElement(CategoryHeader, { category: scCategory }),
59
- React.createElement(CategoryFeed, Object.assign({ className: classes.feed, category: scCategory, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, CategoryFeedProps))));
57
+ return (_jsxs(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, { children: [_jsx(CategoryHeader, { category: scCategory }), _jsx(CategoryFeed, Object.assign({ className: classes.feed, category: scCategory, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, CategoryFeedProps))] })));
60
58
  }
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box } from '@mui/material';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import CategoryFeedSkeleton from '../CategoryFeed/Skeleton';
@@ -32,7 +32,5 @@ const Root = styled(Box, {
32
32
  *
33
33
  */
34
34
  export default function CategorySkeleton() {
35
- return (React.createElement(Root, { className: classes.root },
36
- React.createElement(CategoryHeaderSkeleton, null),
37
- React.createElement(CategoryFeedSkeleton, null)));
35
+ return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [_jsx(CategoryHeaderSkeleton, {}), _jsx(CategoryFeedSkeleton, {})] })));
38
36
  }
@@ -1,4 +1,5 @@
1
- import React, { useMemo, useRef } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo, useRef } from 'react';
2
3
  import { styled } from '@mui/material/styles';
3
4
  import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
4
5
  import { Endpoints } from '@selfcommunity/api-services';
@@ -77,9 +78,8 @@ export default function CategoryFeed(inProps) {
77
78
  const handleComposerSuccess = (feedObject) => {
78
79
  // Not insert if the category does not match
79
80
  if (feedObject.categories.findIndex((c) => c.id === scCategory.id) === -1) {
80
- enqueueSnackbar(React.createElement(FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
81
- action: (snackbarId) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], ContributionUtils.getRouteData(feedObject)) },
82
- React.createElement(FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }))),
81
+ enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
82
+ 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" }) }))),
83
83
  variant: 'success',
84
84
  autoHideDuration: 7000
85
85
  });
@@ -102,16 +102,16 @@ export default function CategoryFeed(inProps) {
102
102
  return w;
103
103
  }), [widgets, scCategory]);
104
104
  if (!scCategory) {
105
- return React.createElement(CategoryFeedSkeleton, null);
105
+ return _jsx(CategoryFeedSkeleton, {});
106
106
  }
107
- return (React.createElement(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) => ({
107
+ 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) => ({
108
108
  feedObject: item[item.type],
109
109
  feedObjectType: item.type,
110
110
  feedObjectActivities: item.activities ? item.activities : null,
111
111
  markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
112
112
  }), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
113
113
  template: SCFeedObjectTemplateType.PREVIEW
114
- }, FeedSidebarProps: FeedSidebarProps, HeaderComponent: React.createElement(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: SCFeedTypologyType.CATEGORY }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
114
+ }, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: SCFeedTypologyType.CATEGORY }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
115
115
  SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
116
116
  SCCustomAdvPosition.POSITION_FEED,
117
117
  SCCustomAdvPosition.POSITION_BELOW_TOPBAR
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import React from 'react';
2
3
  import { styled } from '@mui/material/styles';
3
4
  import { FeedObjectSkeleton, SCFeedObjectTemplateType, FeedSkeleton, GenericSkeleton, InlineComposerWidgetSkeleton } from '@selfcommunity/react-ui';
@@ -30,9 +31,5 @@ const Root = styled(FeedSkeleton, {
30
31
  *
31
32
  */
32
33
  export default function CategoryFeedSkeleton() {
33
- return (React.createElement(Root, { className: classes.root, sidebar: React.createElement(React.Fragment, null,
34
- React.createElement(GenericSkeleton, { sx: { mb: 2 } }),
35
- React.createElement(GenericSkeleton, { sx: { mb: 2 } })) },
36
- React.createElement(InlineComposerWidgetSkeleton, null),
37
- Array.from({ length: 5 }).map((e, i) => (React.createElement(FeedObjectSkeleton, { key: i, template: SCFeedObjectTemplateType.DETAIL })))));
34
+ return (_jsxs(Root, Object.assign({ className: classes.root, sidebar: _jsxs(React.Fragment, { children: [_jsx(GenericSkeleton, { sx: { mb: 2 } }), _jsx(GenericSkeleton, { sx: { mb: 2 } })] }) }, { children: [_jsx(InlineComposerWidgetSkeleton, {}), Array.from({ length: 5 }).map((e, i) => (_jsx(FeedObjectSkeleton, { template: SCFeedObjectTemplateType.DETAIL }, i)))] })));
38
35
  }
@@ -0,0 +1,77 @@
1
+ import { FeedObjectProps, FeedSidebarProps, SCFeedWidgetType, EventHeaderProps } from '@selfcommunity/react-ui';
2
+ import { SCEventType } from '@selfcommunity/types';
3
+ import { EventFeedProps } from '../EventFeed';
4
+ export interface EventProps {
5
+ /**
6
+ * Id of the feed object
7
+ * @default 'feed'
8
+ */
9
+ id?: string;
10
+ /**
11
+ * Overrides or extends the styles applied to the component.
12
+ * @default null
13
+ */
14
+ className?: string;
15
+ /**
16
+ * Event Object
17
+ * @default null
18
+ */
19
+ event?: SCEventType;
20
+ /**
21
+ * Id of the event for filter the feed
22
+ * @default null
23
+ */
24
+ eventId?: number;
25
+ /**
26
+ * Widgets to be rendered into the feed
27
+ * @default []
28
+ */
29
+ widgets?: SCFeedWidgetType[] | null;
30
+ /**
31
+ * Props to spread to single feed object
32
+ * @default empty object
33
+ */
34
+ FeedObjectProps?: FeedObjectProps;
35
+ /**
36
+ * Props to spread to single feed object
37
+ * @default {top: 0, bottomBoundary: `#${id}`}
38
+ */
39
+ FeedSidebarProps?: FeedSidebarProps;
40
+ /**
41
+ * Props to spread to EventFeed component
42
+ * @default {}
43
+ */
44
+ EventFeedProps?: EventFeedProps;
45
+ /**
46
+ * Props to spread EventHeader component
47
+ * @default {}
48
+ */
49
+ EventHeaderProps?: EventHeaderProps;
50
+ }
51
+ /**
52
+ * > API documentation for the Community-JS Category Template. Learn about the available props and the CSS API.
53
+ *
54
+ *
55
+ * This component renders a specific event's template.
56
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-templates/Components/Group)
57
+
58
+ #### Import
59
+
60
+ ```jsx
61
+ import {Group} from '@selfcommunity/react-templates';
62
+ ```
63
+
64
+ #### Component Name
65
+
66
+ The name `SCGroupTemplate` can be used when providing style overrides in the theme.
67
+
68
+ #### CSS
69
+
70
+ |Rule Name|Global class|Description|
71
+ |---|---|---|
72
+ |root|.SCGroupTemplate-root|Styles applied to the root element.|
73
+ |feed|.SCGroupTemplate-feed|Styles applied to the feed element.|
74
+ *
75
+ * @param inProps
76
+ */
77
+ export default function Event(inProps: EventProps): JSX.Element;
@@ -0,0 +1,58 @@
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';
4
+ import { EventHeader } from '@selfcommunity/react-ui';
5
+ import { useSCFetchEvent } from '@selfcommunity/react-core';
6
+ import EventSkeletonTemplate from './Skeleton';
7
+ import { useThemeProps } from '@mui/system';
8
+ import classNames from 'classnames';
9
+ import { PREFIX } from './constants';
10
+ import EventFeed from '../EventFeed';
11
+ const classes = {
12
+ root: `${PREFIX}-root`,
13
+ feed: `${PREFIX}-feed`
14
+ };
15
+ const Root = styled(Box, {
16
+ name: PREFIX,
17
+ slot: 'Root'
18
+ })(() => ({}));
19
+ /**
20
+ * > API documentation for the Community-JS Category Template. Learn about the available props and the CSS API.
21
+ *
22
+ *
23
+ * This component renders a specific event's template.
24
+ * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-templates/Components/Group)
25
+
26
+ #### Import
27
+
28
+ ```jsx
29
+ import {Group} from '@selfcommunity/react-templates';
30
+ ```
31
+
32
+ #### Component Name
33
+
34
+ The name `SCGroupTemplate` can be used when providing style overrides in the theme.
35
+
36
+ #### CSS
37
+
38
+ |Rule Name|Global class|Description|
39
+ |---|---|---|
40
+ |root|.SCGroupTemplate-root|Styles applied to the root element.|
41
+ |feed|.SCGroupTemplate-feed|Styles applied to the feed element.|
42
+ *
43
+ * @param inProps
44
+ */
45
+ export default function Event(inProps) {
46
+ // PROPS
47
+ const props = useThemeProps({
48
+ props: inProps,
49
+ name: PREFIX
50
+ });
51
+ const { id = 'event', className, event, eventId, widgets, FeedObjectProps, FeedSidebarProps, EventFeedProps = {}, EventHeaderProps = {} } = props;
52
+ // HOOKS
53
+ const { scEvent } = useSCFetchEvent({ id: eventId, event });
54
+ if (!scEvent) {
55
+ return _jsx(EventSkeletonTemplate, {});
56
+ }
57
+ return (_jsxs(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, { children: [_jsx(EventHeader, Object.assign({ event: scEvent }, EventHeaderProps)), _jsx(EventFeed, Object.assign({ className: classes.feed, event: scEvent, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, EventFeedProps))] })));
58
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * > API documentation for the Community-JS Group Skeleton Template. Learn about the available props and the CSS API.
3
+
4
+ #### Import
5
+
6
+ ```jsx
7
+ import {EventSkeletonTemplate} from '@selfcommunity/react-templates';
8
+ ```
9
+
10
+ #### Component Name
11
+
12
+ The name `SCEventTemplate-skeleton-root` can be used when providing style overrides in the theme.
13
+
14
+ #### CSS
15
+
16
+ |Rule Name|Global class|Description|
17
+ |---|---|---|
18
+ |root|.SCEventTemplate-skeleton-root|Styles applied to the root element.|
19
+ *
20
+ */
21
+ export default function EventSkeletonTemplate(): JSX.Element;
@@ -0,0 +1,36 @@
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';
4
+ import EventFeedSkeleton from '../EventFeed/Skeleton';
5
+ import { EventHeaderSkeleton } from '@selfcommunity/react-ui';
6
+ import { PREFIX } from './constants';
7
+ const classes = {
8
+ root: `${PREFIX}-skeleton-root`
9
+ };
10
+ const Root = styled(Box, {
11
+ name: PREFIX,
12
+ slot: 'SkeletonRoot'
13
+ })(() => ({}));
14
+ /**
15
+ * > API documentation for the Community-JS Group Skeleton Template. Learn about the available props and the CSS API.
16
+
17
+ #### Import
18
+
19
+ ```jsx
20
+ import {EventSkeletonTemplate} from '@selfcommunity/react-templates';
21
+ ```
22
+
23
+ #### Component Name
24
+
25
+ The name `SCEventTemplate-skeleton-root` can be used when providing style overrides in the theme.
26
+
27
+ #### CSS
28
+
29
+ |Rule Name|Global class|Description|
30
+ |---|---|---|
31
+ |root|.SCEventTemplate-skeleton-root|Styles applied to the root element.|
32
+ *
33
+ */
34
+ export default function EventSkeletonTemplate() {
35
+ return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [_jsx(EventHeaderSkeleton, {}), _jsx(EventFeedSkeleton, {})] })));
36
+ }
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCEventTemplate";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCEventTemplate';
@@ -0,0 +1,4 @@
1
+ import EventSkeleton from './Skeleton';
2
+ import Event, { EventProps } from './Event';
3
+ export default Event;
4
+ export { EventProps, EventSkeleton };
@@ -0,0 +1,4 @@
1
+ import EventSkeleton from './Skeleton';
2
+ import Event from './Event';
3
+ export default Event;
4
+ export { EventSkeleton };
@@ -0,0 +1,69 @@
1
+ import { FeedObjectProps, FeedProps, FeedSidebarProps, SCFeedWidgetType } from '@selfcommunity/react-ui';
2
+ import { SCEventType } from '@selfcommunity/types';
3
+ export interface EventFeedProps {
4
+ /**
5
+ * Id of the feed object
6
+ * @default 'feed'
7
+ */
8
+ id?: string;
9
+ /**
10
+ * Overrides or extends the styles applied to the component.
11
+ * @default null
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Event Object
16
+ * @default null
17
+ */
18
+ event?: SCEventType;
19
+ /**
20
+ * Id of the event for filter the feed
21
+ * @default null
22
+ */
23
+ eventId?: number;
24
+ /**
25
+ * Widgets to be rendered into the feed
26
+ * @default [EventInfoWidget]
27
+ */
28
+ widgets?: SCFeedWidgetType[] | null;
29
+ /**
30
+ * Props to spread to single feed object
31
+ * @default empty object
32
+ */
33
+ FeedObjectProps?: FeedObjectProps;
34
+ /**
35
+ * Props to spread to single feed object
36
+ * @default {top: 0, bottomBoundary: `#${id}`}
37
+ */
38
+ FeedSidebarProps?: FeedSidebarProps;
39
+ /**
40
+ * Props to spread to feed component
41
+ * @default {}
42
+ */
43
+ FeedProps?: Omit<FeedProps, 'endpoint' | 'widgets' | 'ItemComponent' | 'itemPropsGenerator' | 'itemIdGenerator' | 'ItemSkeleton' | 'ItemSkeletonProps' | 'FeedSidebarProps'>;
44
+ }
45
+ /**
46
+ * > API documentation for the Community-JS Group Feed Template. Learn about the available props and the CSS API.
47
+ *
48
+ *
49
+ * This component renders a specific event's feed.
50
+
51
+ #### Import
52
+
53
+ ```jsx
54
+ import {EventFeed} from '@selfcommunity/react-templates';
55
+ ```
56
+
57
+ #### Component Name
58
+
59
+ The name `SCEventFeedTemplate` can be used when providing style overrides in the theme.
60
+
61
+ #### CSS
62
+
63
+ |Rule Name|Global class|Description|
64
+ |---|---|---|
65
+ |root|.SCEventFeedTemplate-root|Styles applied to the root element.|
66
+ *
67
+ * @param inProps
68
+ */
69
+ export default function EventFeed(inProps: EventFeedProps): JSX.Element;