@selfcommunity/react-templates 0.4.8-payments.175 → 0.5.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.
- package/lib/cjs/components/CategoryFeed/CategoryFeed.js +0 -10
- package/lib/esm/components/CategoryFeed/CategoryFeed.js +3 -13
- package/lib/umd/738.js +1 -1
- package/lib/umd/916.js +2 -0
- package/lib/umd/react-templates.js +1 -1
- package/package.json +7 -7
- package/lib/umd/952.js +0 -2
- /package/lib/umd/{952.js.LICENSE.txt → 916.js.LICENSE.txt} +0 -0
|
@@ -64,7 +64,6 @@ const WIDGETS = [
|
|
|
64
64
|
* @param inProps
|
|
65
65
|
*/
|
|
66
66
|
function CategoryFeed(inProps) {
|
|
67
|
-
var _a;
|
|
68
67
|
// PROPS
|
|
69
68
|
const props = (0, system_1.useThemeProps)({
|
|
70
69
|
props: inProps,
|
|
@@ -74,17 +73,11 @@ function CategoryFeed(inProps) {
|
|
|
74
73
|
// CONTEXT
|
|
75
74
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
76
75
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
77
|
-
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
78
76
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
79
77
|
// REF
|
|
80
78
|
const feedRef = (0, react_1.useRef)();
|
|
81
79
|
// Hooks
|
|
82
80
|
const { scCategory } = (0, react_core_1.useSCFetchCategory)({ id: categoryId, category });
|
|
83
|
-
const isPaymentsEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
84
|
-
features &&
|
|
85
|
-
features.includes(types_1.SCFeatureName.PAYMENTS) &&
|
|
86
|
-
react_core_1.SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED in preferences &&
|
|
87
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED].value, [preferences]);
|
|
88
81
|
// HANDLERS
|
|
89
82
|
const handleComposerSuccess = (feedObject) => {
|
|
90
83
|
// Not insert if the category does not match
|
|
@@ -115,9 +108,6 @@ function CategoryFeed(inProps) {
|
|
|
115
108
|
if (!scCategory) {
|
|
116
109
|
return (0, jsx_runtime_1.jsx)(index_1.CategoryFeedSkeleton, {});
|
|
117
110
|
}
|
|
118
|
-
else if (scCategory && isPaymentsEnabled && !scCategory.followed && !scCategory.payment_order && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
119
|
-
return (0, jsx_runtime_1.jsx)(react_ui_1.HiddenPurchasableContent, {});
|
|
120
|
-
}
|
|
121
111
|
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.CategoryFeed), { url: () => api_services_1.Endpoints.CategoryFeed.url({ id: scCategory.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
122
112
|
feedObject: item[item.type],
|
|
123
113
|
feedObjectType: item.type,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useRef } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
|
-
import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton,
|
|
4
|
+
import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
|
-
import { Link,
|
|
7
|
-
import { SCCustomAdvPosition,
|
|
6
|
+
import { Link, SCRoutes, UserUtils, useSCFetchCategory, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
|
+
import { SCCustomAdvPosition, SCFeedTypologyType } from '@selfcommunity/types';
|
|
8
8
|
import { CategoryFeedSkeleton } from './index';
|
|
9
9
|
import { useThemeProps } from '@mui/system';
|
|
10
10
|
import classNames from 'classnames';
|
|
@@ -61,7 +61,6 @@ const WIDGETS = [
|
|
|
61
61
|
* @param inProps
|
|
62
62
|
*/
|
|
63
63
|
export default function CategoryFeed(inProps) {
|
|
64
|
-
var _a;
|
|
65
64
|
// PROPS
|
|
66
65
|
const props = useThemeProps({
|
|
67
66
|
props: inProps,
|
|
@@ -71,17 +70,11 @@ export default function CategoryFeed(inProps) {
|
|
|
71
70
|
// CONTEXT
|
|
72
71
|
const scRoutingContext = useSCRouting();
|
|
73
72
|
const scUserContext = useSCUser();
|
|
74
|
-
const { preferences, features } = useSCPreferences();
|
|
75
73
|
const { enqueueSnackbar } = useSnackbar();
|
|
76
74
|
// REF
|
|
77
75
|
const feedRef = useRef();
|
|
78
76
|
// Hooks
|
|
79
77
|
const { scCategory } = useSCFetchCategory({ id: categoryId, category });
|
|
80
|
-
const isPaymentsEnabled = useMemo(() => preferences &&
|
|
81
|
-
features &&
|
|
82
|
-
features.includes(SCFeatureName.PAYMENTS) &&
|
|
83
|
-
SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED in preferences &&
|
|
84
|
-
preferences[SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED].value, [preferences]);
|
|
85
78
|
// HANDLERS
|
|
86
79
|
const handleComposerSuccess = (feedObject) => {
|
|
87
80
|
// Not insert if the category does not match
|
|
@@ -112,9 +105,6 @@ export default function CategoryFeed(inProps) {
|
|
|
112
105
|
if (!scCategory) {
|
|
113
106
|
return _jsx(CategoryFeedSkeleton, {});
|
|
114
107
|
}
|
|
115
|
-
else if (scCategory && isPaymentsEnabled && !scCategory.followed && !scCategory.payment_order && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
116
|
-
return _jsx(HiddenPurchasableContent, {});
|
|
117
|
-
}
|
|
118
108
|
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) => ({
|
|
119
109
|
feedObject: item[item.type],
|
|
120
110
|
feedObjectType: item.type,
|