@selfcommunity/react-core 0.6.7-alpha.8 → 0.6.7-payments.143
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/provider/SCUserProvider/index.js +6 -0
- package/lib/cjs/constants/Cache.d.ts +21 -2
- package/lib/cjs/constants/Cache.js +29 -4
- package/lib/cjs/constants/Preferences.d.ts +13 -0
- package/lib/cjs/constants/Preferences.js +24 -1
- package/lib/cjs/constants/Routes.d.ts +8 -0
- package/lib/cjs/constants/Routes.js +17 -1
- package/lib/cjs/hooks/useSCFetchCategories.d.ts +2 -0
- package/lib/cjs/hooks/useSCFetchCategories.js +7 -4
- package/lib/cjs/hooks/useSCFetchCourse.d.ts +23 -0
- package/lib/cjs/hooks/useSCFetchCourse.js +81 -0
- package/lib/cjs/hooks/useSCFetchCourses.d.ts +22 -0
- package/lib/cjs/hooks/useSCFetchCourses.js +83 -0
- package/lib/cjs/hooks/useSCFetchLesson.d.ts +22 -0
- package/lib/cjs/hooks/useSCFetchLesson.js +72 -0
- package/lib/cjs/hooks/useSCFetchLessonCommentObject.d.ts +23 -0
- package/lib/cjs/hooks/useSCFetchLessonCommentObject.js +72 -0
- package/lib/cjs/hooks/useSCFetchLessonCommentObjects.d.ts +48 -0
- package/lib/cjs/hooks/useSCFetchLessonCommentObjects.js +302 -0
- package/lib/cjs/hooks/useSCFetchUserBlockedBy.js +1 -1
- package/lib/cjs/hooks/useSCJoinedCoursesManager.d.ts +38 -0
- package/lib/cjs/hooks/useSCJoinedCoursesManager.js +277 -0
- package/lib/cjs/index.d.ts +7 -2
- package/lib/cjs/index.js +12 -2
- package/lib/cjs/themes/theme.js +12 -0
- package/lib/cjs/types/context.d.ts +36 -1
- package/lib/cjs/types/index.d.ts +2 -2
- package/lib/cjs/types/theme.d.ts +52 -0
- package/lib/esm/components/provider/SCUserProvider/index.js +6 -0
- package/lib/esm/constants/Cache.d.ts +21 -2
- package/lib/esm/constants/Cache.js +21 -2
- package/lib/esm/constants/Preferences.d.ts +13 -0
- package/lib/esm/constants/Preferences.js +23 -0
- package/lib/esm/constants/Routes.d.ts +8 -0
- package/lib/esm/constants/Routes.js +16 -0
- package/lib/esm/hooks/useSCFetchCategories.d.ts +2 -0
- package/lib/esm/hooks/useSCFetchCategories.js +7 -4
- package/lib/esm/hooks/useSCFetchCourse.d.ts +23 -0
- package/lib/esm/hooks/useSCFetchCourse.js +78 -0
- package/lib/esm/hooks/useSCFetchCourses.d.ts +22 -0
- package/lib/esm/hooks/useSCFetchCourses.js +81 -0
- package/lib/esm/hooks/useSCFetchLesson.d.ts +22 -0
- package/lib/esm/hooks/useSCFetchLesson.js +69 -0
- package/lib/esm/hooks/useSCFetchLessonCommentObject.d.ts +23 -0
- package/lib/esm/hooks/useSCFetchLessonCommentObject.js +69 -0
- package/lib/esm/hooks/useSCFetchLessonCommentObjects.d.ts +48 -0
- package/lib/esm/hooks/useSCFetchLessonCommentObjects.js +297 -0
- package/lib/esm/hooks/useSCFetchUserBlockedBy.js +1 -1
- package/lib/esm/hooks/useSCJoinedCoursesManager.d.ts +38 -0
- package/lib/esm/hooks/useSCJoinedCoursesManager.js +273 -0
- package/lib/esm/index.d.ts +7 -2
- package/lib/esm/index.js +6 -1
- package/lib/esm/themes/theme.js +12 -0
- package/lib/esm/types/context.d.ts +36 -1
- package/lib/esm/types/index.d.ts +2 -2
- package/lib/esm/types/theme.d.ts +52 -0
- package/lib/umd/react-core.js +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
6
|
+
const types_1 = require("@selfcommunity/types");
|
|
7
|
+
const useSCCachingManager_1 = tslib_1.__importDefault(require("./useSCCachingManager"));
|
|
8
|
+
const Errors_1 = require("../constants/Errors");
|
|
9
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
10
|
+
const SCPreferencesProvider_1 = require("../components/provider/SCPreferencesProvider");
|
|
11
|
+
const Notification_1 = require("../constants/Notification");
|
|
12
|
+
const Preferences_1 = require("../constants/Preferences");
|
|
13
|
+
const use_deep_compare_effect_1 = require("use-deep-compare-effect");
|
|
14
|
+
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
15
|
+
/**
|
|
16
|
+
:::info
|
|
17
|
+
This custom hook is used to manage the courses followed.
|
|
18
|
+
:::
|
|
19
|
+
|
|
20
|
+
:::tip How to use it:
|
|
21
|
+
Follow these steps:
|
|
22
|
+
```jsx
|
|
23
|
+
1. const scUserContext: SCUserContextType = useSCUser();
|
|
24
|
+
2. const scJoinedCoursesManager: SCJoinedCoursesManagerType = scUserContext.manager.courses;
|
|
25
|
+
3. scJoinedCoursesManager.isJoined(course)
|
|
26
|
+
```
|
|
27
|
+
:::
|
|
28
|
+
*/
|
|
29
|
+
function useSCJoinedCoursesManager(user) {
|
|
30
|
+
const { cache, updateCache, emptyCache, data, setData, loading, setLoading, setUnLoading, isLoading } = (0, useSCCachingManager_1.default)();
|
|
31
|
+
const { preferences, features } = (0, SCPreferencesProvider_1.useSCPreferences)();
|
|
32
|
+
const authUserId = user ? user.id : null;
|
|
33
|
+
const coursesEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
34
|
+
features &&
|
|
35
|
+
features.includes(types_1.SCFeatureName.TAGGING) &&
|
|
36
|
+
features.includes(types_1.SCFeatureName.COURSE) &&
|
|
37
|
+
Preferences_1.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
38
|
+
preferences[Preferences_1.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
39
|
+
const notificationInvitedToJoinCourse = (0, react_1.useRef)(null);
|
|
40
|
+
const notificationRequestedToJoinCourse = (0, react_1.useRef)(null);
|
|
41
|
+
const notificationAcceptedToJoinCourse = (0, react_1.useRef)(null);
|
|
42
|
+
const notificationAddedToCourse = (0, react_1.useRef)(null);
|
|
43
|
+
/**
|
|
44
|
+
* Subscribe to notification types user_follow, user_unfollow
|
|
45
|
+
*/
|
|
46
|
+
(0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
|
|
47
|
+
notificationInvitedToJoinCourse.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE}`, notificationSubscriber);
|
|
48
|
+
notificationRequestedToJoinCourse.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE}`, notificationSubscriber);
|
|
49
|
+
notificationAcceptedToJoinCourse.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE}`, notificationSubscriber);
|
|
50
|
+
notificationAddedToCourse.current = pubsub_js_1.default.subscribe(`${types_1.SCNotificationTopicType.INTERACTION}.${types_1.SCNotificationTypologyType.USER_ADDED_TO_COURSE}`, notificationSubscriber);
|
|
51
|
+
return () => {
|
|
52
|
+
pubsub_js_1.default.unsubscribe(notificationInvitedToJoinCourse.current);
|
|
53
|
+
pubsub_js_1.default.unsubscribe(notificationRequestedToJoinCourse.current);
|
|
54
|
+
pubsub_js_1.default.unsubscribe(notificationAcceptedToJoinCourse.current);
|
|
55
|
+
pubsub_js_1.default.unsubscribe(notificationAddedToCourse.current);
|
|
56
|
+
};
|
|
57
|
+
}, [data]);
|
|
58
|
+
/**
|
|
59
|
+
* Notification subscriber handler
|
|
60
|
+
* @param msg
|
|
61
|
+
* @param dataMsg
|
|
62
|
+
*/
|
|
63
|
+
const notificationSubscriber = (msg, dataMsg) => {
|
|
64
|
+
if (dataMsg.data.course !== undefined) {
|
|
65
|
+
let _status;
|
|
66
|
+
switch (Notification_1.SCNotificationMapping[dataMsg.data.activity_type]) {
|
|
67
|
+
case types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE:
|
|
68
|
+
_status = types_1.SCCourseJoinStatusType.INVITED;
|
|
69
|
+
break;
|
|
70
|
+
case types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE:
|
|
71
|
+
_status = types_1.SCCourseJoinStatusType.REQUESTED;
|
|
72
|
+
break;
|
|
73
|
+
case types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE:
|
|
74
|
+
_status = types_1.SCCourseJoinStatusType.JOINED;
|
|
75
|
+
break;
|
|
76
|
+
case types_1.SCNotificationTypologyType.USER_ADDED_TO_COURSE:
|
|
77
|
+
_status = types_1.SCCourseJoinStatusType.JOINED;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
updateCache([dataMsg.data.course.id]);
|
|
81
|
+
setData((prev) => getDataUpdated(prev, dataMsg.data.course.id, _status));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Memoized refresh all courses
|
|
86
|
+
* It makes a single request to the server and retrieves
|
|
87
|
+
* all the courses followed by the user in a single solution
|
|
88
|
+
* It might be useful for multi-tab sync
|
|
89
|
+
*/
|
|
90
|
+
const refresh = (0, react_1.useMemo)(() => () => {
|
|
91
|
+
emptyCache();
|
|
92
|
+
if (user) {
|
|
93
|
+
// Only if user is authenticated
|
|
94
|
+
api_services_1.http
|
|
95
|
+
.request({
|
|
96
|
+
url: api_services_1.Endpoints.GetJoinedCourses.url(),
|
|
97
|
+
method: api_services_1.Endpoints.GetJoinedCourses.method,
|
|
98
|
+
})
|
|
99
|
+
.then((res) => {
|
|
100
|
+
if (res.status >= 300) {
|
|
101
|
+
return Promise.reject(res);
|
|
102
|
+
}
|
|
103
|
+
const coursesIds = res.data.results.map((c) => c.id);
|
|
104
|
+
updateCache(coursesIds);
|
|
105
|
+
setData(res.data.results.map((c) => ({ [c.id]: c.join_status })));
|
|
106
|
+
return Promise.resolve(res.data);
|
|
107
|
+
})
|
|
108
|
+
.catch((e) => {
|
|
109
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_CORE, 'Unable to refresh the authenticated user courses.');
|
|
110
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_CORE, e);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}, [data, user, cache]);
|
|
114
|
+
/**
|
|
115
|
+
* Memoized join Course
|
|
116
|
+
* Toggle action
|
|
117
|
+
*/
|
|
118
|
+
const join = (0, react_1.useMemo)(() => (course, userId) => {
|
|
119
|
+
setLoading(course.id);
|
|
120
|
+
if (userId) {
|
|
121
|
+
return api_services_1.http
|
|
122
|
+
.request({
|
|
123
|
+
url: api_services_1.Endpoints.InviteOrAcceptUsersToCourse.url({ id: course.id }),
|
|
124
|
+
method: api_services_1.Endpoints.InviteOrAcceptUsersToCourse.method,
|
|
125
|
+
data: { users: [userId] },
|
|
126
|
+
})
|
|
127
|
+
.then((res) => {
|
|
128
|
+
if (res.status >= 300) {
|
|
129
|
+
return Promise.reject(res);
|
|
130
|
+
}
|
|
131
|
+
updateCache([course.id]);
|
|
132
|
+
setData((prev) => getDataUpdated(prev, course.id, types_1.SCCourseJoinStatusType.JOINED));
|
|
133
|
+
setUnLoading(course.id);
|
|
134
|
+
return Promise.resolve(res.data);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return api_services_1.http
|
|
139
|
+
.request({
|
|
140
|
+
url: api_services_1.Endpoints.JoinOrAcceptInviteToCourse.url({ id: course.id }),
|
|
141
|
+
method: api_services_1.Endpoints.JoinOrAcceptInviteToCourse.method,
|
|
142
|
+
})
|
|
143
|
+
.then((res) => {
|
|
144
|
+
if (res.status >= 300) {
|
|
145
|
+
return Promise.reject(res);
|
|
146
|
+
}
|
|
147
|
+
updateCache([course.id]);
|
|
148
|
+
setData((prev) => getDataUpdated(prev, course.id, course.privacy === types_1.SCCoursePrivacyType.PRIVATE && course.join_status !== types_1.SCCourseJoinStatusType.INVITED
|
|
149
|
+
? types_1.SCCourseJoinStatusType.REQUESTED
|
|
150
|
+
: types_1.SCCourseJoinStatusType.JOINED));
|
|
151
|
+
setUnLoading(course.id);
|
|
152
|
+
return Promise.resolve(res.data);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}, [data, loading, cache]);
|
|
156
|
+
/**
|
|
157
|
+
* Memoized leave Course
|
|
158
|
+
* Toggle action
|
|
159
|
+
*/
|
|
160
|
+
const leave = (0, react_1.useMemo)(() => (course) => {
|
|
161
|
+
if (course.join_status !== types_1.SCCourseJoinStatusType.REQUESTED) {
|
|
162
|
+
setLoading(course.id);
|
|
163
|
+
return api_services_1.http
|
|
164
|
+
.request({
|
|
165
|
+
url: api_services_1.Endpoints.LeaveOrRemoveCourseRequest.url({ id: course.id }),
|
|
166
|
+
method: api_services_1.Endpoints.LeaveOrRemoveCourseRequest.method,
|
|
167
|
+
})
|
|
168
|
+
.then((res) => {
|
|
169
|
+
if (res.status >= 300) {
|
|
170
|
+
return Promise.reject(res);
|
|
171
|
+
}
|
|
172
|
+
updateCache([course.id]);
|
|
173
|
+
setData((prev) => getDataUpdated(prev, course.id, null));
|
|
174
|
+
setUnLoading(course.id);
|
|
175
|
+
return Promise.resolve(res.data);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}, [data, loading, cache]);
|
|
179
|
+
/**
|
|
180
|
+
* Check the authenticated user subscription status to the course
|
|
181
|
+
* Update the courses cached
|
|
182
|
+
* Update courses subscription statuses
|
|
183
|
+
* @param course
|
|
184
|
+
*/
|
|
185
|
+
const checkCourseJoinedStatus = (course) => {
|
|
186
|
+
setLoading(course.id);
|
|
187
|
+
return api_services_1.http
|
|
188
|
+
.request({
|
|
189
|
+
url: api_services_1.Endpoints.GetCourseStatus.url({ id: course.id }),
|
|
190
|
+
method: api_services_1.Endpoints.GetCourseStatus.method,
|
|
191
|
+
})
|
|
192
|
+
.then((res) => {
|
|
193
|
+
if (res.status >= 300) {
|
|
194
|
+
return Promise.reject(res);
|
|
195
|
+
}
|
|
196
|
+
setData((prev) => getDataUpdated(prev, course.id, res.data.status));
|
|
197
|
+
updateCache([course.id]);
|
|
198
|
+
setUnLoading(course.id);
|
|
199
|
+
return Promise.resolve(res.data);
|
|
200
|
+
})
|
|
201
|
+
.catch((e) => {
|
|
202
|
+
setUnLoading(course.id);
|
|
203
|
+
return Promise.reject(e);
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Get updated data
|
|
208
|
+
* @param data
|
|
209
|
+
* @param courseId
|
|
210
|
+
* @param joinStatus
|
|
211
|
+
*/
|
|
212
|
+
const getDataUpdated = (data, courseId, joinStatus) => {
|
|
213
|
+
const _index = data.findIndex((k) => parseInt(Object.keys(k)[0]) === courseId);
|
|
214
|
+
let _data;
|
|
215
|
+
if (_index < 0) {
|
|
216
|
+
_data = [...data, ...[{ [courseId]: joinStatus }]];
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
_data = data.map((k, i) => {
|
|
220
|
+
if (parseInt(Object.keys(k)[0]) === courseId) {
|
|
221
|
+
return { [Object.keys(k)[0]]: joinStatus };
|
|
222
|
+
}
|
|
223
|
+
return { [Object.keys(k)[0]]: data[i][Object.keys(k)[0]] };
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return _data;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Return current course subscription status if exists,
|
|
230
|
+
* otherwise return null
|
|
231
|
+
*/
|
|
232
|
+
const getCurrentCourseCacheStatus = (0, react_1.useMemo)(() => (course) => {
|
|
233
|
+
const d = data.filter((k) => parseInt(Object.keys(k)[0]) === course.id);
|
|
234
|
+
return d.length ? d[0][course.id] : !data.length ? course.join_status : null;
|
|
235
|
+
}, [data]);
|
|
236
|
+
/**
|
|
237
|
+
* Bypass remote check if the course is subscribed
|
|
238
|
+
*/
|
|
239
|
+
const getJoinStatus = (0, react_1.useMemo)(() => (course) => {
|
|
240
|
+
updateCache([course.id]);
|
|
241
|
+
setData((prev) => getDataUpdated(prev, course.id, course.join_status));
|
|
242
|
+
return course.join_status;
|
|
243
|
+
}, [data, cache]);
|
|
244
|
+
/**
|
|
245
|
+
* Memoized joinStatus
|
|
246
|
+
* If the course is already in cache -> check if the course is in courses,
|
|
247
|
+
* otherwise, check if user joined the course
|
|
248
|
+
*/
|
|
249
|
+
const joinStatus = (0, react_1.useMemo)(() => (course) => {
|
|
250
|
+
// Cache is valid also for anonymous user
|
|
251
|
+
if (cache.includes(course.id)) {
|
|
252
|
+
return getCurrentCourseCacheStatus(course);
|
|
253
|
+
}
|
|
254
|
+
if (authUserId) {
|
|
255
|
+
if ('join_status' in course) {
|
|
256
|
+
return getJoinStatus(course);
|
|
257
|
+
}
|
|
258
|
+
if (!isLoading(course)) {
|
|
259
|
+
checkCourseJoinedStatus(course);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}, [loading, cache, authUserId]);
|
|
264
|
+
/**
|
|
265
|
+
* Empty cache on logout
|
|
266
|
+
*/
|
|
267
|
+
(0, react_1.useEffect)(() => {
|
|
268
|
+
if (!authUserId) {
|
|
269
|
+
emptyCache();
|
|
270
|
+
}
|
|
271
|
+
}, [authUserId]);
|
|
272
|
+
if (!coursesEnabled || !user) {
|
|
273
|
+
return { courses: data, loading, isLoading };
|
|
274
|
+
}
|
|
275
|
+
return { courses: data, loading, isLoading, join, leave, joinStatus, refresh, emptyCache };
|
|
276
|
+
}
|
|
277
|
+
exports.default = useSCJoinedCoursesManager;
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Types
|
|
3
3
|
*/
|
|
4
|
-
import { SCUserContextType, SCFollowedCategoriesManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCFollowedManagerType, SCFollowersManagerType, SCSettingsManagerType, SCConnectionsManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType } from './types';
|
|
4
|
+
import { SCUserContextType, SCFollowedCategoriesManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCFollowedManagerType, SCFollowersManagerType, SCSettingsManagerType, SCConnectionsManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType, SCJoinedCoursesManagerType } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* ContextProvider component
|
|
7
7
|
*/
|
|
@@ -47,6 +47,8 @@ import useSCFetchVote from './hooks/useSCFetchVote';
|
|
|
47
47
|
import useSCFetchFeedObject from './hooks/useSCFetchFeedObject';
|
|
48
48
|
import useSCFetchCommentObject from './hooks/useSCFetchCommentObject';
|
|
49
49
|
import useSCFetchCommentObjects from './hooks/useSCFetchCommentObjects';
|
|
50
|
+
import useSCFetchLessonCommentObject from './hooks/useSCFetchLessonCommentObject';
|
|
51
|
+
import useSCFetchLessonCommentObjects from './hooks/useSCFetchLessonCommentObjects';
|
|
50
52
|
import useSCFetchCustomAdv from './hooks/useSCFetchCustomAdv';
|
|
51
53
|
import useSCFetchTag from './hooks/useSCFetchTag';
|
|
52
54
|
import useSCFetchAddressingTagList from './hooks/useSCFetchAddressingTagList';
|
|
@@ -66,6 +68,9 @@ import useSCFetchEvent from './hooks/useSCFetchEvent';
|
|
|
66
68
|
import useSCFetchEvents from './hooks/useSCFetchEvents';
|
|
67
69
|
import useSCFetchLiveStream from './hooks/useSCFetchLiveStream';
|
|
68
70
|
import useSCGoogleApiLoader from './hooks/useSCGoogleApiLoader';
|
|
71
|
+
import useSCFetchCourse from './hooks/useSCFetchCourse';
|
|
72
|
+
import useSCFetchCourses from './hooks/useSCFetchCourses';
|
|
73
|
+
import useSCFetchLesson from './hooks/useSCFetchLesson';
|
|
69
74
|
/**
|
|
70
75
|
* Routing component
|
|
71
76
|
*/
|
|
@@ -88,4 +93,4 @@ import * as Preferences from './constants/Preferences';
|
|
|
88
93
|
/**
|
|
89
94
|
* List all exports
|
|
90
95
|
*/
|
|
91
|
-
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, 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, 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, };
|
|
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, };
|
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.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 = void 0;
|
|
3
|
+
exports.useSCFetchCategories = exports.useSCFetchCategory = exports.useSCFetchAddressingTagList = exports.useSCFetchTag = exports.useSCFetchCustomAdv = exports.useSCFetchLessonCommentObjects = exports.useSCFetchLessonCommentObject = exports.useSCFetchCommentObjects = exports.useSCFetchCommentObject = exports.useSCFetchFeedObject = exports.useSCFetchVote = exports.useSCFetchUserProviders = 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.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;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
/**
|
|
7
7
|
* ContextProvider component
|
|
@@ -84,6 +84,10 @@ const useSCFetchCommentObject_1 = tslib_1.__importDefault(require("./hooks/useSC
|
|
|
84
84
|
exports.useSCFetchCommentObject = useSCFetchCommentObject_1.default;
|
|
85
85
|
const useSCFetchCommentObjects_1 = tslib_1.__importDefault(require("./hooks/useSCFetchCommentObjects"));
|
|
86
86
|
exports.useSCFetchCommentObjects = useSCFetchCommentObjects_1.default;
|
|
87
|
+
const useSCFetchLessonCommentObject_1 = tslib_1.__importDefault(require("./hooks/useSCFetchLessonCommentObject"));
|
|
88
|
+
exports.useSCFetchLessonCommentObject = useSCFetchLessonCommentObject_1.default;
|
|
89
|
+
const useSCFetchLessonCommentObjects_1 = tslib_1.__importDefault(require("./hooks/useSCFetchLessonCommentObjects"));
|
|
90
|
+
exports.useSCFetchLessonCommentObjects = useSCFetchLessonCommentObjects_1.default;
|
|
87
91
|
const useSCFetchCustomAdv_1 = tslib_1.__importDefault(require("./hooks/useSCFetchCustomAdv"));
|
|
88
92
|
exports.useSCFetchCustomAdv = useSCFetchCustomAdv_1.default;
|
|
89
93
|
const useSCFetchTag_1 = tslib_1.__importDefault(require("./hooks/useSCFetchTag"));
|
|
@@ -122,6 +126,12 @@ const useSCFetchLiveStream_1 = tslib_1.__importDefault(require("./hooks/useSCFet
|
|
|
122
126
|
exports.useSCFetchLiveStream = useSCFetchLiveStream_1.default;
|
|
123
127
|
const useSCGoogleApiLoader_1 = tslib_1.__importDefault(require("./hooks/useSCGoogleApiLoader"));
|
|
124
128
|
exports.useSCGoogleApiLoader = useSCGoogleApiLoader_1.default;
|
|
129
|
+
const useSCFetchCourse_1 = tslib_1.__importDefault(require("./hooks/useSCFetchCourse"));
|
|
130
|
+
exports.useSCFetchCourse = useSCFetchCourse_1.default;
|
|
131
|
+
const useSCFetchCourses_1 = tslib_1.__importDefault(require("./hooks/useSCFetchCourses"));
|
|
132
|
+
exports.useSCFetchCourses = useSCFetchCourses_1.default;
|
|
133
|
+
const useSCFetchLesson_1 = tslib_1.__importDefault(require("./hooks/useSCFetchLesson"));
|
|
134
|
+
exports.useSCFetchLesson = useSCFetchLesson_1.default;
|
|
125
135
|
/**
|
|
126
136
|
* Routing component
|
|
127
137
|
*/
|
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
|
? {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { SCAuthTokenType, SCIncubatorType, SCCategoryType, SCUserType, SCUserSettingsType, SCReactionType, SCGroupType, SCEventType } from '@selfcommunity/types';
|
|
2
|
+
import { SCAuthTokenType, SCIncubatorType, SCCategoryType, SCUserType, SCUserSettingsType, SCReactionType, SCGroupType, SCEventType, SCCourseType } from '@selfcommunity/types';
|
|
3
3
|
import { SCThemeType } from './theme';
|
|
4
4
|
/**
|
|
5
5
|
* Interface SCSettingsType
|
|
@@ -148,6 +148,7 @@ export interface SCUserContextType {
|
|
|
148
148
|
blockedUsers?: SCBlockedUsersManagerType;
|
|
149
149
|
groups?: SCSubscribedGroupsManagerType;
|
|
150
150
|
events?: SCSubscribedEventsManagerType;
|
|
151
|
+
courses?: SCJoinedCoursesManagerType;
|
|
151
152
|
};
|
|
152
153
|
}
|
|
153
154
|
export interface SCSettingsManagerType {
|
|
@@ -254,6 +255,40 @@ export interface SCFollowedCategoriesManagerType {
|
|
|
254
255
|
*/
|
|
255
256
|
emptyCache?: () => void;
|
|
256
257
|
}
|
|
258
|
+
export interface SCJoinedCoursesManagerType {
|
|
259
|
+
/**
|
|
260
|
+
* List of all courses ids followed by the authenticated user
|
|
261
|
+
*/
|
|
262
|
+
courses: number[];
|
|
263
|
+
/**
|
|
264
|
+
* List of all courses in loading state
|
|
265
|
+
*/
|
|
266
|
+
loading: number[];
|
|
267
|
+
/**
|
|
268
|
+
* List of current courses in loading state
|
|
269
|
+
*/
|
|
270
|
+
isLoading: (course: SCCourseType) => boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Handle user joining a course
|
|
273
|
+
*/
|
|
274
|
+
join?: (course: SCCourseType, userId?: number) => Promise<any>;
|
|
275
|
+
/**
|
|
276
|
+
* Handle user leaving a course
|
|
277
|
+
*/
|
|
278
|
+
leave?: (course: SCCourseType) => Promise<any>;
|
|
279
|
+
/**
|
|
280
|
+
* Handles a user join status to a course, caching data
|
|
281
|
+
*/
|
|
282
|
+
joinStatus?: (course: SCCourseType) => string;
|
|
283
|
+
/**
|
|
284
|
+
* Refresh courses
|
|
285
|
+
*/
|
|
286
|
+
refresh?: () => void;
|
|
287
|
+
/**
|
|
288
|
+
* Empty cache to revalidate all courses
|
|
289
|
+
*/
|
|
290
|
+
emptyCache?: () => void;
|
|
291
|
+
}
|
|
257
292
|
export interface SCSubscribedEventsManagerType {
|
|
258
293
|
/**
|
|
259
294
|
* List of all events ids followed by the authenticated user
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SCUserContextType, SCFollowedManagerType, SCFollowersManagerType, SCFollowedCategoriesManagerType, SCSettingsManagerType, SCSubscribedIncubatorsManagerType, SCConnectionsManagerType, SCBlockedUsersManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCPreferencesContextType, SCNotificationContextType, SCLocaleType, SCVoteType, SCVoteContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType } from './context';
|
|
1
|
+
import { SCUserContextType, SCFollowedManagerType, SCFollowersManagerType, SCFollowedCategoriesManagerType, SCSettingsManagerType, SCSubscribedIncubatorsManagerType, SCConnectionsManagerType, SCBlockedUsersManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCPreferencesContextType, SCNotificationContextType, SCLocaleType, SCVoteType, SCVoteContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType, SCJoinedCoursesManagerType } from './context';
|
|
2
2
|
import { SCThemeAvatarVariableType, SCThemeUserVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType } from './theme';
|
|
3
|
-
export { SCUserContextType, SCFollowedCategoriesManagerType, SCSettingsManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCFollowedManagerType, SCFollowersManagerType, SCConnectionsManagerType, SCBlockedUsersManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCVoteType, SCVoteContextType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeUserVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType, };
|
|
3
|
+
export { SCUserContextType, SCFollowedCategoriesManagerType, SCSettingsManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCFollowedManagerType, SCFollowersManagerType, SCConnectionsManagerType, SCBlockedUsersManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCVoteType, SCVoteContextType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeUserVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType, SCJoinedCoursesManagerType, };
|
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
|
/**
|
|
@@ -18,6 +18,7 @@ import useSCBlockedUsersManager from '../../../hooks/useSCBlockedUsersManager';
|
|
|
18
18
|
import * as Session from '../../../constants/Session';
|
|
19
19
|
import useSCSubscribedGroupsManager from '../../../hooks/useSCSubscribedGroupsManager';
|
|
20
20
|
import useSCSubscribedEventsManager from '../../../hooks/useSCSubscribedEventsManager';
|
|
21
|
+
import useSCJoinedCoursesManager from '../../../hooks/useSCJoinedCoursesManager';
|
|
21
22
|
/**
|
|
22
23
|
* SCUserContext (Authentication Context)
|
|
23
24
|
*
|
|
@@ -71,6 +72,7 @@ export default function SCUserProvider({ children }) {
|
|
|
71
72
|
const blockedUsersManager = useSCBlockedUsersManager(state.user);
|
|
72
73
|
const subscribedGroupsManager = useSCSubscribedGroupsManager(state.user);
|
|
73
74
|
const subscribedEventsManager = useSCSubscribedEventsManager(state.user);
|
|
75
|
+
const joinedCoursesManager = useSCJoinedCoursesManager(state.user);
|
|
74
76
|
/**
|
|
75
77
|
* Ref notifications subscribers: BLOCKED_USER, UNBLOCKED_USER
|
|
76
78
|
*/
|
|
@@ -123,6 +125,7 @@ export default function SCUserProvider({ children }) {
|
|
|
123
125
|
blockedUsersManager.refresh && blockedUsersManager.refresh();
|
|
124
126
|
subscribedGroupsManager.refresh && subscribedGroupsManager.refresh();
|
|
125
127
|
subscribedEventsManager.refresh && subscribedEventsManager.refresh();
|
|
128
|
+
joinedCoursesManager.refresh && joinedCoursesManager.refresh();
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
/**
|
|
@@ -220,6 +223,7 @@ export default function SCUserProvider({ children }) {
|
|
|
220
223
|
blockedUsers: blockedUsersManager,
|
|
221
224
|
groups: subscribedGroupsManager,
|
|
222
225
|
events: subscribedEventsManager,
|
|
226
|
+
courses: joinedCoursesManager,
|
|
223
227
|
},
|
|
224
228
|
}), [
|
|
225
229
|
state,
|
|
@@ -240,6 +244,8 @@ export default function SCUserProvider({ children }) {
|
|
|
240
244
|
subscribedGroupsManager.groups,
|
|
241
245
|
subscribedEventsManager.loading,
|
|
242
246
|
subscribedEventsManager.events,
|
|
247
|
+
joinedCoursesManager.loading,
|
|
248
|
+
joinedCoursesManager.emptyCache,
|
|
243
249
|
]);
|
|
244
250
|
/**
|
|
245
251
|
* We only want to render the underlying app after we
|
|
@@ -4,19 +4,35 @@
|
|
|
4
4
|
/** FEED OBJECT **/
|
|
5
5
|
export declare const FEED_OBJECT_CACHE_PREFIX_KEY = "_fo_";
|
|
6
6
|
export declare const getFeedObjectCacheKey: (id: any, type: any) => string;
|
|
7
|
-
/**
|
|
7
|
+
/** COMMENT OBJECT **/
|
|
8
8
|
export declare const COMMENT_OBJECT_CACHE_PREFIX_KEY = "_co_";
|
|
9
9
|
export declare const getCommentObjectCacheKey: (id: any) => string;
|
|
10
|
-
/**
|
|
10
|
+
/** COMMENT OBJECTS **/
|
|
11
11
|
export declare const COMMENT_OBJECTS_CACHE_PREFIX_KEY = "_cos_";
|
|
12
12
|
export declare const getCommentObjectsCacheKey: (id: any, type: any, next: any) => string;
|
|
13
13
|
export declare const getCommentObjectsCachePrefixKeys: (id: any, type: any) => string;
|
|
14
|
+
/** LESSON COMMENT OBJECT **/
|
|
15
|
+
export declare const LESSON_COMMENT_CACHE_PREFIX_KEY = "_lco_";
|
|
16
|
+
export declare const getLessonCommentCacheKey: (id: any) => string;
|
|
17
|
+
/** LESSON COMMENT OBJECTS **/
|
|
18
|
+
export declare const LESSON_COMMENTS_CACHE_PREFIX_KEY = "_lcos_";
|
|
19
|
+
export declare const getLessonCommentsCacheKey: (id: any, next: any) => string;
|
|
20
|
+
export declare const getLessonCommentsCachePrefixKeys: (id: any) => string;
|
|
14
21
|
/** CATEGORIES OBJECT **/
|
|
15
22
|
export declare const CATEGORIES_OBJECT_CACHE_PREFIX_KEY = "_cas_";
|
|
16
23
|
export declare const getCategoriesObjectCacheKey: () => string;
|
|
17
24
|
/** CATEGORY OBJECT **/
|
|
18
25
|
export declare const CATEGORY_OBJECT_CACHE_PREFIX_KEY = "_ca_";
|
|
19
26
|
export declare const getCategoryObjectCacheKey: (id: any) => string;
|
|
27
|
+
/** COURSE OBJECT **/
|
|
28
|
+
export declare const COURSE_OBJECT_CACHE_PREFIX_KEY = "_crs_";
|
|
29
|
+
export declare const getCourseObjectCacheKey: (id: any) => string;
|
|
30
|
+
/** COURSES OBJECT **/
|
|
31
|
+
export declare const COURSES_OBJECT_CACHE_PREFIX_KEY = "_crss_";
|
|
32
|
+
export declare const getCoursesObjectCacheKey: () => string;
|
|
33
|
+
/** LESSON OBJECT **/
|
|
34
|
+
export declare const LESSON_OBJECT_CACHE_PREFIX_KEY = "_lss_";
|
|
35
|
+
export declare const getLessonObjectCacheKey: (id: any) => string;
|
|
20
36
|
/** EVENT OBJECT **/
|
|
21
37
|
export declare const EVENT_OBJECT_CACHE_PREFIX_KEY = "_evt_";
|
|
22
38
|
export declare const getEventObjectCacheKey: (id: any) => string;
|
|
@@ -70,6 +86,9 @@ export declare const USER_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = "_uFoldWidget_
|
|
|
70
86
|
export declare const USER_EVENTS_STATE_CACHE_PREFIX_KEY = "_uEvents_";
|
|
71
87
|
export declare const USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = "_uOtherEvents_";
|
|
72
88
|
export declare const USER_PARTECIPANTS_EVENTS_STATE_CACHE_PREFIX_KEY = "_uPartecipantsEvents_";
|
|
89
|
+
export declare const USER_PARTECIPANTS_COURSES_STATE_CACHE_PREFIX_KEY = "_uPartecipantsCourses_";
|
|
90
|
+
export declare const USER_REQUESTS_COURSES_STATE_CACHE_PREFIX_KEY = "_uRequestsCourses_";
|
|
91
|
+
export declare const USER_COMMENTS_COURSES_STATE_CACHE_PREFIX_KEY = "_uCommentsCourses_";
|
|
73
92
|
export declare const USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = "_uInvitedEvents_";
|
|
74
93
|
export declare const USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = "_uRequestsEvents_";
|
|
75
94
|
export declare const USER_LIVE_STREAM_CACHE_PREFIX_KEY = "_uUserLives_";
|
|
@@ -4,19 +4,35 @@
|
|
|
4
4
|
/** FEED OBJECT **/
|
|
5
5
|
export const FEED_OBJECT_CACHE_PREFIX_KEY = '_fo_';
|
|
6
6
|
export const getFeedObjectCacheKey = (id, type) => `${FEED_OBJECT_CACHE_PREFIX_KEY}${type}_${id}`;
|
|
7
|
-
/**
|
|
7
|
+
/** COMMENT OBJECT **/
|
|
8
8
|
export const COMMENT_OBJECT_CACHE_PREFIX_KEY = '_co_';
|
|
9
9
|
export const getCommentObjectCacheKey = (id) => `${COMMENT_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
10
|
-
/**
|
|
10
|
+
/** COMMENT OBJECTS **/
|
|
11
11
|
export const COMMENT_OBJECTS_CACHE_PREFIX_KEY = '_cos_';
|
|
12
12
|
export const getCommentObjectsCacheKey = (id, type, next) => `${COMMENT_OBJECTS_CACHE_PREFIX_KEY}${type}_${id}_${next}`;
|
|
13
13
|
export const getCommentObjectsCachePrefixKeys = (id, type) => `${COMMENT_OBJECTS_CACHE_PREFIX_KEY}${type}_${id}`;
|
|
14
|
+
/** LESSON COMMENT OBJECT **/
|
|
15
|
+
export const LESSON_COMMENT_CACHE_PREFIX_KEY = '_lco_';
|
|
16
|
+
export const getLessonCommentCacheKey = (id) => `${LESSON_COMMENT_CACHE_PREFIX_KEY}${id}`;
|
|
17
|
+
/** LESSON COMMENT OBJECTS **/
|
|
18
|
+
export const LESSON_COMMENTS_CACHE_PREFIX_KEY = '_lcos_';
|
|
19
|
+
export const getLessonCommentsCacheKey = (id, next) => `${LESSON_COMMENTS_CACHE_PREFIX_KEY}${id}_${next}`;
|
|
20
|
+
export const getLessonCommentsCachePrefixKeys = (id) => `${LESSON_COMMENTS_CACHE_PREFIX_KEY}${id}`;
|
|
14
21
|
/** CATEGORIES OBJECT **/
|
|
15
22
|
export const CATEGORIES_OBJECT_CACHE_PREFIX_KEY = '_cas_';
|
|
16
23
|
export const getCategoriesObjectCacheKey = () => `${CATEGORIES_OBJECT_CACHE_PREFIX_KEY}`;
|
|
17
24
|
/** CATEGORY OBJECT **/
|
|
18
25
|
export const CATEGORY_OBJECT_CACHE_PREFIX_KEY = '_ca_';
|
|
19
26
|
export const getCategoryObjectCacheKey = (id) => `${CATEGORY_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
27
|
+
/** COURSE OBJECT **/
|
|
28
|
+
export const COURSE_OBJECT_CACHE_PREFIX_KEY = '_crs_';
|
|
29
|
+
export const getCourseObjectCacheKey = (id) => `${COURSE_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
30
|
+
/** COURSES OBJECT **/
|
|
31
|
+
export const COURSES_OBJECT_CACHE_PREFIX_KEY = '_crss_';
|
|
32
|
+
export const getCoursesObjectCacheKey = () => `${COURSES_OBJECT_CACHE_PREFIX_KEY}`;
|
|
33
|
+
/** LESSON OBJECT **/
|
|
34
|
+
export const LESSON_OBJECT_CACHE_PREFIX_KEY = '_lss_';
|
|
35
|
+
export const getLessonObjectCacheKey = (id) => `${LESSON_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
20
36
|
/** EVENT OBJECT **/
|
|
21
37
|
export const EVENT_OBJECT_CACHE_PREFIX_KEY = '_evt_';
|
|
22
38
|
export const getEventObjectCacheKey = (id) => `${EVENT_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
@@ -74,6 +90,9 @@ export const USER_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = '_uFoldWidget_';
|
|
|
74
90
|
export const USER_EVENTS_STATE_CACHE_PREFIX_KEY = '_uEvents_';
|
|
75
91
|
export const USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = '_uOtherEvents_';
|
|
76
92
|
export const USER_PARTECIPANTS_EVENTS_STATE_CACHE_PREFIX_KEY = '_uPartecipantsEvents_';
|
|
93
|
+
export const USER_PARTECIPANTS_COURSES_STATE_CACHE_PREFIX_KEY = '_uPartecipantsCourses_';
|
|
94
|
+
export const USER_REQUESTS_COURSES_STATE_CACHE_PREFIX_KEY = '_uRequestsCourses_';
|
|
95
|
+
export const USER_COMMENTS_COURSES_STATE_CACHE_PREFIX_KEY = '_uCommentsCourses_';
|
|
77
96
|
export const USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = '_uInvitedEvents_';
|
|
78
97
|
export const USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = '_uRequestsEvents_';
|
|
79
98
|
export const USER_LIVE_STREAM_CACHE_PREFIX_KEY = '_uUserLives_';
|