@selfcommunity/react-templates 0.3.56-alpha.0 → 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
@@ -0,0 +1,142 @@
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';
4
+ import { ContributionUtils, EventInfoWidget, EventLocationWidget, EventMembersWidget, Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, RelatedEventsWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
5
+ import { Endpoints } from '@selfcommunity/api-services';
6
+ import { Link, SCRoutes, useSCFetchEvent, useSCRouting, useSCUser } from '@selfcommunity/react-core';
7
+ import { SCCustomAdvPosition, SCEventPrivacyType, SCEventSubscriptionStatusType, SCFeedTypologyType } from '@selfcommunity/types';
8
+ import { useThemeProps } from '@mui/system';
9
+ import classNames from 'classnames';
10
+ import { FormattedMessage } from 'react-intl';
11
+ import { useSnackbar } from 'notistack';
12
+ import { PREFIX } from './constants';
13
+ import EventFeedSkeleton from './Skeleton';
14
+ import { Box } from '@mui/material';
15
+ const classes = {
16
+ root: `${PREFIX}-root`
17
+ };
18
+ const Root = styled(Feed, {
19
+ name: PREFIX,
20
+ slot: 'Root'
21
+ })(() => ({}));
22
+ // Widgets for feed
23
+ const WIDGETS = [
24
+ {
25
+ type: 'widget',
26
+ component: EventLocationWidget,
27
+ componentProps: {},
28
+ column: 'right',
29
+ position: 0
30
+ },
31
+ {
32
+ type: 'widget',
33
+ component: EventMembersWidget,
34
+ componentProps: {},
35
+ column: 'right',
36
+ position: 1
37
+ },
38
+ {
39
+ type: 'widget',
40
+ component: RelatedEventsWidget,
41
+ componentProps: {},
42
+ column: 'right',
43
+ position: 2
44
+ }
45
+ ];
46
+ /**
47
+ * > API documentation for the Community-JS Group Feed Template. Learn about the available props and the CSS API.
48
+ *
49
+ *
50
+ * This component renders a specific event's feed.
51
+
52
+ #### Import
53
+
54
+ ```jsx
55
+ import {EventFeed} from '@selfcommunity/react-templates';
56
+ ```
57
+
58
+ #### Component Name
59
+
60
+ The name `SCEventFeedTemplate` can be used when providing style overrides in the theme.
61
+
62
+ #### CSS
63
+
64
+ |Rule Name|Global class|Description|
65
+ |---|---|---|
66
+ |root|.SCEventFeedTemplate-root|Styles applied to the root element.|
67
+ *
68
+ * @param inProps
69
+ */
70
+ export default function EventFeed(inProps) {
71
+ // PROPS
72
+ const props = useThemeProps({
73
+ props: inProps,
74
+ name: PREFIX
75
+ });
76
+ const { id = 'event_feed', className, event, eventId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
77
+ // CONTEXT
78
+ const scRoutingContext = useSCRouting();
79
+ const scUserContext = useSCUser();
80
+ const { enqueueSnackbar } = useSnackbar();
81
+ // REF
82
+ const feedRef = useRef();
83
+ // Hooks
84
+ const { scEvent, setSCEvent } = useSCFetchEvent({ id: eventId, event });
85
+ // HANDLERS
86
+ const handleComposerSuccess = (feedObject) => {
87
+ var _a;
88
+ enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
89
+ 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" }) }))),
90
+ variant: 'success',
91
+ autoHideDuration: 7000
92
+ });
93
+ if (((_a = feedObject.event) === null || _a === void 0 ? void 0 : _a.id) === scEvent.id) {
94
+ // Hydrate feedUnit
95
+ const feedUnit = {
96
+ type: feedObject.type,
97
+ [feedObject.type]: feedObject,
98
+ seen_by_id: [],
99
+ has_boost: false
100
+ };
101
+ feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
102
+ }
103
+ };
104
+ // WIDGETS
105
+ const _widgets = useMemo(() => widgets.map((w) => {
106
+ if (scEvent) {
107
+ return Object.assign(Object.assign({}, w), { componentProps: Object.assign(Object.assign({}, w.componentProps), { eventId: scEvent.id }) });
108
+ }
109
+ return w;
110
+ }), [widgets, scEvent]);
111
+ if (!scEvent) {
112
+ return _jsx(EventFeedSkeleton, {});
113
+ }
114
+ else if (scEvent.privacy === SCEventPrivacyType.PRIVATE &&
115
+ scEvent.subscription_status !== SCEventSubscriptionStatusType.SUBSCRIBED &&
116
+ scEvent.subscription_status !== SCEventSubscriptionStatusType.INVITED &&
117
+ scEvent.subscription_status !== SCEventSubscriptionStatusType.GOING &&
118
+ scEvent.subscription_status !== SCEventSubscriptionStatusType.NOT_GOING) {
119
+ return (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(EventInfoWidget, { className: classes.root, event: scEvent }) })));
120
+ }
121
+ 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) => {
122
+ var _a;
123
+ return ({
124
+ feedObject: item[item.type],
125
+ feedObjectType: item.type,
126
+ feedObjectActivities: item.activities ? item.activities : null,
127
+ 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
128
+ });
129
+ }, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
130
+ template: SCFeedObjectTemplateType.PREVIEW
131
+ }, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(EventInfoWidget, { className: classes.root, event: scEvent }), Boolean(scEvent &&
132
+ ((!scUserContext.user && scEvent.privacy === SCEventPrivacyType.PUBLIC) ||
133
+ (scUserContext.user &&
134
+ (scEvent.subscription_status === SCEventSubscriptionStatusType.SUBSCRIBED ||
135
+ scEvent.subscription_status === SCEventSubscriptionStatusType.INVITED ||
136
+ scEvent.subscription_status === SCEventSubscriptionStatusType.GOING ||
137
+ 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: [
138
+ SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
139
+ SCCustomAdvPosition.POSITION_FEED,
140
+ SCCustomAdvPosition.POSITION_BELOW_TOPBAR
141
+ ] }, FeedProps)));
142
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * > API documentation for the Community-JS Group Feed Skeleton Template. Learn about the available props and the CSS API.
3
+
4
+ #### Import
5
+
6
+ ```jsx
7
+ import {GroupFeedSkeleton} from '@selfcommunity/react-templates';
8
+ ```
9
+
10
+ #### Component Name
11
+
12
+ The name `SCGroupFeedTemplate-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|.SCGroupFeedTemplate-skeleton-root|Styles applied to the root element.|
19
+ *
20
+ */
21
+ export default function EventFeedSkeleton(): JSX.Element;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import { FeedObjectSkeleton, SCFeedObjectTemplateType, FeedSkeleton, GenericSkeleton, InlineComposerWidgetSkeleton } from '@selfcommunity/react-ui';
5
+ import { PREFIX } from './constants';
6
+ const classes = {
7
+ root: `${PREFIX}-skeleton-root`
8
+ };
9
+ const Root = styled(FeedSkeleton, {
10
+ name: PREFIX,
11
+ slot: 'SkeletonRoot'
12
+ })(() => ({}));
13
+ /**
14
+ * > API documentation for the Community-JS Group Feed Skeleton Template. Learn about the available props and the CSS API.
15
+
16
+ #### Import
17
+
18
+ ```jsx
19
+ import {GroupFeedSkeleton} from '@selfcommunity/react-templates';
20
+ ```
21
+
22
+ #### Component Name
23
+
24
+ The name `SCGroupFeedTemplate-skeleton-root` can be used when providing style overrides in the theme.
25
+
26
+ #### CSS
27
+
28
+ |Rule Name|Global class|Description|
29
+ |---|---|---|
30
+ |root|.SCGroupFeedTemplate-skeleton-root|Styles applied to the root element.|
31
+ *
32
+ */
33
+ export default function EventFeedSkeleton() {
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)))] })));
35
+ }
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCEventFeedTemplate";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCEventFeedTemplate';
@@ -0,0 +1,4 @@
1
+ import EventFeedSkeleton from './Skeleton';
2
+ import EventFeed, { EventFeedProps } from './EventFeed';
3
+ export default EventFeed;
4
+ export { EventFeedProps, EventFeedSkeleton };
@@ -0,0 +1,4 @@
1
+ import EventFeedSkeleton from './Skeleton';
2
+ import EventFeed from './EventFeed';
3
+ export default EventFeed;
4
+ export { EventFeedSkeleton };
@@ -1,6 +1,7 @@
1
- import React, { useMemo, useRef } from 'react';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useContext, useMemo, useRef } from 'react';
2
3
  import { styled } from '@mui/material/styles';
3
- import { CategoriesPopularWidget, Feed, FeedObject, FeedObjectSkeleton, SCFeedObjectTemplateType, InlineComposerWidget, LoyaltyProgramWidget, UserSuggestionWidget, PlatformWidget } from '@selfcommunity/react-ui';
4
+ import { CategoriesPopularWidget, Feed, FeedObject, FeedObjectSkeleton, SCFeedObjectTemplateType, InlineComposerWidget, LoyaltyProgramWidget, UserSuggestionWidget, PlatformWidget, OnBoardingWidget } from '@selfcommunity/react-ui';
4
5
  import { Endpoints } from '@selfcommunity/api-services';
5
6
  import { useThemeProps } from '@mui/system';
6
7
  import classNames from 'classnames';
@@ -8,6 +9,7 @@ import { SCCustomAdvPosition } from '@selfcommunity/types';
8
9
  import { FormattedMessage } from 'react-intl';
9
10
  import { useSnackbar } from 'notistack';
10
11
  import { PREFIX } from './constants';
12
+ import { SCUserContext, UserUtils } from '@selfcommunity/react-core';
11
13
  const classes = {
12
14
  root: `${PREFIX}-root`
13
15
  };
@@ -80,11 +82,12 @@ export default function ExploreFeed(inProps) {
80
82
  const { id = 'explore_feed', className, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
81
83
  // CONTEXT
82
84
  const { enqueueSnackbar } = useSnackbar();
85
+ const scUserContext = useContext(SCUserContext);
83
86
  // REF
84
87
  const feedRef = useRef();
85
88
  // HANDLERS
86
89
  const handleComposerSuccess = (feedObject) => {
87
- enqueueSnackbar(React.createElement(FormattedMessage, { id: "ui.inlineComposerWidget.success", defaultMessage: "ui.inlineComposerWidget.success" }), {
90
+ enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.inlineComposerWidget.success", defaultMessage: "ui.inlineComposerWidget.success" }), {
88
91
  variant: 'success',
89
92
  autoHideDuration: 3000
90
93
  });
@@ -97,18 +100,34 @@ export default function ExploreFeed(inProps) {
97
100
  };
98
101
  feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
99
102
  };
103
+ const handleAddGenerationContent = (feedObjects) => {
104
+ if (feedRef && feedRef.current) {
105
+ const currentFeedObjectIds = feedRef.current.getCurrentFeedObjectIds();
106
+ feedObjects.forEach((feedObject) => {
107
+ if (!currentFeedObjectIds.includes(feedObject.id)) {
108
+ const feedUnit = {
109
+ type: feedObject.type,
110
+ [feedObject.type]: feedObject,
111
+ seen_by_id: [],
112
+ has_boost: false
113
+ };
114
+ feedRef.current.addFeedData(feedUnit, true);
115
+ }
116
+ });
117
+ }
118
+ };
100
119
  // WIDGETS
101
120
  const _widgets = useMemo(() => widgets.map((w) => {
102
121
  return Object.assign(Object.assign({}, w), { componentProps: Object.assign({}, w.componentProps) });
103
122
  }), [widgets]);
104
- return (React.createElement(Root, Object.assign({ id: id, className: classNames(classes.root, className), ref: feedRef, endpoint: Endpoints.ExploreFeed, widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => ({
123
+ return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className), ref: feedRef, endpoint: Endpoints.ExploreFeed, widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => ({
105
124
  feedObject: item[item.type],
106
125
  feedObjectType: item.type,
107
126
  feedObjectActivities: item.activities ? item.activities : null,
108
127
  markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
109
128
  }), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
110
129
  template: SCFeedObjectTemplateType.PREVIEW
111
- }, HeaderComponent: React.createElement(InlineComposerWidget, { onSuccess: handleComposerSuccess }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
130
+ }, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess }), UserUtils.isAdmin(scUserContext.user) && _jsx(OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
112
131
  SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
113
132
  SCCustomAdvPosition.POSITION_FEED,
114
133
  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 ExploreFeedSkeleton() {
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
  }
@@ -1,4 +1,5 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
2
3
  import { styled } from '@mui/material/styles';
3
4
  import { Box, Grid, Hidden } from '@mui/material';
4
5
  import { CommentsFeedObject, CustomAdv, FeedObject, RelatedFeedObjectsWidget, SCFeedObjectTemplateType, StickyBox } from '@selfcommunity/react-ui';
@@ -70,7 +71,7 @@ export default function FeedObjectDetail(inProps) {
70
71
  if (preferences[SCPreferences.ADVERTISING_CUSTOM_ADV_ENABLED] &&
71
72
  ((preferences[SCPreferences.ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED] && scUserContext.user === null) ||
72
73
  !preferences[SCPreferences.ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED])) {
73
- return (React.createElement(CustomAdv, Object.assign({ position: SCCustomAdvPosition.POSITION_BELOW_FEED_OBJECT }, (obj.categories.length && { categoriesId: obj.categories.map((c) => c.id) }))));
74
+ return (_jsx(CustomAdv, Object.assign({ position: SCCustomAdvPosition.POSITION_BELOW_FEED_OBJECT }, (obj.categories.length && { categoriesId: obj.categories.map((c) => c.id) }))));
74
75
  }
75
76
  return null;
76
77
  }
@@ -88,20 +89,10 @@ export default function FeedObjectDetail(inProps) {
88
89
  }, 300);
89
90
  }
90
91
  if (error) {
91
- return (React.createElement(Box, null,
92
- React.createElement(FormattedMessage, { id: "templates.feedObjectDetail.contributionNotFound", defaultMessage: "templates.feedObjectDetail.contributionNotFound" })));
92
+ return (_jsx(Box, { children: _jsx(FormattedMessage, { id: "templates.feedObjectDetail.contributionNotFound", defaultMessage: "templates.feedObjectDetail.contributionNotFound" }) }));
93
93
  }
94
94
  if (!obj) {
95
- return React.createElement(FeedObjectDetailSkeleton, null);
95
+ return _jsx(FeedObjectDetailSkeleton, {});
96
96
  }
97
- return (React.createElement(Root, { id: id, className: classNames(classes.root, className) },
98
- React.createElement(Grid, { container: true, spacing: 2 },
99
- React.createElement(Grid, { item: true, xs: 12, md: 7 },
100
- React.createElement(FeedObject, Object.assign({}, FeedObjectProps, { feedObject: obj, template: SCFeedObjectTemplateType.DETAIL, onReply: handleReply })),
101
- renderAdvertising(),
102
- React.createElement(CommentsFeedObject, Object.assign({ key: `comments_${obj.id}`, showTitle: true, feedObject: obj, comments: comments }, CommentsFeedObjectProps))),
103
- React.createElement(Grid, { item: true, xs: 12, md: 5 },
104
- React.createElement(Hidden, { mdDown: true },
105
- React.createElement(StickyBox, Object.assign({}, FeedSidebarProps),
106
- React.createElement(RelatedFeedObjectsWidget, Object.assign({ key: `related_${obj.id}`, feedObject: obj }, RelatedFeedObjectProps))))))));
97
+ return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, { children: _jsxs(Grid, Object.assign({ container: true, spacing: 2 }, { children: [_jsxs(Grid, Object.assign({ item: true, xs: 12, md: 7 }, { children: [_jsx(FeedObject, Object.assign({}, FeedObjectProps, { feedObject: obj, template: SCFeedObjectTemplateType.DETAIL, onReply: handleReply })), renderAdvertising(), _jsx(CommentsFeedObject, Object.assign({ showTitle: true, feedObject: obj, comments: comments }, CommentsFeedObjectProps), `comments_${obj.id}`)] })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 5 }, { children: _jsx(Hidden, Object.assign({ mdDown: true }, { children: _jsx(StickyBox, Object.assign({}, FeedSidebarProps, { children: _jsx(RelatedFeedObjectsWidget, Object.assign({ feedObject: obj }, RelatedFeedObjectProps), `related_${obj.id}`) })) })) }))] })) })));
107
98
  }
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CommentsFeedObjectSkeleton, FeedObjectSkeleton, SCFeedObjectTemplateType, RelatedFeedObjectsWidgetSkeleton } from '@selfcommunity/react-ui';
3
3
  import { Box, Grid } from '@mui/material';
4
4
  import { styled } from '@mui/material/styles';
@@ -32,11 +32,5 @@ const Root = styled(Box, {
32
32
  */
33
33
  export default function FeedObjectDetailSkeleton(props) {
34
34
  const { FeedObjectSkeletonProps = {}, CommentsFeedObjectSkeletonProps = {}, RelatedFeedObjectsSkeletonProps = {} } = props;
35
- return (React.createElement(Root, { className: classes.root },
36
- React.createElement(Grid, { container: true, spacing: 2 },
37
- React.createElement(Grid, { item: true, xs: 12, md: 7 },
38
- React.createElement(FeedObjectSkeleton, Object.assign({ template: SCFeedObjectTemplateType.DETAIL }, FeedObjectSkeletonProps)),
39
- React.createElement(CommentsFeedObjectSkeleton, Object.assign({ count: 4 }, CommentsFeedObjectSkeletonProps))),
40
- React.createElement(Grid, { item: true, xs: 12, md: 5 },
41
- React.createElement(RelatedFeedObjectsWidgetSkeleton, Object.assign({}, RelatedFeedObjectsSkeletonProps))))));
35
+ return (_jsx(Root, Object.assign({ className: classes.root }, { children: _jsxs(Grid, Object.assign({ container: true, spacing: 2 }, { children: [_jsxs(Grid, Object.assign({ item: true, xs: 12, md: 7 }, { children: [_jsx(FeedObjectSkeleton, Object.assign({ template: SCFeedObjectTemplateType.DETAIL }, FeedObjectSkeletonProps)), _jsx(CommentsFeedObjectSkeleton, Object.assign({ count: 4 }, CommentsFeedObjectSkeletonProps))] })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 5 }, { children: _jsx(RelatedFeedObjectsWidgetSkeleton, Object.assign({}, RelatedFeedObjectsSkeletonProps)) }))] })) })));
42
36
  }
@@ -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 { GroupHeader } from '@selfcommunity/react-ui';
@@ -55,9 +55,7 @@ export default function Group(inProps) {
55
55
  setSCGroup(Object.assign({}, scGroup, { subscription_status: status }));
56
56
  };
57
57
  if (!scGroup) {
58
- return React.createElement(GroupSkeletonTemplate, null);
58
+ return _jsx(GroupSkeletonTemplate, {});
59
59
  }
60
- return (React.createElement(Root, { id: id, className: classNames(classes.root, className) },
61
- React.createElement(GroupHeader, { groupId: scGroup.id, GroupSubscribeButtonProps: { onSubscribe: handleSubscribe } }),
62
- React.createElement(GroupFeed, Object.assign({ className: classes.feed, group: scGroup, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, GroupFeedProps))));
60
+ return (_jsxs(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, { children: [_jsx(GroupHeader, { groupId: scGroup.id, GroupSubscribeButtonProps: { onSubscribe: handleSubscribe } }), _jsx(GroupFeed, Object.assign({ className: classes.feed, group: scGroup, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, GroupFeedProps))] })));
63
61
  }
@@ -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 GroupFeedSkeleton from '../GroupFeed/Skeleton';
@@ -32,7 +32,5 @@ const Root = styled(Box, {
32
32
  *
33
33
  */
34
34
  export default function GroupSkeletonTemplate() {
35
- return (React.createElement(Root, { className: classes.root },
36
- React.createElement(GroupHeaderSkeleton, null),
37
- React.createElement(GroupFeedSkeleton, null)));
35
+ return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [_jsx(GroupHeaderSkeleton, {}), _jsx(GroupFeedSkeleton, {})] })));
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 { ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, GroupInfoWidget, GroupMembersWidget, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
4
5
  import { Endpoints } from '@selfcommunity/api-services';
@@ -75,9 +76,8 @@ export default function GroupFeed(inProps) {
75
76
  // HANDLERS
76
77
  const handleComposerSuccess = (feedObject) => {
77
78
  var _a;
78
- enqueueSnackbar(React.createElement(FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
79
- action: (snackbarId) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], ContributionUtils.getRouteData(feedObject)) },
80
- React.createElement(FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }))),
79
+ enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
80
+ 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" }) }))),
81
81
  variant: 'success',
82
82
  autoHideDuration: 7000
83
83
  });
@@ -100,12 +100,12 @@ export default function GroupFeed(inProps) {
100
100
  return w;
101
101
  }), [widgets, scGroup]);
102
102
  if (!scGroup) {
103
- return React.createElement(GroupFeedSkeleton, null);
103
+ return _jsx(GroupFeedSkeleton, {});
104
104
  }
105
105
  else if (scGroup && scGroup.subscription_status !== SCGroupSubscriptionStatusType.SUBSCRIBED) {
106
- return React.createElement(GroupInfoWidget, { className: classes.root, groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id });
106
+ return _jsx(GroupInfoWidget, { className: classes.root, groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id });
107
107
  }
108
- return (React.createElement(Root, Object.assign({ className: classNames(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.GetGroupFeed), { url: () => Endpoints.GetGroupFeed.url({ id: scGroup.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => {
108
+ return (_jsx(Root, Object.assign({ className: classNames(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.GetGroupFeed), { url: () => Endpoints.GetGroupFeed.url({ id: scGroup.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => {
109
109
  var _a;
110
110
  return ({
111
111
  feedObject: item[item.type],
@@ -116,7 +116,7 @@ export default function GroupFeed(inProps) {
116
116
  }, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
117
117
  template: SCFeedObjectTemplateType.PREVIEW
118
118
  }, FeedSidebarProps: FeedSidebarProps, HeaderComponent: scGroup &&
119
- scGroup.subscription_status === SCGroupSubscriptionStatusType.SUBSCRIBED && (React.createElement(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { group: scGroup }, label: React.createElement(FormattedMessage, { id: "templates.groupFeed.composer.label", defaultMessage: "templates.groupFeed.composer.label" }), feedType: SCFeedTypologyType.GROUP })), CustomAdvProps: { position: SCCustomAdvPosition.POSITION_FEED, groupsId: [scGroup.id] }, enabledCustomAdvPositions: [
119
+ scGroup.subscription_status === SCGroupSubscriptionStatusType.SUBSCRIBED && (_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { group: scGroup }, label: _jsx(FormattedMessage, { id: "templates.groupFeed.composer.label", defaultMessage: "templates.groupFeed.composer.label" }), feedType: SCFeedTypologyType.GROUP })), CustomAdvProps: { position: SCCustomAdvPosition.POSITION_FEED, groupsId: [scGroup.id] }, enabledCustomAdvPositions: [
120
120
  SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
121
121
  SCCustomAdvPosition.POSITION_FEED,
122
122
  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 GroupFeedSkeleton() {
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
  }
@@ -1,5 +1,6 @@
1
1
  import { __rest } from "tslib";
2
- import React, { useContext, useEffect, useMemo, useState } from 'react';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useContext, useEffect, useMemo, useState } from 'react';
3
4
  import { styled } from '@mui/material/styles';
4
5
  import { http, Endpoints, UserService, LoyaltyService } from '@selfcommunity/api-services';
5
6
  import { SCUserContext } from '@selfcommunity/react-core';
@@ -106,7 +107,7 @@ export default function LoyaltyProgramDetail(inProps) {
106
107
  .then((data) => {
107
108
  setPoints((prev) => prev - data.prize_points);
108
109
  setOpen(false);
109
- let _snackBar = enqueueSnackbar(React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.prize.request.success", defaultMessage: "templates.loyaltyProgramDetail.prize.request.success" }), {
110
+ let _snackBar = enqueueSnackbar(_jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.prize.request.success", defaultMessage: "templates.loyaltyProgramDetail.prize.request.success" }), {
110
111
  variant: 'success',
111
112
  autoHideDuration: 3000,
112
113
  SnackbarProps: {
@@ -118,7 +119,7 @@ export default function LoyaltyProgramDetail(inProps) {
118
119
  })
119
120
  .catch((error) => {
120
121
  setOpen(false);
121
- let _snackBar = enqueueSnackbar(React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.prize.request.error", defaultMessage: "templates.loyaltyProgramDetail.prize.request.error" }), {
122
+ let _snackBar = enqueueSnackbar(_jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.prize.request.error", defaultMessage: "templates.loyaltyProgramDetail.prize.request.error" }), {
122
123
  variant: 'error',
123
124
  autoHideDuration: 3000,
124
125
  SnackbarProps: {
@@ -181,37 +182,7 @@ export default function LoyaltyProgramDetail(inProps) {
181
182
  return null;
182
183
  }
183
184
  if (loading) {
184
- return React.createElement(Skeleton, null);
185
+ return _jsx(Skeleton, {});
185
186
  }
186
- return (React.createElement(Root, Object.assign({ className: classNames(classes.root, className) }, rest),
187
- points !== 0 && (React.createElement(Typography, { className: classes.title, variant: "h5" },
188
- !isMobile && React.createElement(FormattedMessage, { id: "ui.loyaltyProgramWidget.title", defaultMessage: "ui.loyaltyProgramWidget.title" }),
189
- React.createElement(Chip, { className: classes.userPoints, component: "span", label: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.userPoints", defaultMessage: "templates.loyaltyProgramDetail.userPoints", values: { total: points } }) }))),
190
- React.createElement(Typography, { className: classes.sectionTitle },
191
- React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.community", defaultMessage: "templates.loyaltyProgramDetail.community" })),
192
- React.createElement(Typography, { className: classes.sectionInfo },
193
- React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.description", defaultMessage: "templates.loyaltyProgramDetail.description" })),
194
- React.createElement(Typography, { className: classes.sectionTitle },
195
- React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.listTitle", defaultMessage: "templates.loyaltyProgramDetail.listTitle" })),
196
- React.createElement(PointsList, { className: classes.pointsSection }),
197
- prizes.length !== 0 && (React.createElement(Typography, { className: classes.sectionTitle },
198
- React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.prizes", defaultMessage: "templates.loyaltyProgramDetail.prizes" }))),
199
- React.createElement(InfiniteScroll, { dataLength: prizes.length, next: handleNext, hasMoreNext: Boolean(next), loaderNext: React.createElement(PrizeItemSkeleton, null), endMessage: React.createElement(React.Fragment, null, prizes.length !== 0 ? (React.createElement(Typography, { className: classes.endMessage },
200
- React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.content.end.message", defaultMessage: "templates.loyaltyProgramDetail.content.end.message" }),
201
- React.createElement(Button, { color: 'secondary', onClick: handleScrollUp },
202
- React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.content.end.button", defaultMessage: "templates.loyaltyProgramDetail.content.end.button" })))) : null) },
203
- React.createElement(Grid, { container: true, spacing: !isMobile ? 3 : 0, direction: isMobile ? 'column' : 'row', className: classes.prizeSection }, prizes.map((prize) => (React.createElement(Grid, { item: true, xs: 12, sm: 12, md: 6, lg: 4, xl: 3, key: prize.id },
204
- React.createElement(Card, { className: classes.card },
205
- React.createElement(CardMedia, { component: "img", image: prize.image }),
206
- React.createElement(Box, { className: classes.prizePoints },
207
- React.createElement(Chip, { className: points <= prize.points ? classes.notRequestable : null, label: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.prize.points", defaultMessage: "templates.loyaltyProgramDetail.prize.points", values: { total: prize.points } }) })),
208
- React.createElement(CardContent, null,
209
- React.createElement(Typography, { variant: "body1", className: classes.cardTitle }, prize.title),
210
- React.createElement(Typography, { variant: "body2", className: classes.cardContent }, prize.description)),
211
- React.createElement(CardActions, null,
212
- prize.link && (React.createElement(Button, { size: "medium", color: "secondary", href: prize.link, target: "_blank", className: classes.actionButton },
213
- React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.button.more", defaultMessage: "templates.loyaltyProgramDetail.button.more" }))),
214
- ((!prize.link && prize.active && points >= prize.points) || (prize.active && points >= prize.points)) && (React.createElement(Button, { size: "small", variant: "outlined", className: classes.actionButton, disabled: points < prize.points, onClick: () => handleOpenAlert(prize.id) },
215
- React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.button.request", defaultMessage: "templates.loyaltyProgramDetail.button.request" })))))))))),
216
- open && (React.createElement(ConfirmDialog, { open: open, title: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.dialog.msg", defaultMessage: "templates.loyaltyProgramDetail.dialog.msg" }), btnConfirm: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.dialog.confirm", defaultMessage: "templates.loyaltyProgramDetail.dialog.confirm" }), onConfirm: () => requestPrize(prizeRequested), onClose: () => setOpen(false) }))));
187
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [points !== 0 && (_jsxs(Typography, Object.assign({ className: classes.title, variant: "h5" }, { children: [!isMobile && _jsx(FormattedMessage, { id: "ui.loyaltyProgramWidget.title", defaultMessage: "ui.loyaltyProgramWidget.title" }), _jsx(Chip, { className: classes.userPoints, component: "span", label: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.userPoints", defaultMessage: "templates.loyaltyProgramDetail.userPoints", values: { total: points } }) })] }))), _jsx(Typography, Object.assign({ className: classes.sectionTitle }, { children: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.community", defaultMessage: "templates.loyaltyProgramDetail.community" }) })), _jsx(Typography, Object.assign({ className: classes.sectionInfo }, { children: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.description", defaultMessage: "templates.loyaltyProgramDetail.description" }) })), _jsx(Typography, Object.assign({ className: classes.sectionTitle }, { children: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.listTitle", defaultMessage: "templates.loyaltyProgramDetail.listTitle" }) })), _jsx(PointsList, { className: classes.pointsSection }), prizes.length !== 0 && (_jsx(Typography, Object.assign({ className: classes.sectionTitle }, { children: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.prizes", defaultMessage: "templates.loyaltyProgramDetail.prizes" }) }))), _jsx(InfiniteScroll, Object.assign({ dataLength: prizes.length, next: handleNext, hasMoreNext: Boolean(next), loaderNext: _jsx(PrizeItemSkeleton, {}), endMessage: _jsx(_Fragment, { children: prizes.length !== 0 ? (_jsxs(Typography, Object.assign({ className: classes.endMessage }, { children: [_jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.content.end.message", defaultMessage: "templates.loyaltyProgramDetail.content.end.message" }), _jsx(Button, Object.assign({ color: 'secondary', onClick: handleScrollUp }, { children: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.content.end.button", defaultMessage: "templates.loyaltyProgramDetail.content.end.button" }) }))] }))) : null }) }, { children: _jsx(Grid, Object.assign({ container: true, spacing: !isMobile ? 3 : 0, direction: isMobile ? 'column' : 'row', className: classes.prizeSection }, { children: prizes.map((prize) => (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, lg: 4, xl: 3 }, { children: _jsxs(Card, Object.assign({ className: classes.card }, { children: [_jsx(CardMedia, { component: "img", image: prize.image }), _jsx(Box, Object.assign({ className: classes.prizePoints }, { children: _jsx(Chip, { className: points <= prize.points ? classes.notRequestable : null, label: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.prize.points", defaultMessage: "templates.loyaltyProgramDetail.prize.points", values: { total: prize.points } }) }) })), _jsxs(CardContent, { children: [_jsx(Typography, Object.assign({ variant: "body1", className: classes.cardTitle }, { children: prize.title })), _jsx(Typography, Object.assign({ variant: "body2", className: classes.cardContent }, { children: prize.description }))] }), _jsxs(CardActions, { children: [prize.link && (_jsx(Button, Object.assign({ size: "medium", color: "secondary", href: prize.link, target: "_blank", className: classes.actionButton }, { children: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.button.more", defaultMessage: "templates.loyaltyProgramDetail.button.more" }) }))), ((!prize.link && prize.active && points >= prize.points) || (prize.active && points >= prize.points)) && (_jsx(Button, Object.assign({ size: "small", variant: "outlined", className: classes.actionButton, disabled: points < prize.points, onClick: () => handleOpenAlert(prize.id) }, { children: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.button.request", defaultMessage: "templates.loyaltyProgramDetail.button.request" }) })))] })] })) }), prize.id))) })) })), open && (_jsx(ConfirmDialog, { open: open, title: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.dialog.msg", defaultMessage: "templates.loyaltyProgramDetail.dialog.msg" }), btnConfirm: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.dialog.confirm", defaultMessage: "templates.loyaltyProgramDetail.dialog.confirm" }), onConfirm: () => requestPrize(prizeRequested), onClose: () => setOpen(false) }))] })));
217
188
  }
@@ -1,5 +1,6 @@
1
1
  import { __rest } from "tslib";
2
- import React, { useMemo } from 'react';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo } from 'react';
3
4
  import { styled } from '@mui/material/styles';
4
5
  import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
5
6
  import { Divider, Grid, Typography } from '@mui/material';
@@ -22,13 +23,7 @@ const classes = {
22
23
  };
23
24
  export function PointElement({ message, points }) {
24
25
  if (points > 0) {
25
- return (React.createElement(Grid, { item: true, xs: 12, sm: 12, md: 6 },
26
- React.createElement(Typography, { component: "div", className: classes.element },
27
- React.createElement(Typography, null, message),
28
- React.createElement(Typography, null,
29
- "+",
30
- React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.points", defaultMessage: "templates.loyaltyProgramDetail.points", values: { total: points } }))),
31
- React.createElement(Divider, null)));
26
+ return (_jsxs(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6 }, { children: [_jsxs(Typography, Object.assign({ component: "div", className: classes.element }, { children: [_jsx(Typography, { children: message }), _jsxs(Typography, { children: ["+", _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.points", defaultMessage: "templates.loyaltyProgramDetail.points", values: { total: points } })] })] })), _jsx(Divider, {})] })));
32
27
  }
33
28
  }
34
29
  const Root = styled(Grid, {
@@ -53,13 +48,5 @@ export default function PointsList(props) {
53
48
  /**
54
49
  * Renders the component (if not hidden by autoHide prop)
55
50
  */
56
- return (React.createElement(Root, Object.assign({ className: classNames(classes.root, className), container: true, spacing: 2 }, rest),
57
- preferences[SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED].value && (React.createElement(PointElement, { message: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.post", defaultMessage: "templates.loyaltyProgramDetail.points.post" }), points: _preferences[SCPreferences.POINTS_MAKE_POST] })),
58
- preferences[SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED].value && (React.createElement(PointElement, { message: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.discussion", defaultMessage: "templates.loyaltyProgramDetail.points.discussion" }), points: _preferences[SCPreferences.POINTS_MAKE_DISCUSSION] })),
59
- React.createElement(PointElement, { message: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.comment", defaultMessage: "templates.loyaltyProgramDetail.points.comment" }), points: _preferences[SCPreferences.POINTS_MAKE_COMMENT] }),
60
- React.createElement(PointElement, { message: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.appreciation", defaultMessage: "templates.loyaltyProgramDetail.points.appreciation" }), points: _preferences[SCPreferences.POINTS_RECEIVE_VOTE] }),
61
- React.createElement(PointElement, { message: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.follower", defaultMessage: "templates.loyaltyProgramDetail.points.follower" }), points: _preferences[SCPreferences.POINTS_CONNECTION_OR_FOLLOWER] }),
62
- React.createElement(PointElement, { message: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.share", defaultMessage: "templates.loyaltyProgramDetail.points.share" }), points: _preferences[SCPreferences.POINTS_SOCIAL_SHARE] }),
63
- React.createElement(PointElement, { message: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.app", defaultMessage: "templates.loyaltyProgramDetail.points.app" }), points: _preferences[SCPreferences.POINTS_APP_USED] }),
64
- React.createElement(PointElement, { message: React.createElement(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.visit", defaultMessage: "templates.loyaltyProgramDetail.points.visit" }), points: _preferences[SCPreferences.POINTS_DAILY_VISIT] })));
51
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className), container: true, spacing: 2 }, rest, { children: [preferences[SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED].value && (_jsx(PointElement, { message: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.post", defaultMessage: "templates.loyaltyProgramDetail.points.post" }), points: _preferences[SCPreferences.POINTS_MAKE_POST] })), preferences[SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED].value && (_jsx(PointElement, { message: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.discussion", defaultMessage: "templates.loyaltyProgramDetail.points.discussion" }), points: _preferences[SCPreferences.POINTS_MAKE_DISCUSSION] })), _jsx(PointElement, { message: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.comment", defaultMessage: "templates.loyaltyProgramDetail.points.comment" }), points: _preferences[SCPreferences.POINTS_MAKE_COMMENT] }), _jsx(PointElement, { message: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.appreciation", defaultMessage: "templates.loyaltyProgramDetail.points.appreciation" }), points: _preferences[SCPreferences.POINTS_RECEIVE_VOTE] }), _jsx(PointElement, { message: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.follower", defaultMessage: "templates.loyaltyProgramDetail.points.follower" }), points: _preferences[SCPreferences.POINTS_CONNECTION_OR_FOLLOWER] }), _jsx(PointElement, { message: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.share", defaultMessage: "templates.loyaltyProgramDetail.points.share" }), points: _preferences[SCPreferences.POINTS_SOCIAL_SHARE] }), _jsx(PointElement, { message: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.app", defaultMessage: "templates.loyaltyProgramDetail.points.app" }), points: _preferences[SCPreferences.POINTS_APP_USED] }), _jsx(PointElement, { message: _jsx(FormattedMessage, { id: "templates.loyaltyProgramDetail.points.visit", defaultMessage: "templates.loyaltyProgramDetail.points.visit" }), points: _preferences[SCPreferences.POINTS_DAILY_VISIT] })] })));
65
52
  }
@@ -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 { Typography, CardContent, Skeleton, CardActions, CardMedia, Button } from '@mui/material';
4
4
  import { Widget } from '@selfcommunity/react-ui';
@@ -29,16 +29,5 @@ const Root = styled(Widget, {
29
29
  *
30
30
  */
31
31
  export default function PrizeItemSkeleton() {
32
- return (React.createElement(Root, { className: classes.root },
33
- React.createElement(CardMedia, null,
34
- React.createElement(Skeleton, { animation: "wave", variant: "rectangular", width: "100%", height: 137 })),
35
- React.createElement(CardContent, null,
36
- React.createElement(Typography, { className: classes.content },
37
- React.createElement(Skeleton, { animation: "wave", height: 20, width: "80%", variant: "text" }),
38
- React.createElement(Skeleton, { animation: "wave", height: 10, width: "70%", variant: "text", style: { marginTop: 8 } }))),
39
- React.createElement(CardActions, { className: classes.actions },
40
- React.createElement(Button, { disabled: true, variant: 'outlined', size: 'small' },
41
- React.createElement(Skeleton, { animation: "wave", height: 10, width: 50, variant: "text" })),
42
- React.createElement(Button, { disabled: true, variant: 'text', size: 'small' },
43
- React.createElement(Skeleton, { animation: "wave", height: 20, width: 70, variant: "text" })))));
32
+ return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [_jsx(CardMedia, { children: _jsx(Skeleton, { animation: "wave", variant: "rectangular", width: "100%", height: 137 }) }), _jsx(CardContent, { children: _jsxs(Typography, Object.assign({ className: classes.content }, { children: [_jsx(Skeleton, { animation: "wave", height: 20, width: "80%", variant: "text" }), _jsx(Skeleton, { animation: "wave", height: 10, width: "70%", variant: "text", style: { marginTop: 8 } })] })) }), _jsxs(CardActions, Object.assign({ className: classes.actions }, { children: [_jsx(Button, Object.assign({ disabled: true, variant: 'outlined', size: 'small' }, { children: _jsx(Skeleton, { animation: "wave", height: 10, width: 50, variant: "text" }) })), _jsx(Button, Object.assign({ disabled: true, variant: 'text', size: 'small' }, { children: _jsx(Skeleton, { animation: "wave", height: 20, width: 70, variant: "text" }) }))] }))] })));
44
33
  }