@selfcommunity/react-core 0.7.0-alpha.2 → 0.7.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/constants/Cache.d.ts +12 -0
- package/lib/cjs/constants/Cache.js +17 -1
- package/lib/cjs/constants/Preferences.d.ts +18 -0
- package/lib/cjs/constants/Preferences.js +36 -2
- package/lib/cjs/constants/Routes.d.ts +6 -0
- package/lib/cjs/constants/Routes.js +14 -1
- package/lib/cjs/hooks/useFetchMenuFooter.d.ts +5 -0
- package/lib/cjs/hooks/useFetchMenuFooter.js +36 -0
- package/lib/cjs/hooks/useSCFeature.d.ts +22 -0
- package/lib/cjs/hooks/useSCFeature.js +38 -0
- package/lib/cjs/hooks/useSCFetchCategory.d.ts +1 -0
- package/lib/cjs/hooks/useSCFetchCategory.js +18 -1
- package/lib/cjs/hooks/useSCFetchCourse.js +15 -15
- package/lib/cjs/hooks/useSCFetchEvent.d.ts +1 -0
- package/lib/cjs/hooks/useSCFetchEvent.js +16 -1
- package/lib/cjs/hooks/useSCFetchGroup.d.ts +1 -0
- package/lib/cjs/hooks/useSCFetchGroup.js +16 -1
- package/lib/cjs/hooks/useSCFetchPaymentOrder.d.ts +20 -0
- package/lib/cjs/hooks/useSCFetchPaymentOrder.js +70 -0
- package/lib/cjs/hooks/useSCFetchPaymentProduct.d.ts +20 -0
- package/lib/cjs/hooks/useSCFetchPaymentProduct.js +70 -0
- package/lib/cjs/hooks/useSCFetchUsers.d.ts +21 -0
- package/lib/cjs/hooks/useSCFetchUsers.js +50 -0
- package/lib/cjs/hooks/useSCJoinedCoursesManager.d.ts +1 -1
- package/lib/cjs/hooks/useSCJoinedCoursesManager.js +36 -67
- package/lib/cjs/hooks/useSCPaymentsEnabled.d.ts +18 -0
- package/lib/cjs/hooks/useSCPaymentsEnabled.js +35 -0
- package/lib/cjs/hooks/useSCPreference.d.ts +36 -0
- package/lib/cjs/hooks/useSCPreference.js +69 -0
- package/lib/cjs/hooks/useSCPreferencesAndFeaturesEnabled.d.ts +17 -0
- package/lib/cjs/hooks/useSCPreferencesAndFeaturesEnabled.js +35 -0
- package/lib/cjs/hooks/useSCSubscribedEventsManager.js +4 -14
- package/lib/cjs/hooks/useSCSubscribedGroupsManager.d.ts +1 -1
- package/lib/cjs/hooks/useSCSubscribedGroupsManager.js +29 -54
- package/lib/cjs/index.d.ts +10 -2
- package/lib/cjs/index.js +22 -2
- package/lib/cjs/themes/theme.js +12 -0
- package/lib/cjs/types/theme.d.ts +52 -0
- package/lib/cjs/utils/hooks/index.d.ts +2 -1
- package/lib/cjs/utils/hooks/index.js +3 -1
- package/lib/cjs/utils/hooks/useResizeObserver.d.ts +1 -0
- package/lib/cjs/utils/hooks/useResizeObserver.js +16 -0
- package/lib/cjs/utils/user.d.ts +8 -1
- package/lib/cjs/utils/user.js +15 -2
- package/lib/esm/constants/Cache.d.ts +12 -0
- package/lib/esm/constants/Cache.js +12 -0
- package/lib/esm/constants/Preferences.d.ts +18 -0
- package/lib/esm/constants/Preferences.js +33 -0
- package/lib/esm/constants/Routes.d.ts +6 -0
- package/lib/esm/constants/Routes.js +12 -0
- package/lib/esm/hooks/useFetchMenuFooter.d.ts +5 -0
- package/lib/esm/hooks/useFetchMenuFooter.js +33 -0
- package/lib/esm/hooks/useSCFeature.d.ts +22 -0
- package/lib/esm/hooks/useSCFeature.js +33 -0
- package/lib/esm/hooks/useSCFetchCategory.d.ts +1 -0
- package/lib/esm/hooks/useSCFetchCategory.js +18 -1
- package/lib/esm/hooks/useSCFetchCourse.js +15 -15
- package/lib/esm/hooks/useSCFetchEvent.d.ts +1 -0
- package/lib/esm/hooks/useSCFetchEvent.js +16 -1
- package/lib/esm/hooks/useSCFetchGroup.d.ts +1 -0
- package/lib/esm/hooks/useSCFetchGroup.js +16 -1
- package/lib/esm/hooks/useSCFetchPaymentOrder.d.ts +20 -0
- package/lib/esm/hooks/useSCFetchPaymentOrder.js +67 -0
- package/lib/esm/hooks/useSCFetchPaymentProduct.d.ts +20 -0
- package/lib/esm/hooks/useSCFetchPaymentProduct.js +67 -0
- package/lib/esm/hooks/useSCFetchUsers.d.ts +21 -0
- package/lib/esm/hooks/useSCFetchUsers.js +48 -0
- package/lib/esm/hooks/useSCJoinedCoursesManager.d.ts +1 -1
- package/lib/esm/hooks/useSCJoinedCoursesManager.js +37 -67
- package/lib/esm/hooks/useSCPaymentsEnabled.d.ts +18 -0
- package/lib/esm/hooks/useSCPaymentsEnabled.js +31 -0
- package/lib/esm/hooks/useSCPreference.d.ts +36 -0
- package/lib/esm/hooks/useSCPreference.js +65 -0
- package/lib/esm/hooks/useSCPreferencesAndFeaturesEnabled.d.ts +17 -0
- package/lib/esm/hooks/useSCPreferencesAndFeaturesEnabled.js +32 -0
- package/lib/esm/hooks/useSCSubscribedEventsManager.js +4 -14
- package/lib/esm/hooks/useSCSubscribedGroupsManager.d.ts +1 -1
- package/lib/esm/hooks/useSCSubscribedGroupsManager.js +29 -54
- package/lib/esm/index.d.ts +10 -2
- package/lib/esm/index.js +10 -2
- package/lib/esm/themes/theme.js +12 -0
- package/lib/esm/types/theme.d.ts +52 -0
- package/lib/esm/utils/hooks/index.d.ts +2 -1
- package/lib/esm/utils/hooks/index.js +2 -1
- package/lib/esm/utils/hooks/useResizeObserver.d.ts +1 -0
- package/lib/esm/utils/hooks/useResizeObserver.js +13 -0
- package/lib/esm/utils/user.d.ts +8 -1
- package/lib/esm/utils/user.js +13 -1
- package/lib/umd/react-core.js +1 -1
- package/package.json +6 -6
|
@@ -37,21 +37,17 @@ function useSCSubscribedEventsManager(user) {
|
|
|
37
37
|
Preferences_1.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
|
|
38
38
|
preferences[Preferences_1.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
39
39
|
const notificationInvitedToJoinEvent = (0, react_1.useRef)(null);
|
|
40
|
-
const notificationRequestedToJoinEvent =
|
|
41
|
-
const notificationAcceptedToJoinEvent =
|
|
40
|
+
// const notificationRequestedToJoinEvent = useRef(null);
|
|
41
|
+
// const notificationAcceptedToJoinEvent = useRef(null);
|
|
42
42
|
const notificationAddedToEvent = (0, react_1.useRef)(null);
|
|
43
43
|
/**
|
|
44
44
|
* Subscribe to notification types user_follow, user_unfollow
|
|
45
45
|
*/
|
|
46
46
|
(0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
|
|
47
47
|
notificationInvitedToJoinEvent.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_EVENT}`, notificationSubscriber);
|
|
48
|
-
notificationRequestedToJoinEvent.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT}`, notificationSubscriber);
|
|
49
|
-
notificationAcceptedToJoinEvent.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT}`, notificationSubscriber);
|
|
50
48
|
notificationAddedToEvent.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ADDED_TO_EVENT}`, notificationSubscriber);
|
|
51
49
|
return () => {
|
|
52
50
|
pubsub_js_1.default.unsubscribe(notificationInvitedToJoinEvent.current);
|
|
53
|
-
pubsub_js_1.default.unsubscribe(notificationRequestedToJoinEvent.current);
|
|
54
|
-
pubsub_js_1.default.unsubscribe(notificationAcceptedToJoinEvent.current);
|
|
55
51
|
pubsub_js_1.default.unsubscribe(notificationAddedToEvent.current);
|
|
56
52
|
};
|
|
57
53
|
}, [data]);
|
|
@@ -67,12 +63,6 @@ function useSCSubscribedEventsManager(user) {
|
|
|
67
63
|
case types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_EVENT:
|
|
68
64
|
_status = types_1.SCEventSubscriptionStatusType.INVITED;
|
|
69
65
|
break;
|
|
70
|
-
case types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT:
|
|
71
|
-
_status = types_1.SCEventSubscriptionStatusType.REQUESTED;
|
|
72
|
-
break;
|
|
73
|
-
case types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT:
|
|
74
|
-
_status = types_1.SCEventSubscriptionStatusType.SUBSCRIBED;
|
|
75
|
-
break;
|
|
76
66
|
case types_1.SCNotificationTypologyType.USER_ADDED_TO_EVENT:
|
|
77
67
|
_status = types_1.SCEventSubscriptionStatusType.SUBSCRIBED;
|
|
78
68
|
break;
|
|
@@ -93,8 +83,8 @@ function useSCSubscribedEventsManager(user) {
|
|
|
93
83
|
// Only if user is authenticated
|
|
94
84
|
api_services_1.http
|
|
95
85
|
.request({
|
|
96
|
-
url: api_services_1.Endpoints.
|
|
97
|
-
method: api_services_1.Endpoints.
|
|
86
|
+
url: api_services_1.Endpoints.GetUserSubscribedEvents.url({ id: user.id }),
|
|
87
|
+
method: api_services_1.Endpoints.GetUserSubscribedEvents.method,
|
|
98
88
|
})
|
|
99
89
|
.then((res) => {
|
|
100
90
|
if (res.status >= 300) {
|
|
@@ -30,7 +30,7 @@ export default function useSCSubscribedGroupsManager(user?: SCUserType): {
|
|
|
30
30
|
isLoading: (v: number | {
|
|
31
31
|
id: number;
|
|
32
32
|
}) => boolean;
|
|
33
|
-
subscribe: (group: SCGroupType
|
|
33
|
+
subscribe: (group: SCGroupType) => Promise<any>;
|
|
34
34
|
unsubscribe: (group: SCGroupType) => Promise<any>;
|
|
35
35
|
subscriptionStatus: (group: SCGroupType) => string;
|
|
36
36
|
refresh: () => void;
|
|
@@ -37,21 +37,15 @@ function useSCSubscribedGroupsManager(user) {
|
|
|
37
37
|
Preferences_1.CONFIGURATIONS_GROUPS_ENABLED in preferences &&
|
|
38
38
|
preferences[Preferences_1.CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
|
|
39
39
|
const notificationInvitedToJoinGroup = (0, react_1.useRef)(null);
|
|
40
|
-
const notificationRequestedToJoinGroup = (0, react_1.useRef)(null);
|
|
41
|
-
const notificationAcceptedToJoinGroup = (0, react_1.useRef)(null);
|
|
42
40
|
const notificationAddedToGroup = (0, react_1.useRef)(null);
|
|
43
41
|
/**
|
|
44
42
|
* Subscribe to notification types user_follow, user_unfollow
|
|
45
43
|
*/
|
|
46
44
|
(0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
|
|
47
45
|
notificationInvitedToJoinGroup.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_GROUP}`, notificationSubscriber);
|
|
48
|
-
notificationRequestedToJoinGroup.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP}`, notificationSubscriber);
|
|
49
|
-
notificationAcceptedToJoinGroup.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP}`, notificationSubscriber);
|
|
50
46
|
notificationAddedToGroup.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP}`, notificationSubscriber);
|
|
51
47
|
return () => {
|
|
52
48
|
pubsub_js_1.default.unsubscribe(notificationInvitedToJoinGroup.current);
|
|
53
|
-
pubsub_js_1.default.unsubscribe(notificationRequestedToJoinGroup.current);
|
|
54
|
-
pubsub_js_1.default.unsubscribe(notificationAcceptedToJoinGroup.current);
|
|
55
49
|
pubsub_js_1.default.unsubscribe(notificationAddedToGroup.current);
|
|
56
50
|
};
|
|
57
51
|
}, [data]);
|
|
@@ -61,20 +55,20 @@ function useSCSubscribedGroupsManager(user) {
|
|
|
61
55
|
* @param dataMsg
|
|
62
56
|
*/
|
|
63
57
|
const notificationSubscriber = (msg, dataMsg) => {
|
|
58
|
+
var _a;
|
|
64
59
|
if (dataMsg.data.group !== undefined) {
|
|
65
60
|
let _status;
|
|
66
61
|
switch (Notification_1.SCNotificationMapping[dataMsg.data.activity_type]) {
|
|
67
62
|
case types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_GROUP:
|
|
68
63
|
_status = types_1.SCGroupSubscriptionStatusType.INVITED;
|
|
69
64
|
break;
|
|
70
|
-
case types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP:
|
|
71
|
-
_status = types_1.SCGroupSubscriptionStatusType.REQUESTED;
|
|
72
|
-
break;
|
|
73
|
-
case types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP:
|
|
74
|
-
_status = types_1.SCGroupSubscriptionStatusType.SUBSCRIBED;
|
|
75
|
-
break;
|
|
76
65
|
case types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP:
|
|
77
|
-
|
|
66
|
+
if (dataMsg.data.notification_obj.group && ((_a = dataMsg.data.notification_obj.group.paywalls) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
67
|
+
_status = types_1.SCGroupSubscriptionStatusType.PAYMENT_WAITING;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
_status = types_1.SCGroupSubscriptionStatusType.SUBSCRIBED;
|
|
71
|
+
}
|
|
78
72
|
break;
|
|
79
73
|
}
|
|
80
74
|
updateCache([dataMsg.data.group]);
|
|
@@ -93,8 +87,8 @@ function useSCSubscribedGroupsManager(user) {
|
|
|
93
87
|
// Only if user is authenticated
|
|
94
88
|
api_services_1.http
|
|
95
89
|
.request({
|
|
96
|
-
url: api_services_1.Endpoints.
|
|
97
|
-
method: api_services_1.Endpoints.
|
|
90
|
+
url: api_services_1.Endpoints.GetUserSubscribedGroups.url({ id: user.id }),
|
|
91
|
+
method: api_services_1.Endpoints.GetUserSubscribedGroups.method,
|
|
98
92
|
})
|
|
99
93
|
.then((res) => {
|
|
100
94
|
if (res.status >= 300) {
|
|
@@ -115,50 +109,31 @@ function useSCSubscribedGroupsManager(user) {
|
|
|
115
109
|
* Memoized subscribe Group
|
|
116
110
|
* Toggle action
|
|
117
111
|
*/
|
|
118
|
-
const subscribe = (0, react_1.useMemo)(() => (group
|
|
112
|
+
const subscribe = (0, react_1.useMemo)(() => (group) => {
|
|
119
113
|
setLoading(group.id);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
return api_services_1.http
|
|
139
|
-
.request({
|
|
140
|
-
url: api_services_1.Endpoints.SubscribeToGroup.url({ id: group.id }),
|
|
141
|
-
method: api_services_1.Endpoints.SubscribeToGroup.method,
|
|
142
|
-
})
|
|
143
|
-
.then((res) => {
|
|
144
|
-
if (res.status >= 300) {
|
|
145
|
-
return Promise.reject(res);
|
|
146
|
-
}
|
|
147
|
-
updateCache([group.id]);
|
|
148
|
-
setData((prev) => getDataUpdated(prev, group.id, group.privacy === types_1.SCGroupPrivacyType.PRIVATE && group.subscription_status !== types_1.SCGroupSubscriptionStatusType.INVITED
|
|
149
|
-
? types_1.SCGroupSubscriptionStatusType.REQUESTED
|
|
150
|
-
: types_1.SCGroupSubscriptionStatusType.SUBSCRIBED));
|
|
151
|
-
setUnLoading(group.id);
|
|
152
|
-
return Promise.resolve(res.data);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
114
|
+
return api_services_1.http
|
|
115
|
+
.request({
|
|
116
|
+
url: api_services_1.Endpoints.SubscribeToGroup.url({ id: group.id }),
|
|
117
|
+
method: api_services_1.Endpoints.SubscribeToGroup.method,
|
|
118
|
+
})
|
|
119
|
+
.then((res) => {
|
|
120
|
+
if (res.status >= 300) {
|
|
121
|
+
return Promise.reject(res);
|
|
122
|
+
}
|
|
123
|
+
updateCache([group.id]);
|
|
124
|
+
setData((prev) => getDataUpdated(prev, group.id, group.privacy === types_1.SCGroupPrivacyType.PRIVATE && group.subscription_status !== types_1.SCGroupSubscriptionStatusType.INVITED
|
|
125
|
+
? types_1.SCGroupSubscriptionStatusType.REQUESTED
|
|
126
|
+
: types_1.SCGroupSubscriptionStatusType.SUBSCRIBED));
|
|
127
|
+
setUnLoading(group.id);
|
|
128
|
+
return Promise.resolve(res.data);
|
|
129
|
+
});
|
|
155
130
|
}, [data, loading, cache]);
|
|
156
131
|
/**
|
|
157
132
|
* Memoized subscribe Group
|
|
158
133
|
* Toggle action
|
|
159
134
|
*/
|
|
160
135
|
const unsubscribe = (0, react_1.useMemo)(() => (group) => {
|
|
161
|
-
if (group.
|
|
136
|
+
if (data[group.id] !== types_1.SCGroupSubscriptionStatusType.REQUESTED) {
|
|
162
137
|
setLoading(group.id);
|
|
163
138
|
return api_services_1.http
|
|
164
139
|
.request({
|
|
@@ -251,7 +226,7 @@ function useSCSubscribedGroupsManager(user) {
|
|
|
251
226
|
if (cache.includes(group.id)) {
|
|
252
227
|
return getCurrentGroupCacheStatus(group);
|
|
253
228
|
}
|
|
254
|
-
if (authUserId) {
|
|
229
|
+
if (authUserId && group) {
|
|
255
230
|
if ('subscription_status' in group) {
|
|
256
231
|
return getSubscriptionStatus(group);
|
|
257
232
|
}
|
|
@@ -260,7 +235,7 @@ function useSCSubscribedGroupsManager(user) {
|
|
|
260
235
|
}
|
|
261
236
|
}
|
|
262
237
|
return null;
|
|
263
|
-
}, [loading, cache, authUserId]);
|
|
238
|
+
}, [loading, cache, authUserId, getSubscriptionStatus, getCurrentGroupCacheStatus]);
|
|
264
239
|
/**
|
|
265
240
|
* Empty cache on logout
|
|
266
241
|
*/
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ import * as SCCache from './constants/Cache';
|
|
|
42
42
|
* Custom Hooks
|
|
43
43
|
*/
|
|
44
44
|
import useSCFetchUser from './hooks/useSCFetchUser';
|
|
45
|
+
import useSCFetchUsers from './hooks/useSCFetchUsers';
|
|
45
46
|
import useSCFetchUserProviders from './hooks/useSCFetchUserProviders';
|
|
46
47
|
import useSCFetchVote from './hooks/useSCFetchVote';
|
|
47
48
|
import useSCFetchFeedObject from './hooks/useSCFetchFeedObject';
|
|
@@ -71,6 +72,13 @@ import useSCGoogleApiLoader from './hooks/useSCGoogleApiLoader';
|
|
|
71
72
|
import useSCFetchCourse from './hooks/useSCFetchCourse';
|
|
72
73
|
import useSCFetchCourses from './hooks/useSCFetchCourses';
|
|
73
74
|
import useSCFetchLesson from './hooks/useSCFetchLesson';
|
|
75
|
+
import useSCPaymentsEnabled from './hooks/useSCPaymentsEnabled';
|
|
76
|
+
import useSCFetchPaymentProduct from './hooks/useSCFetchPaymentProduct';
|
|
77
|
+
import useSCFetchPaymentOrder from './hooks/useSCFetchPaymentOrder';
|
|
78
|
+
import useFetchMenuFooter from './hooks/useFetchMenuFooter';
|
|
79
|
+
import useSCPreference, { useSCPreferenceEnabled, useSCPreferencesEnabled } from './hooks/useSCPreference';
|
|
80
|
+
import { useSCFeatureEnabled, useSCFeaturesEnabled } from './hooks/useSCFeature';
|
|
81
|
+
import useSCPreferencesAndFeaturesEnabled from './hooks/useSCPreferencesAndFeaturesEnabled';
|
|
74
82
|
/**
|
|
75
83
|
* Routing component
|
|
76
84
|
*/
|
|
@@ -82,7 +90,7 @@ import * as SCRoutes from './constants/Routes';
|
|
|
82
90
|
*/
|
|
83
91
|
import * as UserUtils from './utils/user';
|
|
84
92
|
import getTheme from './themes/theme';
|
|
85
|
-
import { useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility } from './utils/hooks';
|
|
93
|
+
import { useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useResizeObserver } from './utils/hooks';
|
|
86
94
|
import { getEventStatus } from './utils/event';
|
|
87
95
|
/**
|
|
88
96
|
* Constants:
|
|
@@ -93,4 +101,4 @@ import * as Preferences from './constants/Preferences';
|
|
|
93
101
|
/**
|
|
94
102
|
* List all exports
|
|
95
103
|
*/
|
|
96
|
-
export { SCUserContextType, SCFollowedCategoriesManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCSettingsManagerType, SCFollowedManagerType, SCFollowersManagerType, SCConnectionsManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType, SCJoinedCoursesManagerType, SCContext, SCUserContext, SCThemeContext, SCRoutingContext, SCLocaleContext, SCPreferencesContext, useSCContext, SCContextProvider, SCUserProvider, useSCUser, useSCPreferences, SCThemeProvider, useSCTheme, withSCTheme, getTheme, SCRoutingProvider, useSCRouting, SCLocaleProvider, useSCLocale, withSCLocale, SCPreferencesProvider, SCPreferences, SCFeatures, SCNotification, SCNotificationProvider, SCNotificationContext, useSCNotification, SCAlertMessagesProvider, SCAlertMessagesContext, useSCAlertMessages, Link, SCRoutes, SCCache, UserUtils, getEventStatus, Locale, Preferences, useSCFetchUser, useSCFetchUserProviders, useSCFetchVote, useSCFetchFeedObject, useSCFetchCommentObject, useSCFetchCommentObjects, useSCFetchLessonCommentObject, useSCFetchLessonCommentObjects, useSCFetchCustomAdv, useSCFetchTag, useSCFetchAddressingTagList, useSCFetchCategory, useSCFetchCategories, useSCFetchIncubator, useSCMediaClick, useSCFetchContributors, useSCFetchFeed, useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useSCFetchPrivateMessageSnippets, useSCFetchBroadcastMessages, useSCFetchUserBlockedBy, useSCUserIsBlocked, useSCFetchGroup, useSCFetchGroups, useSCFetchEvent, useSCFetchEvents, useSCFetchLiveStream, useSCGoogleApiLoader, useSCFetchCourse, useSCFetchCourses, useSCFetchLesson, };
|
|
104
|
+
export { SCUserContextType, SCFollowedCategoriesManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCSettingsManagerType, SCFollowedManagerType, SCFollowersManagerType, SCConnectionsManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType, SCJoinedCoursesManagerType, SCContext, SCUserContext, SCThemeContext, SCRoutingContext, SCLocaleContext, SCPreferencesContext, useSCContext, SCContextProvider, SCUserProvider, useSCUser, useSCPreferences, SCThemeProvider, useSCTheme, withSCTheme, getTheme, SCRoutingProvider, useSCRouting, SCLocaleProvider, useSCLocale, withSCLocale, SCPreferencesProvider, SCPreferences, SCFeatures, SCNotification, SCNotificationProvider, SCNotificationContext, useSCNotification, SCAlertMessagesProvider, SCAlertMessagesContext, useSCAlertMessages, Link, SCRoutes, SCCache, UserUtils, getEventStatus, Locale, Preferences, useSCFetchUser, useSCFetchUsers, useSCFetchUserProviders, useSCFetchVote, useSCFetchFeedObject, useSCFetchCommentObject, useSCFetchCommentObjects, useSCFetchLessonCommentObject, useSCFetchLessonCommentObjects, useSCFetchCustomAdv, useSCFetchTag, useSCFetchAddressingTagList, useSCFetchCategory, useSCFetchCategories, useSCFetchIncubator, useSCMediaClick, useSCFetchContributors, useSCFetchFeed, useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useResizeObserver, useSCFetchPrivateMessageSnippets, useSCFetchBroadcastMessages, useSCFetchUserBlockedBy, useSCUserIsBlocked, useSCFetchGroup, useSCFetchGroups, useSCFetchEvent, useSCFetchEvents, useSCFetchLiveStream, useSCGoogleApiLoader, useSCFetchCourse, useSCFetchCourses, useSCFetchLesson, useSCPaymentsEnabled, useSCFetchPaymentProduct, useSCFetchPaymentOrder, useFetchMenuFooter, useSCPreference, useSCPreferenceEnabled, useSCPreferencesEnabled, useSCFeatureEnabled, useSCFeaturesEnabled, useSCPreferencesAndFeaturesEnabled, };
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.useSCFetchLesson = exports.useSCFetchCourses = exports.useSCFetchCourse = exports.useSCGoogleApiLoader = exports.useSCFetchLiveStream = exports.useSCFetchEvents = exports.useSCFetchEvent = exports.useSCFetchGroups = exports.useSCFetchGroup = exports.useSCUserIsBlocked = exports.useSCFetchUserBlockedBy = exports.useSCFetchBroadcastMessages = exports.useSCFetchPrivateMessageSnippets = exports.usePageVisibility = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = exports.useIsComponentMountedRef = exports.useSCFetchFeed = exports.useSCFetchContributors = exports.useSCMediaClick = exports.useSCFetchIncubator = void 0;
|
|
3
|
+
exports.useSCFetchCategory = exports.useSCFetchAddressingTagList = exports.useSCFetchTag = exports.useSCFetchCustomAdv = exports.useSCFetchLessonCommentObjects = exports.useSCFetchLessonCommentObject = exports.useSCFetchCommentObjects = exports.useSCFetchCommentObject = exports.useSCFetchFeedObject = exports.useSCFetchVote = exports.useSCFetchUserProviders = exports.useSCFetchUsers = exports.useSCFetchUser = exports.Preferences = exports.Locale = exports.getEventStatus = exports.UserUtils = exports.SCCache = exports.SCRoutes = exports.Link = exports.useSCAlertMessages = exports.SCAlertMessagesContext = exports.SCAlertMessagesProvider = exports.useSCNotification = exports.SCNotificationContext = exports.SCNotificationProvider = exports.SCNotification = exports.SCFeatures = exports.SCPreferences = exports.SCPreferencesProvider = exports.withSCLocale = exports.useSCLocale = exports.SCLocaleProvider = exports.useSCRouting = exports.SCRoutingProvider = exports.getTheme = exports.withSCTheme = exports.useSCTheme = exports.SCThemeProvider = exports.useSCPreferences = exports.useSCUser = exports.SCUserProvider = exports.SCContextProvider = exports.useSCContext = exports.SCPreferencesContext = exports.SCLocaleContext = exports.SCRoutingContext = exports.SCThemeContext = exports.SCUserContext = exports.SCContext = void 0;
|
|
4
|
+
exports.useSCPreferencesAndFeaturesEnabled = exports.useSCFeaturesEnabled = exports.useSCFeatureEnabled = exports.useSCPreferencesEnabled = exports.useSCPreferenceEnabled = exports.useSCPreference = exports.useFetchMenuFooter = exports.useSCFetchPaymentOrder = exports.useSCFetchPaymentProduct = exports.useSCPaymentsEnabled = exports.useSCFetchLesson = exports.useSCFetchCourses = exports.useSCFetchCourse = exports.useSCGoogleApiLoader = exports.useSCFetchLiveStream = exports.useSCFetchEvents = exports.useSCFetchEvent = exports.useSCFetchGroups = exports.useSCFetchGroup = exports.useSCUserIsBlocked = exports.useSCFetchUserBlockedBy = exports.useSCFetchBroadcastMessages = exports.useSCFetchPrivateMessageSnippets = exports.useResizeObserver = exports.usePageVisibility = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = exports.useIsComponentMountedRef = exports.useSCFetchFeed = exports.useSCFetchContributors = exports.useSCMediaClick = exports.useSCFetchIncubator = exports.useSCFetchCategories = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
/**
|
|
7
7
|
* ContextProvider component
|
|
@@ -74,6 +74,8 @@ exports.SCCache = SCCache;
|
|
|
74
74
|
*/
|
|
75
75
|
const useSCFetchUser_1 = tslib_1.__importDefault(require("./hooks/useSCFetchUser"));
|
|
76
76
|
exports.useSCFetchUser = useSCFetchUser_1.default;
|
|
77
|
+
const useSCFetchUsers_1 = tslib_1.__importDefault(require("./hooks/useSCFetchUsers"));
|
|
78
|
+
exports.useSCFetchUsers = useSCFetchUsers_1.default;
|
|
77
79
|
const useSCFetchUserProviders_1 = tslib_1.__importDefault(require("./hooks/useSCFetchUserProviders"));
|
|
78
80
|
exports.useSCFetchUserProviders = useSCFetchUserProviders_1.default;
|
|
79
81
|
const useSCFetchVote_1 = tslib_1.__importDefault(require("./hooks/useSCFetchVote"));
|
|
@@ -132,6 +134,23 @@ const useSCFetchCourses_1 = tslib_1.__importDefault(require("./hooks/useSCFetchC
|
|
|
132
134
|
exports.useSCFetchCourses = useSCFetchCourses_1.default;
|
|
133
135
|
const useSCFetchLesson_1 = tslib_1.__importDefault(require("./hooks/useSCFetchLesson"));
|
|
134
136
|
exports.useSCFetchLesson = useSCFetchLesson_1.default;
|
|
137
|
+
const useSCPaymentsEnabled_1 = tslib_1.__importDefault(require("./hooks/useSCPaymentsEnabled"));
|
|
138
|
+
exports.useSCPaymentsEnabled = useSCPaymentsEnabled_1.default;
|
|
139
|
+
const useSCFetchPaymentProduct_1 = tslib_1.__importDefault(require("./hooks/useSCFetchPaymentProduct"));
|
|
140
|
+
exports.useSCFetchPaymentProduct = useSCFetchPaymentProduct_1.default;
|
|
141
|
+
const useSCFetchPaymentOrder_1 = tslib_1.__importDefault(require("./hooks/useSCFetchPaymentOrder"));
|
|
142
|
+
exports.useSCFetchPaymentOrder = useSCFetchPaymentOrder_1.default;
|
|
143
|
+
const useFetchMenuFooter_1 = tslib_1.__importDefault(require("./hooks/useFetchMenuFooter"));
|
|
144
|
+
exports.useFetchMenuFooter = useFetchMenuFooter_1.default;
|
|
145
|
+
const useSCPreference_1 = tslib_1.__importStar(require("./hooks/useSCPreference"));
|
|
146
|
+
exports.useSCPreference = useSCPreference_1.default;
|
|
147
|
+
Object.defineProperty(exports, "useSCPreferenceEnabled", { enumerable: true, get: function () { return useSCPreference_1.useSCPreferenceEnabled; } });
|
|
148
|
+
Object.defineProperty(exports, "useSCPreferencesEnabled", { enumerable: true, get: function () { return useSCPreference_1.useSCPreferencesEnabled; } });
|
|
149
|
+
const useSCFeature_1 = require("./hooks/useSCFeature");
|
|
150
|
+
Object.defineProperty(exports, "useSCFeatureEnabled", { enumerable: true, get: function () { return useSCFeature_1.useSCFeatureEnabled; } });
|
|
151
|
+
Object.defineProperty(exports, "useSCFeaturesEnabled", { enumerable: true, get: function () { return useSCFeature_1.useSCFeaturesEnabled; } });
|
|
152
|
+
const useSCPreferencesAndFeaturesEnabled_1 = tslib_1.__importDefault(require("./hooks/useSCPreferencesAndFeaturesEnabled"));
|
|
153
|
+
exports.useSCPreferencesAndFeaturesEnabled = useSCPreferencesAndFeaturesEnabled_1.default;
|
|
135
154
|
/**
|
|
136
155
|
* Routing component
|
|
137
156
|
*/
|
|
@@ -154,6 +173,7 @@ Object.defineProperty(exports, "useIsomorphicLayoutEffect", { enumerable: true,
|
|
|
154
173
|
Object.defineProperty(exports, "useEffectOnce", { enumerable: true, get: function () { return hooks_1.useEffectOnce; } });
|
|
155
174
|
Object.defineProperty(exports, "useNoInitialEffect", { enumerable: true, get: function () { return hooks_1.useNoInitialEffect; } });
|
|
156
175
|
Object.defineProperty(exports, "usePageVisibility", { enumerable: true, get: function () { return hooks_1.usePageVisibility; } });
|
|
176
|
+
Object.defineProperty(exports, "useResizeObserver", { enumerable: true, get: function () { return hooks_1.useResizeObserver; } });
|
|
157
177
|
const event_1 = require("./utils/event");
|
|
158
178
|
Object.defineProperty(exports, "getEventStatus", { enumerable: true, get: function () { return event_1.getEventStatus; } });
|
|
159
179
|
/**
|
package/lib/cjs/themes/theme.js
CHANGED
|
@@ -51,6 +51,18 @@ const getTheme = (options, preferences) => {
|
|
|
51
51
|
sizeXLarge: 120,
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
|
+
contentProduct: {
|
|
55
|
+
icon: {
|
|
56
|
+
sizeSmall: 24,
|
|
57
|
+
sizeMedium: 40,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
contentProductPrice: {
|
|
61
|
+
icon: {
|
|
62
|
+
sizeSmall: 24,
|
|
63
|
+
sizeMedium: 40,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
54
66
|
};
|
|
55
67
|
const defaultOptions = preferences
|
|
56
68
|
? {
|
package/lib/cjs/types/theme.d.ts
CHANGED
|
@@ -55,6 +55,32 @@ export interface SCThemeCategoryIconVariableType {
|
|
|
55
55
|
*/
|
|
56
56
|
sizeLarge: number;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Interface SCThemeContentProductIconVariableType
|
|
60
|
+
*/
|
|
61
|
+
export interface SCThemeContentProductIconVariableType {
|
|
62
|
+
/**
|
|
63
|
+
* ContentProduct size small
|
|
64
|
+
*/
|
|
65
|
+
sizeSmall: number;
|
|
66
|
+
/**
|
|
67
|
+
* ContentProduct size medium
|
|
68
|
+
*/
|
|
69
|
+
sizeMedium: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Interface SCThemeContentProductPriceIconVariableType
|
|
73
|
+
*/
|
|
74
|
+
export interface SCThemeContentProductPriceIconVariableType {
|
|
75
|
+
/**
|
|
76
|
+
* ContentProductPrice size small
|
|
77
|
+
*/
|
|
78
|
+
sizeSmall: number;
|
|
79
|
+
/**
|
|
80
|
+
* ContentProductPrice size medium
|
|
81
|
+
*/
|
|
82
|
+
sizeMedium: number;
|
|
83
|
+
}
|
|
58
84
|
/**
|
|
59
85
|
* Interface SCThemeCategoryVariableType
|
|
60
86
|
*/
|
|
@@ -64,6 +90,24 @@ export interface SCThemeCategoryVariableType {
|
|
|
64
90
|
*/
|
|
65
91
|
icon: SCThemeCategoryIconVariableType;
|
|
66
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Interface SCThemeContentProductVariableType
|
|
95
|
+
*/
|
|
96
|
+
export interface SCThemeContentProductVariableType {
|
|
97
|
+
/**
|
|
98
|
+
* ContentProduct icon size
|
|
99
|
+
*/
|
|
100
|
+
icon: SCThemeContentProductIconVariableType;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Interface SCThemeContentProductPriceVariableType
|
|
104
|
+
*/
|
|
105
|
+
export interface SCThemeContentProductPriceVariableType {
|
|
106
|
+
/**
|
|
107
|
+
* ContentProductPrice icon size
|
|
108
|
+
*/
|
|
109
|
+
icon: SCThemeContentProductPriceIconVariableType;
|
|
110
|
+
}
|
|
67
111
|
/**
|
|
68
112
|
* Interface SCThemeVariablesType
|
|
69
113
|
*/
|
|
@@ -80,6 +124,14 @@ export interface SCThemeVariablesType {
|
|
|
80
124
|
* Group
|
|
81
125
|
*/
|
|
82
126
|
group: SCThemeGroupVariableType;
|
|
127
|
+
/**
|
|
128
|
+
* ContentProduct
|
|
129
|
+
*/
|
|
130
|
+
contentProduct: SCThemeContentProductVariableType;
|
|
131
|
+
/**
|
|
132
|
+
* ContentProductPrice
|
|
133
|
+
*/
|
|
134
|
+
contentProductPrice: SCThemeContentProductPriceVariableType;
|
|
83
135
|
}
|
|
84
136
|
export interface SCThemeType extends MuiTheme {
|
|
85
137
|
/**
|
|
@@ -4,4 +4,5 @@ import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect';
|
|
|
4
4
|
import useEffectOnce from './useEffectOnce';
|
|
5
5
|
import useNoInitialEffect from './useNoInitialEffect';
|
|
6
6
|
import usePageVisibility from './usePageVisibility';
|
|
7
|
-
|
|
7
|
+
import useResizeObserver from './useResizeObserver';
|
|
8
|
+
export { useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useResizeObserver, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usePageVisibility = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = exports.useIsComponentMountedRef = void 0;
|
|
3
|
+
exports.useResizeObserver = exports.usePageVisibility = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = exports.useIsComponentMountedRef = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const useIsComponentMountedRef_1 = tslib_1.__importDefault(require("./useIsComponentMountedRef"));
|
|
6
6
|
exports.useIsComponentMountedRef = useIsComponentMountedRef_1.default;
|
|
@@ -14,3 +14,5 @@ const useNoInitialEffect_1 = tslib_1.__importDefault(require("./useNoInitialEffe
|
|
|
14
14
|
exports.useNoInitialEffect = useNoInitialEffect_1.default;
|
|
15
15
|
const usePageVisibility_1 = tslib_1.__importDefault(require("./usePageVisibility"));
|
|
16
16
|
exports.usePageVisibility = usePageVisibility_1.default;
|
|
17
|
+
const useResizeObserver_1 = tslib_1.__importDefault(require("./useResizeObserver"));
|
|
18
|
+
exports.useResizeObserver = useResizeObserver_1.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useResizeObserver(element: Element | null, options: ResizeObserverOptions | undefined, observerCallback: ResizeObserverCallback): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
function useResizeObserver(element, options, observerCallback) {
|
|
5
|
+
(0, react_1.useEffect)(() => {
|
|
6
|
+
if (!element || !('ResizeObserver' in window)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const observer = new ResizeObserver(observerCallback);
|
|
10
|
+
observer.observe(element, options);
|
|
11
|
+
return () => {
|
|
12
|
+
observer.disconnect();
|
|
13
|
+
};
|
|
14
|
+
}, [element, options, observerCallback]);
|
|
15
|
+
}
|
|
16
|
+
exports.default = useResizeObserver;
|
package/lib/cjs/utils/user.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { SCUserType } from '@selfcommunity/types';
|
|
|
6
6
|
export declare const ADMIN_ROLE = "admin";
|
|
7
7
|
export declare const MODERATOR_ROLE = "moderator";
|
|
8
8
|
export declare const EDITOR_ROLE = "editor";
|
|
9
|
+
export declare const PUBLISHER_ROLE = "publisher";
|
|
9
10
|
export declare const COMMUNITY_CREATOR = 1;
|
|
10
11
|
/**
|
|
11
12
|
* Get user role from roles(set)
|
|
@@ -38,7 +39,13 @@ export declare function isModerator(user: SCUserType): boolean;
|
|
|
38
39
|
*/
|
|
39
40
|
export declare function isEditor(user: SCUserType): boolean;
|
|
40
41
|
/**
|
|
41
|
-
* Check if user is
|
|
42
|
+
* Check if user is publisher
|
|
43
|
+
* @param user
|
|
44
|
+
* @returns boolean
|
|
45
|
+
*/
|
|
46
|
+
export declare function isPublisher(user: SCUserType): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Check if user is admin, moderator, editor or publisher
|
|
42
49
|
* @param user
|
|
43
50
|
* @returns boolean
|
|
44
51
|
*/
|
package/lib/cjs/utils/user.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isBlocked = exports.isStaff = exports.isEditor = exports.isModerator = exports.isCommunityCreator = exports.isAdmin = exports.getUserRole = exports.COMMUNITY_CREATOR = exports.EDITOR_ROLE = exports.MODERATOR_ROLE = exports.ADMIN_ROLE = void 0;
|
|
3
|
+
exports.isBlocked = exports.isStaff = exports.isPublisher = exports.isEditor = exports.isModerator = exports.isCommunityCreator = exports.isAdmin = exports.getUserRole = exports.COMMUNITY_CREATOR = exports.PUBLISHER_ROLE = exports.EDITOR_ROLE = exports.MODERATOR_ROLE = exports.ADMIN_ROLE = void 0;
|
|
4
4
|
const types_1 = require("@selfcommunity/types");
|
|
5
5
|
/**
|
|
6
6
|
* Staff Roles
|
|
@@ -9,6 +9,7 @@ const types_1 = require("@selfcommunity/types");
|
|
|
9
9
|
exports.ADMIN_ROLE = 'admin';
|
|
10
10
|
exports.MODERATOR_ROLE = 'moderator';
|
|
11
11
|
exports.EDITOR_ROLE = 'editor';
|
|
12
|
+
exports.PUBLISHER_ROLE = 'publisher';
|
|
12
13
|
exports.COMMUNITY_CREATOR = 1;
|
|
13
14
|
/**
|
|
14
15
|
* Get user role from roles(set)
|
|
@@ -27,6 +28,9 @@ function getUserRole(user) {
|
|
|
27
28
|
else if (role === exports.EDITOR_ROLE) {
|
|
28
29
|
return exports.EDITOR_ROLE;
|
|
29
30
|
}
|
|
31
|
+
else if (role === exports.PUBLISHER_ROLE) {
|
|
32
|
+
return exports.PUBLISHER_ROLE;
|
|
33
|
+
}
|
|
30
34
|
}
|
|
31
35
|
return null;
|
|
32
36
|
}
|
|
@@ -68,7 +72,16 @@ function isEditor(user) {
|
|
|
68
72
|
}
|
|
69
73
|
exports.isEditor = isEditor;
|
|
70
74
|
/**
|
|
71
|
-
* Check if user is
|
|
75
|
+
* Check if user is publisher
|
|
76
|
+
* @param user
|
|
77
|
+
* @returns boolean
|
|
78
|
+
*/
|
|
79
|
+
function isPublisher(user) {
|
|
80
|
+
return getUserRole(user) === exports.PUBLISHER_ROLE;
|
|
81
|
+
}
|
|
82
|
+
exports.isPublisher = isPublisher;
|
|
83
|
+
/**
|
|
84
|
+
* Check if user is admin, moderator, editor or publisher
|
|
72
85
|
* @param user
|
|
73
86
|
* @returns boolean
|
|
74
87
|
*/
|
|
@@ -76,6 +76,18 @@ export declare const getPmSnippetsObjectCacheKey: () => string;
|
|
|
76
76
|
/** PRIVATE MESSAGE SNIPPET OBJECT **/
|
|
77
77
|
export declare const PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = "_pms_";
|
|
78
78
|
export declare const getPmSnippetObjectCacheKey: (id: any) => string;
|
|
79
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
80
|
+
export declare const PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY = "_ppo_";
|
|
81
|
+
export declare const getPaymentProductObjectCacheKey: (id: any) => string;
|
|
82
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
83
|
+
export declare const PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY = "_pord_";
|
|
84
|
+
export declare const getPaymentOrderObjectCacheKey: (id: any) => string;
|
|
85
|
+
/** USER OBJECT **/
|
|
86
|
+
export declare const USER_OBJECT_CACHE_PREFIX_KEY = "_usr_";
|
|
87
|
+
export declare const getUserObjectCacheKey: (id: number) => string;
|
|
88
|
+
/** USERS OBJECT **/
|
|
89
|
+
export declare const USERS_OBJECT_CACHE_PREFIX_KEY = "_usrs_";
|
|
90
|
+
export declare const getUsersObjectCacheKey: (search?: string) => string;
|
|
79
91
|
/** TOOLS */
|
|
80
92
|
export declare const CATEGORIES_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = "_cListWidget_";
|
|
81
93
|
export declare const CATEGORIES_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = "_cFolWidget_";
|
|
@@ -80,6 +80,18 @@ export const getPmSnippetsObjectCacheKey = () => `${PM_SNIPPETS_OBJECT_CACHE_PRE
|
|
|
80
80
|
/** PRIVATE MESSAGE SNIPPET OBJECT **/
|
|
81
81
|
export const PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = '_pms_';
|
|
82
82
|
export const getPmSnippetObjectCacheKey = (id) => `${PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
83
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
84
|
+
export const PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY = '_ppo_';
|
|
85
|
+
export const getPaymentProductObjectCacheKey = (id) => `${PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
86
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
87
|
+
export const PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY = '_pord_';
|
|
88
|
+
export const getPaymentOrderObjectCacheKey = (id) => `${PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
89
|
+
/** USER OBJECT **/
|
|
90
|
+
export const USER_OBJECT_CACHE_PREFIX_KEY = '_usr_';
|
|
91
|
+
export const getUserObjectCacheKey = (id) => `${USER_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
92
|
+
/** USERS OBJECT **/
|
|
93
|
+
export const USERS_OBJECT_CACHE_PREFIX_KEY = '_usrs_';
|
|
94
|
+
export const getUsersObjectCacheKey = (search) => search ? `${USERS_OBJECT_CACHE_PREFIX_KEY}${encodeURIComponent(search)}` : `${USERS_OBJECT_CACHE_PREFIX_KEY}`;
|
|
83
95
|
/** TOOLS */
|
|
84
96
|
export const CATEGORIES_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = '_cListWidget_';
|
|
85
97
|
export const CATEGORIES_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = '_cFolWidget_';
|
|
@@ -81,6 +81,8 @@ export declare const ADDONS_POST_GEOLOCATION_ENABLED: string;
|
|
|
81
81
|
export declare const ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED: string;
|
|
82
82
|
export declare const ADDONS_SHARE_POST_ON_TWITTER_ENABLED: string;
|
|
83
83
|
export declare const ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED: string;
|
|
84
|
+
export declare const ADDONS_PRIVATE_MESSAGES_ENABLED: string;
|
|
85
|
+
export declare const ADDONS_SHARE_POST_ENABLED: string;
|
|
84
86
|
/**
|
|
85
87
|
* ADVERTISING
|
|
86
88
|
*/
|
|
@@ -89,6 +91,7 @@ export declare const ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED: st
|
|
|
89
91
|
/**
|
|
90
92
|
* CONFIGURATIONS
|
|
91
93
|
*/
|
|
94
|
+
export declare const CONFIGURATIONS_CONNECTION_ENABLED: string;
|
|
92
95
|
export declare const CONFIGURATIONS_FOLLOW_ENABLED: string;
|
|
93
96
|
export declare const CONFIGURATIONS_EXPLORE_STREAM_ENABLED: string;
|
|
94
97
|
export declare const CONFIGURATIONS_EXPLORE_STREAM_ORDER_BY: string;
|
|
@@ -146,6 +149,20 @@ export declare const CONFIGURATIONS_LIVE_STREAM_ENABLED: string;
|
|
|
146
149
|
export declare const CONFIGURATIONS_LIVE_STREAM_ONLY_STAFF_ENABLED: string;
|
|
147
150
|
export declare const CONFIGURATIONS_LIVE_VIDEO_CONFERENCE_ENABLED: string;
|
|
148
151
|
export declare const CONFIGURATIONS_SUBSCRIPTION_TIER: string;
|
|
152
|
+
export declare const CONFIGURATIONS_PAYMENTS_ENABLED: string;
|
|
153
|
+
export declare const CONFIGURATIONS_STRIPE_CONNECTED_ACCOUNT_ID: string;
|
|
154
|
+
export declare const CONFIGURATIONS_CONTEXT_MENU_ENABLED: string;
|
|
155
|
+
export declare const CONFIGURATIONS_CATEGORY_FOLLOW_ENABLED: string;
|
|
156
|
+
export declare const CONFIGURATIONS_COMMENTS_ENABLED: string;
|
|
157
|
+
export declare const CONFIGURATIONS_SIDEBAR_SHOW_ALL_CATEGORIES_ENABLED: string;
|
|
158
|
+
export declare const CONFIGURATIONS_VIDEO_AUTOPLAY_ENABLED: string;
|
|
159
|
+
export declare const CONFIGURATIONS_VIDEO_PLAY_TRACKING_DELAY_SECONDS: string;
|
|
160
|
+
export declare const CONFIGURATIONS_SCHEDULED_POSTS_ENABLED: string;
|
|
161
|
+
export declare const CONFIGURATIONS_POST_CATEGORY_REQUIRED_ENABLED: string;
|
|
162
|
+
export declare const CONFIGURATIONS_POST_ADDRESSING_REQUIRED_ENABLED: string;
|
|
163
|
+
export declare const CONFIGURATIONS_POST_USER_ADDRESSING_ENABLED: string;
|
|
164
|
+
export declare const CONFIGURATIONS_CONTACT_API_ENABLED: string;
|
|
165
|
+
export declare const CONFIGURATIONS_ACCEPTED_MEDIA_MIMETYPES: string;
|
|
149
166
|
/**
|
|
150
167
|
* PROVIDERS
|
|
151
168
|
*/
|
|
@@ -177,6 +194,7 @@ export declare const WEBMASTER_META_DESCRIPTION: string;
|
|
|
177
194
|
*/
|
|
178
195
|
export declare const STATIC_ENVIRONMENT: string;
|
|
179
196
|
export declare const STATIC_STACKID: string;
|
|
197
|
+
export declare const STATIC_STRIPE_PUBLIC_KEY: string;
|
|
180
198
|
export declare const getPreferenceSection: (value: any) => any;
|
|
181
199
|
export declare const getPreferenceName: (value: any) => any;
|
|
182
200
|
export declare const getPreference: (value: any) => {
|