@selfcommunity/react-core 0.6.4-alpha.9 → 0.6.4-courses.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/lib/cjs/components/provider/SCRoutingProvider/index.js +1 -0
  2. package/lib/cjs/components/provider/SCUserProvider/index.js +6 -0
  3. package/lib/cjs/constants/Cache.d.ts +25 -2
  4. package/lib/cjs/constants/Cache.js +34 -4
  5. package/lib/cjs/constants/Notification.d.ts +1 -0
  6. package/lib/cjs/constants/Notification.js +2 -1
  7. package/lib/cjs/constants/Preferences.d.ts +8 -0
  8. package/lib/cjs/constants/Preferences.js +18 -2
  9. package/lib/cjs/constants/Routes.d.ts +8 -0
  10. package/lib/cjs/constants/Routes.js +17 -1
  11. package/lib/cjs/hooks/useSCFetchCourse.d.ts +23 -0
  12. package/lib/cjs/hooks/useSCFetchCourse.js +81 -0
  13. package/lib/cjs/hooks/useSCFetchCourses.d.ts +22 -0
  14. package/lib/cjs/hooks/useSCFetchCourses.js +83 -0
  15. package/lib/cjs/hooks/useSCFetchLesson.d.ts +22 -0
  16. package/lib/cjs/hooks/useSCFetchLesson.js +72 -0
  17. package/lib/cjs/hooks/useSCFetchLessonCommentObject.d.ts +23 -0
  18. package/lib/cjs/hooks/useSCFetchLessonCommentObject.js +72 -0
  19. package/lib/cjs/hooks/useSCFetchLessonCommentObjects.d.ts +48 -0
  20. package/lib/cjs/hooks/useSCFetchLessonCommentObjects.js +302 -0
  21. package/lib/cjs/hooks/useSCFetchLiveStream.d.ts +20 -0
  22. package/lib/cjs/hooks/useSCFetchLiveStream.js +76 -0
  23. package/lib/cjs/hooks/useSCJoinedCoursesManager.d.ts +38 -0
  24. package/lib/cjs/hooks/useSCJoinedCoursesManager.js +277 -0
  25. package/lib/cjs/index.d.ts +8 -2
  26. package/lib/cjs/index.js +14 -2
  27. package/lib/cjs/types/context.d.ts +36 -1
  28. package/lib/cjs/types/index.d.ts +2 -2
  29. package/lib/esm/components/provider/SCRoutingProvider/index.js +2 -1
  30. package/lib/esm/components/provider/SCUserProvider/index.js +6 -0
  31. package/lib/esm/constants/Cache.d.ts +25 -2
  32. package/lib/esm/constants/Cache.js +25 -2
  33. package/lib/esm/constants/Notification.d.ts +1 -0
  34. package/lib/esm/constants/Notification.js +2 -1
  35. package/lib/esm/constants/Preferences.d.ts +8 -0
  36. package/lib/esm/constants/Preferences.js +16 -0
  37. package/lib/esm/constants/Routes.d.ts +8 -0
  38. package/lib/esm/constants/Routes.js +16 -0
  39. package/lib/esm/hooks/useSCFetchCourse.d.ts +23 -0
  40. package/lib/esm/hooks/useSCFetchCourse.js +78 -0
  41. package/lib/esm/hooks/useSCFetchCourses.d.ts +22 -0
  42. package/lib/esm/hooks/useSCFetchCourses.js +81 -0
  43. package/lib/esm/hooks/useSCFetchLesson.d.ts +22 -0
  44. package/lib/esm/hooks/useSCFetchLesson.js +69 -0
  45. package/lib/esm/hooks/useSCFetchLessonCommentObject.d.ts +23 -0
  46. package/lib/esm/hooks/useSCFetchLessonCommentObject.js +69 -0
  47. package/lib/esm/hooks/useSCFetchLessonCommentObjects.d.ts +48 -0
  48. package/lib/esm/hooks/useSCFetchLessonCommentObjects.js +297 -0
  49. package/lib/esm/hooks/useSCFetchLiveStream.d.ts +20 -0
  50. package/lib/esm/hooks/useSCFetchLiveStream.js +73 -0
  51. package/lib/esm/hooks/useSCJoinedCoursesManager.d.ts +38 -0
  52. package/lib/esm/hooks/useSCJoinedCoursesManager.js +273 -0
  53. package/lib/esm/index.d.ts +8 -2
  54. package/lib/esm/index.js +7 -1
  55. package/lib/esm/types/context.d.ts +36 -1
  56. package/lib/esm/types/index.d.ts +2 -2
  57. package/lib/umd/react-core.js +1 -1
  58. package/lib/umd/react-core.js.LICENSE.txt +2 -0
  59. package/package.json +132 -127
@@ -74,6 +74,7 @@ function SCRoutingProvider({ children = null }) {
74
74
  [Routes_1.USER_NOTIFICATIONS_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_NOTIFICATIONS].value),
75
75
  [Routes_1.USER_PRIVATE_MESSAGES_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_USER_PRIVATE_MESSAGES].value),
76
76
  [Routes_1.INCUBATOR_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_INCUBATOR].value),
77
+ [Routes_1.LIVESTREAM_ROUTE_NAME]: normalizeUrl(scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_URL_TEMPLATE_LIVE_STREAM].value),
77
78
  };
78
79
  }
79
80
  return {};
@@ -22,6 +22,7 @@ const useSCBlockedUsersManager_1 = tslib_1.__importDefault(require("../../../hoo
22
22
  const Session = tslib_1.__importStar(require("../../../constants/Session"));
23
23
  const useSCSubscribedGroupsManager_1 = tslib_1.__importDefault(require("../../../hooks/useSCSubscribedGroupsManager"));
24
24
  const useSCSubscribedEventsManager_1 = tslib_1.__importDefault(require("../../../hooks/useSCSubscribedEventsManager"));
25
+ const useSCJoinedCoursesManager_1 = tslib_1.__importDefault(require("../../../hooks/useSCJoinedCoursesManager"));
25
26
  /**
26
27
  * SCUserContext (Authentication Context)
27
28
  *
@@ -75,6 +76,7 @@ function SCUserProvider({ children }) {
75
76
  const blockedUsersManager = (0, useSCBlockedUsersManager_1.default)(state.user);
76
77
  const subscribedGroupsManager = (0, useSCSubscribedGroupsManager_1.default)(state.user);
77
78
  const subscribedEventsManager = (0, useSCSubscribedEventsManager_1.default)(state.user);
79
+ const joinedCoursesManager = (0, useSCJoinedCoursesManager_1.default)(state.user);
78
80
  /**
79
81
  * Ref notifications subscribers: BLOCKED_USER, UNBLOCKED_USER
80
82
  */
@@ -127,6 +129,7 @@ function SCUserProvider({ children }) {
127
129
  blockedUsersManager.refresh && blockedUsersManager.refresh();
128
130
  subscribedGroupsManager.refresh && subscribedGroupsManager.refresh();
129
131
  subscribedEventsManager.refresh && subscribedEventsManager.refresh();
132
+ joinedCoursesManager.refresh && joinedCoursesManager.refresh();
130
133
  }
131
134
  }
132
135
  /**
@@ -224,6 +227,7 @@ function SCUserProvider({ children }) {
224
227
  blockedUsers: blockedUsersManager,
225
228
  groups: subscribedGroupsManager,
226
229
  events: subscribedEventsManager,
230
+ courses: joinedCoursesManager,
227
231
  },
228
232
  }), [
229
233
  state,
@@ -244,6 +248,8 @@ function SCUserProvider({ children }) {
244
248
  subscribedGroupsManager.groups,
245
249
  subscribedEventsManager.loading,
246
250
  subscribedEventsManager.events,
251
+ joinedCoursesManager.loading,
252
+ joinedCoursesManager.emptyCache,
247
253
  ]);
248
254
  /**
249
255
  * We only want to render the underlying app after we
@@ -4,25 +4,44 @@
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
- /** COMMMENT OBJECT **/
7
+ /** COMMENT OBJECT **/
8
8
  export declare const COMMENT_OBJECT_CACHE_PREFIX_KEY = "_co_";
9
9
  export declare const getCommentObjectCacheKey: (id: any) => string;
10
- /** COMMMENT OBJECTS **/
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;
23
39
  /** EVENTS OBJECT **/
24
40
  export declare const EVENTS_OBJECT_CACHE_PREFIX_KEY = "_evts_";
25
41
  export declare const getEventsObjectCacheKey: () => string;
42
+ /** EVENT OBJECT **/
43
+ export declare const LIVESTREAM_OBJECT_CACHE_PREFIX_KEY = "_liveStream_";
44
+ export declare const getLiveStreamObjectCacheKey: (id: any) => string;
26
45
  /** GROUP OBJECT **/
27
46
  export declare const GROUP_OBJECT_CACHE_PREFIX_KEY = "_grp_";
28
47
  export declare const getGroupObjectCacheKey: (id: any) => string;
@@ -67,8 +86,12 @@ export declare const USER_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = "_uFoldWidget_
67
86
  export declare const USER_EVENTS_STATE_CACHE_PREFIX_KEY = "_uEvents_";
68
87
  export declare const USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = "_uOtherEvents_";
69
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_";
70
92
  export declare const USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = "_uInvitedEvents_";
71
93
  export declare const USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = "_uRequestsEvents_";
94
+ export declare const USER_LIVE_STREAM_CACHE_PREFIX_KEY = "_uUserLives_";
72
95
  export declare const EVENT_MEDIA_STATE_CACHE_PREFIX_KEY = "_eMedia_";
73
96
  export declare const USER_CONNECTIONS_TOOLS_STATE_CACHE_PREFIX_KEY = "_uConWidget_";
74
97
  export declare const USER_CONNECTIONS_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = "_uConReqWidget_";
@@ -3,22 +3,32 @@
3
3
  * Cache prefixes
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_PARTECIPANTS_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_FOLLOWERS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_POPULAR_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.getPmSnippetObjectCacheKey = exports.PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = exports.getPmSnippetsObjectCacheKey = exports.PM_SNIPPETS_OBJECT_CACHE_PREFIX_KEY = exports.getAdvObjectCacheKey = exports.ADV_OBJECT_CACHE_PREFIX_KEY = exports.getFeedSPCacheKey = exports.FEED_CACHE_SP_KEY = exports.getVirtualizedScrollStateCacheKey = exports.VIRTUALIZED_SCROLL_STATE_CACHE_PREFIX_KEY = exports.getStateFeedCacheKey = exports.FEED_STATE_CACHE_PREFIX_KEY = exports.getFeedCacheKey = exports.FEED_CACHE_PREFIX_KEY = exports.getBroadcastMessagesObjectCacheKey = exports.BROADCAST_MESSAGES_OBJECT_CACHE_PREFIX_KEY = exports.getContributorsCachePrefixKeys = exports.getContributorsCacheKey = exports.CONTRIBUTORS_CACHE_PREFIX_KEY = exports.getIncubatorObjectCacheKey = exports.INCUBATOR_OBJECT_CACHE_PREFIX_KEY = exports.getGroupsObjectCacheKey = exports.GROUPS_OBJECT_CACHE_PREFIX_KEY = exports.getGroupObjectCacheKey = exports.GROUP_OBJECT_CACHE_PREFIX_KEY = exports.getEventsObjectCacheKey = exports.EVENTS_OBJECT_CACHE_PREFIX_KEY = exports.getEventObjectCacheKey = exports.EVENT_OBJECT_CACHE_PREFIX_KEY = exports.getCategoryObjectCacheKey = exports.CATEGORY_OBJECT_CACHE_PREFIX_KEY = exports.getCategoriesObjectCacheKey = exports.CATEGORIES_OBJECT_CACHE_PREFIX_KEY = exports.getCommentObjectsCachePrefixKeys = exports.getCommentObjectsCacheKey = exports.COMMENT_OBJECTS_CACHE_PREFIX_KEY = exports.getCommentObjectCacheKey = exports.COMMENT_OBJECT_CACHE_PREFIX_KEY = exports.getFeedObjectCacheKey = exports.FEED_OBJECT_CACHE_PREFIX_KEY = void 0;
7
- exports.getWidgetStateCacheKey = exports.GROUPS_SUBSCRIBED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUPS_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUP_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUP_MEMBERS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.POLL_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.INCUBATOR_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.INCUBATOR_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.PEOPLE_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.TRENDING_PEOPLE_TOOLS_STATE_CACHE_PREFIX_KEY = exports.RELATED_FEED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.TRENDING_FEED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_CONNECTIONS_REQUESTS_SENT_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_CONNECTIONS_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_CONNECTIONS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.EVENT_MEDIA_STATE_CACHE_PREFIX_KEY = exports.USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = void 0;
6
+ exports.PM_SNIPPETS_OBJECT_CACHE_PREFIX_KEY = exports.getAdvObjectCacheKey = exports.ADV_OBJECT_CACHE_PREFIX_KEY = exports.getFeedSPCacheKey = exports.FEED_CACHE_SP_KEY = exports.getVirtualizedScrollStateCacheKey = exports.VIRTUALIZED_SCROLL_STATE_CACHE_PREFIX_KEY = exports.getStateFeedCacheKey = exports.FEED_STATE_CACHE_PREFIX_KEY = exports.getFeedCacheKey = exports.FEED_CACHE_PREFIX_KEY = exports.getBroadcastMessagesObjectCacheKey = exports.BROADCAST_MESSAGES_OBJECT_CACHE_PREFIX_KEY = exports.getContributorsCachePrefixKeys = exports.getContributorsCacheKey = exports.CONTRIBUTORS_CACHE_PREFIX_KEY = exports.getIncubatorObjectCacheKey = exports.INCUBATOR_OBJECT_CACHE_PREFIX_KEY = exports.getGroupsObjectCacheKey = exports.GROUPS_OBJECT_CACHE_PREFIX_KEY = exports.getGroupObjectCacheKey = exports.GROUP_OBJECT_CACHE_PREFIX_KEY = exports.getLiveStreamObjectCacheKey = exports.LIVESTREAM_OBJECT_CACHE_PREFIX_KEY = exports.getEventsObjectCacheKey = exports.EVENTS_OBJECT_CACHE_PREFIX_KEY = exports.getEventObjectCacheKey = exports.EVENT_OBJECT_CACHE_PREFIX_KEY = exports.getLessonObjectCacheKey = exports.LESSON_OBJECT_CACHE_PREFIX_KEY = exports.getCoursesObjectCacheKey = exports.COURSES_OBJECT_CACHE_PREFIX_KEY = exports.getCourseObjectCacheKey = exports.COURSE_OBJECT_CACHE_PREFIX_KEY = exports.getCategoryObjectCacheKey = exports.CATEGORY_OBJECT_CACHE_PREFIX_KEY = exports.getCategoriesObjectCacheKey = exports.CATEGORIES_OBJECT_CACHE_PREFIX_KEY = exports.getLessonCommentsCachePrefixKeys = exports.getLessonCommentsCacheKey = exports.LESSON_COMMENTS_CACHE_PREFIX_KEY = exports.getLessonCommentCacheKey = exports.LESSON_COMMENT_CACHE_PREFIX_KEY = exports.getCommentObjectsCachePrefixKeys = exports.getCommentObjectsCacheKey = exports.COMMENT_OBJECTS_CACHE_PREFIX_KEY = exports.getCommentObjectCacheKey = exports.COMMENT_OBJECT_CACHE_PREFIX_KEY = exports.getFeedObjectCacheKey = exports.FEED_OBJECT_CACHE_PREFIX_KEY = void 0;
7
+ exports.getWidgetStateCacheKey = exports.GROUPS_SUBSCRIBED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUPS_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUP_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUP_MEMBERS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.POLL_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.INCUBATOR_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.INCUBATOR_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.PEOPLE_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.TRENDING_PEOPLE_TOOLS_STATE_CACHE_PREFIX_KEY = exports.RELATED_FEED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.TRENDING_FEED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_CONNECTIONS_REQUESTS_SENT_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_CONNECTIONS_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_CONNECTIONS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.EVENT_MEDIA_STATE_CACHE_PREFIX_KEY = exports.USER_LIVE_STREAM_CACHE_PREFIX_KEY = exports.USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_COMMENTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.USER_REQUESTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.USER_PARTECIPANTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.USER_PARTECIPANTS_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_FOLLOWERS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_POPULAR_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.getPmSnippetObjectCacheKey = exports.PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = exports.getPmSnippetsObjectCacheKey = void 0;
8
8
  /** FEED OBJECT **/
9
9
  exports.FEED_OBJECT_CACHE_PREFIX_KEY = '_fo_';
10
10
  const getFeedObjectCacheKey = (id, type) => `${exports.FEED_OBJECT_CACHE_PREFIX_KEY}${type}_${id}`;
11
11
  exports.getFeedObjectCacheKey = getFeedObjectCacheKey;
12
- /** COMMMENT OBJECT **/
12
+ /** COMMENT OBJECT **/
13
13
  exports.COMMENT_OBJECT_CACHE_PREFIX_KEY = '_co_';
14
14
  const getCommentObjectCacheKey = (id) => `${exports.COMMENT_OBJECT_CACHE_PREFIX_KEY}${id}`;
15
15
  exports.getCommentObjectCacheKey = getCommentObjectCacheKey;
16
- /** COMMMENT OBJECTS **/
16
+ /** COMMENT OBJECTS **/
17
17
  exports.COMMENT_OBJECTS_CACHE_PREFIX_KEY = '_cos_';
18
18
  const getCommentObjectsCacheKey = (id, type, next) => `${exports.COMMENT_OBJECTS_CACHE_PREFIX_KEY}${type}_${id}_${next}`;
19
19
  exports.getCommentObjectsCacheKey = getCommentObjectsCacheKey;
20
20
  const getCommentObjectsCachePrefixKeys = (id, type) => `${exports.COMMENT_OBJECTS_CACHE_PREFIX_KEY}${type}_${id}`;
21
21
  exports.getCommentObjectsCachePrefixKeys = getCommentObjectsCachePrefixKeys;
22
+ /** LESSON COMMENT OBJECT **/
23
+ exports.LESSON_COMMENT_CACHE_PREFIX_KEY = '_lco_';
24
+ const getLessonCommentCacheKey = (id) => `${exports.LESSON_COMMENT_CACHE_PREFIX_KEY}${id}`;
25
+ exports.getLessonCommentCacheKey = getLessonCommentCacheKey;
26
+ /** LESSON COMMENT OBJECTS **/
27
+ exports.LESSON_COMMENTS_CACHE_PREFIX_KEY = '_lcos_';
28
+ const getLessonCommentsCacheKey = (id, next) => `${exports.LESSON_COMMENTS_CACHE_PREFIX_KEY}${id}_${next}`;
29
+ exports.getLessonCommentsCacheKey = getLessonCommentsCacheKey;
30
+ const getLessonCommentsCachePrefixKeys = (id) => `${exports.LESSON_COMMENTS_CACHE_PREFIX_KEY}${id}`;
31
+ exports.getLessonCommentsCachePrefixKeys = getLessonCommentsCachePrefixKeys;
22
32
  /** CATEGORIES OBJECT **/
23
33
  exports.CATEGORIES_OBJECT_CACHE_PREFIX_KEY = '_cas_';
24
34
  const getCategoriesObjectCacheKey = () => `${exports.CATEGORIES_OBJECT_CACHE_PREFIX_KEY}`;
@@ -27,6 +37,18 @@ exports.getCategoriesObjectCacheKey = getCategoriesObjectCacheKey;
27
37
  exports.CATEGORY_OBJECT_CACHE_PREFIX_KEY = '_ca_';
28
38
  const getCategoryObjectCacheKey = (id) => `${exports.CATEGORY_OBJECT_CACHE_PREFIX_KEY}${id}`;
29
39
  exports.getCategoryObjectCacheKey = getCategoryObjectCacheKey;
40
+ /** COURSE OBJECT **/
41
+ exports.COURSE_OBJECT_CACHE_PREFIX_KEY = '_crs_';
42
+ const getCourseObjectCacheKey = (id) => `${exports.COURSE_OBJECT_CACHE_PREFIX_KEY}${id}`;
43
+ exports.getCourseObjectCacheKey = getCourseObjectCacheKey;
44
+ /** COURSES OBJECT **/
45
+ exports.COURSES_OBJECT_CACHE_PREFIX_KEY = '_crss_';
46
+ const getCoursesObjectCacheKey = () => `${exports.COURSES_OBJECT_CACHE_PREFIX_KEY}`;
47
+ exports.getCoursesObjectCacheKey = getCoursesObjectCacheKey;
48
+ /** LESSON OBJECT **/
49
+ exports.LESSON_OBJECT_CACHE_PREFIX_KEY = '_lss_';
50
+ const getLessonObjectCacheKey = (id) => `${exports.LESSON_OBJECT_CACHE_PREFIX_KEY}${id}`;
51
+ exports.getLessonObjectCacheKey = getLessonObjectCacheKey;
30
52
  /** EVENT OBJECT **/
31
53
  exports.EVENT_OBJECT_CACHE_PREFIX_KEY = '_evt_';
32
54
  const getEventObjectCacheKey = (id) => `${exports.EVENT_OBJECT_CACHE_PREFIX_KEY}${id}`;
@@ -35,6 +57,10 @@ exports.getEventObjectCacheKey = getEventObjectCacheKey;
35
57
  exports.EVENTS_OBJECT_CACHE_PREFIX_KEY = '_evts_';
36
58
  const getEventsObjectCacheKey = () => `${exports.EVENTS_OBJECT_CACHE_PREFIX_KEY}`;
37
59
  exports.getEventsObjectCacheKey = getEventsObjectCacheKey;
60
+ /** EVENT OBJECT **/
61
+ exports.LIVESTREAM_OBJECT_CACHE_PREFIX_KEY = '_liveStream_';
62
+ const getLiveStreamObjectCacheKey = (id) => `${exports.LIVESTREAM_OBJECT_CACHE_PREFIX_KEY}${id}`;
63
+ exports.getLiveStreamObjectCacheKey = getLiveStreamObjectCacheKey;
38
64
  /** GROUP OBJECT **/
39
65
  exports.GROUP_OBJECT_CACHE_PREFIX_KEY = '_grp_';
40
66
  const getGroupObjectCacheKey = (id) => `${exports.GROUP_OBJECT_CACHE_PREFIX_KEY}${id}`;
@@ -96,8 +122,12 @@ exports.USER_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = '_uFoldWidget_';
96
122
  exports.USER_EVENTS_STATE_CACHE_PREFIX_KEY = '_uEvents_';
97
123
  exports.USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = '_uOtherEvents_';
98
124
  exports.USER_PARTECIPANTS_EVENTS_STATE_CACHE_PREFIX_KEY = '_uPartecipantsEvents_';
125
+ exports.USER_PARTECIPANTS_COURSES_STATE_CACHE_PREFIX_KEY = '_uPartecipantsCourses_';
126
+ exports.USER_REQUESTS_COURSES_STATE_CACHE_PREFIX_KEY = '_uRequestsCourses_';
127
+ exports.USER_COMMENTS_COURSES_STATE_CACHE_PREFIX_KEY = '_uCommentsCourses_';
99
128
  exports.USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = '_uInvitedEvents_';
100
129
  exports.USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = '_uRequestsEvents_';
130
+ exports.USER_LIVE_STREAM_CACHE_PREFIX_KEY = '_uUserLives_';
101
131
  exports.EVENT_MEDIA_STATE_CACHE_PREFIX_KEY = '_eMedia_';
102
132
  exports.USER_CONNECTIONS_TOOLS_STATE_CACHE_PREFIX_KEY = '_uConWidget_';
103
133
  exports.USER_CONNECTIONS_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = '_uConReqWidget_';
@@ -21,6 +21,7 @@ export declare const SCNotificationMapping: {
21
21
  16: SCNotificationTypologyType;
22
22
  37: SCNotificationTypologyType;
23
23
  105: SCNotificationTypologyType;
24
+ 26: SCNotificationTypologyType;
24
25
  50: SCNotificationTypologyType;
25
26
  51: SCNotificationTypologyType;
26
27
  52: SCNotificationTypologyType;
@@ -24,6 +24,7 @@ exports.SCNotificationMapping = {
24
24
  16: types_1.SCNotificationTypologyType.FOLLOW,
25
25
  37: types_1.SCNotificationTypologyType.PRIVATE_MESSAGE,
26
26
  105: types_1.SCNotificationTypologyType.DELETE_PRIVATE_MESSAGE,
27
+ 26: types_1.SCNotificationTypologyType.LIVE_STREAM_STARTED,
27
28
  50: types_1.SCNotificationTypologyType.DELETED_FOR_ADVERTISING,
28
29
  51: types_1.SCNotificationTypologyType.DELETED_FOR_AGGRESSIVE,
29
30
  52: types_1.SCNotificationTypologyType.DELETED_FOR_VULGAR,
@@ -50,7 +51,7 @@ exports.SCNotificationMapping = {
50
51
  31: types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_GROUP,
51
52
  32: types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP,
52
53
  33: types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP,
53
- 34: types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP
54
+ 34: types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP,
54
55
  };
55
56
  /**
56
57
  * Silent Snippet Notifications
@@ -117,6 +117,7 @@ export declare const CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE_SETTINGS: string;
117
117
  export declare const CONFIGURATIONS_URL_TEMPLATE_NOTIFICATIONS: string;
118
118
  export declare const CONFIGURATIONS_URL_TEMPLATE_USER_PRIVATE_MESSAGES: string;
119
119
  export declare const CONFIGURATIONS_URL_TEMPLATE_INCUBATOR: string;
120
+ export declare const CONFIGURATIONS_URL_TEMPLATE_LIVE_STREAM: string;
120
121
  export declare const CONFIGURATIONS_APP_URL: string;
121
122
  export declare const CONFIGURATIONS_USER_METADATA_DEFINITIONS: string;
122
123
  export declare const CONFIGURATIONS_TAG_MANAGER_CONTAINER_ID: string;
@@ -134,8 +135,15 @@ export declare const CONFIGURATIONS_EVENTS_ENABLED: string;
134
135
  export declare const CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED: string;
135
136
  export declare const CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED: string;
136
137
  export declare const CONFIGURATIONS_EVENTS_PRIVATE_ENABLED: string;
138
+ export declare const CONFIGURATIONS_COURSES_ENABLED: string;
139
+ export declare const CONFIGURATIONS_COURSES_ONLY_STAFF_ENABLED: string;
140
+ export declare const CONFIGURATIONS_COURSES_VISIBILITY_ENABLED: string;
141
+ export declare const CONFIGURATIONS_COURSES_PRIVATE_ENABLED: string;
137
142
  export declare const CONFIGURATIONS_ONBOARDING_ENABLED: string;
138
143
  export declare const CONFIGURATIONS_ONBOARDING_HIDDEN: string;
144
+ export declare const CONFIGURATIONS_LIVE_STREAM_ENABLED: string;
145
+ export declare const CONFIGURATIONS_LIVE_STREAM_ONLY_STAFF_ENABLED: string;
146
+ export declare const CONFIGURATIONS_SUBSCRIPTION_TIER: string;
139
147
  /**
140
148
  * PROVIDERS
141
149
  */
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED = exports.ADDONS_POST_GEOLOCATION_ENABLED = exports.ADDONS_REGISTRATION_WIZARD = exports.ADDONS_POLLS_ENABLED = exports.ADDONS_LOYALTY_POINTS_COLLECTION = exports.ADDONS_INCUBATOR_SUBSCRIBERS = exports.ADDONS_INCUBATOR_ENABLED = exports.ADDONS_CLOSED_COMMUNITY = exports.ADDONS_AFFINITY_ENABLED = exports.POINTS_DAILY_VISIT = exports.POINTS_APP_USED = exports.POINTS_SOCIAL_SHARE = exports.POINTS_CONNECTION_OR_FOLLOWER = exports.POINTS_RECEIVE_VOTE = exports.POINTS_MAKE_COMMENT = exports.POINTS_MAKE_POST = exports.POINTS_MAKE_DISCUSSION = exports.LOYALTY_PRIZE_C_IMAGE = exports.LOYALTY_PRIZE_B_IMAGE = exports.LOYALTY_PRIZE_A_IMAGE = exports.STAFF_STAFF_BADGE_LABEL = exports.STAFF_STAFF_BADGE_ICON = exports.IMAGES_ERRORPAGES_IMAGE = exports.IMAGES_ERROR_503 = exports.IMAGES_ERROR_404 = exports.IMAGES_USER_DEFAULT_COVER = exports.IMAGES_APP_ICON = exports.COVERS_VISIBILITY = exports.COVERS_COVER_4_HP_M1920 = exports.COVERS_COVER_3_HP_M1920 = exports.COVERS_COVER_2_HP_M1920 = exports.COVERS_COVER_1_HP_M1920 = exports.COLORS_COLORFONTSECONDARY = exports.COLORS_COLORFONT = exports.COLORS_NAVBARBACK = exports.COLORS_COLORSECONDARY = exports.COLORS_COLORPRIMARY = exports.COLORS_COLORBACK = exports.LOGO_NAVBAR_LOGO_MOBILE = exports.LOGO_NAVBAR_LOGO = exports.STYLE_FONT_FAMILY = exports.TEXT_ERROR_PAGES_SUBTITLE = exports.TEXT_ERROR_PAGES_TITLE = exports.TEXT_APPLICATION_COPYRIGHT = exports.TEXT_APPLICATION_SLOGAN2 = exports.TEXT_APPLICATION_SLOGAN1 = exports.TEXT_APPLICATION_NAME = exports.DEFAULT_GLOBAL_PREFERENCES_OPTION = exports.GLOBAL_PREFERENCES_OPTION = exports.PREFERENCES_OPTION = void 0;
4
- exports.CONFIGURATIONS_ONBOARDING_ENABLED = exports.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED = exports.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED = exports.CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_EVENTS_ENABLED = exports.CONFIGURATIONS_GROUPS_PRIVATE_ENABLED = exports.CONFIGURATIONS_GROUPS_VISIBILITY_ENABLED = exports.CONFIGURATIONS_GROUPS_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_GROUPS_ENABLED = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED = exports.CONFIGURATIONS_GDPR_SIGNUP_ACCEPT_HTML = exports.CONFIGURATIONS_GDPR_COOKIE_CONSENT_EXTERNAL_HTML = exports.CONFIGURATIONS_TAG_MANAGER_CONTAINER_ID = exports.CONFIGURATIONS_USER_METADATA_DEFINITIONS = exports.CONFIGURATIONS_APP_URL = exports.CONFIGURATIONS_URL_TEMPLATE_INCUBATOR = exports.CONFIGURATIONS_URL_TEMPLATE_USER_PRIVATE_MESSAGES = exports.CONFIGURATIONS_URL_TEMPLATE_NOTIFICATIONS = exports.CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE_SETTINGS = exports.CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE = exports.CONFIGURATIONS_URL_TEMPLATE_CATEGORIES_LIST = exports.CONFIGURATIONS_URL_TEMPLATE_CATEGORY = exports.CONFIGURATIONS_URL_TEMPLATE_COMMENT = exports.CONFIGURATIONS_URL_TEMPLATE_STATUS = exports.CONFIGURATIONS_URL_TEMPLATE_DISCUSSION = exports.CONFIGURATIONS_URL_TEMPLATE_POST = exports.CONFIGURATIONS_URL_TEMPLATE_VERIFY_EMAIL = exports.CONFIGURATIONS_URL_TEMPLATE_PASSWORD_RECOVER = exports.CONFIGURATIONS_URL_TEMPLATE_EMAIL_UNSUBSCRIBE = exports.CONFIGURATIONS_URL_TEMPLATE_EMAIL_SETTINGS = exports.CONFIGURATIONS_STATUS_TYPE_ENABLED = exports.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED = exports.CONFIGURATIONS_POST_TYPE_ENABLED = exports.CONFIGURATIONS_USERS_APPROVAL_ENABLED = exports.CONFIGURATIONS_CONTENT_AVAILABILITY = exports.CONFIGURATIONS_STREAM_QUALITY = exports.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_PEOPLE_SEARCH_ENABLED = exports.CONFIGURATIONS_MANUAL_CATEGORIES_ORDER_ENABLED = exports.CONFIGURATIONS_HOME_STREAM_ORDER_BY = exports.CONFIGURATIONS_EXPLORE_STREAM_ORDER_BY = exports.CONFIGURATIONS_EXPLORE_STREAM_ENABLED = exports.CONFIGURATIONS_FOLLOW_ENABLED = exports.ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED = exports.ADVERTISING_CUSTOM_ADV_ENABLED = exports.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED = exports.ADDONS_SHARE_POST_ON_TWITTER_ENABLED = void 0;
5
- exports.DATA_TYPES = exports.getPreference = exports.getPreferenceName = exports.getPreferenceSection = exports.WEBMASTER_META_DESCRIPTION = exports.WEBMASTER_META_TITLE_HOME_NOT_LOGGED = exports.WEBMASTER_META_ROBOTS = exports.PROVIDERS_WEB_PUSH_ENABLED = exports.PROVIDERS_WEB_PUSH_PUBLIC_KEY = exports.PROVIDERS_GOOGLE_APP_SECRET = exports.PROVIDERS_GOOGLE_APP_KEY = exports.PROVIDERS_GOOGLE_SIGNIN_ENABLED = exports.PROVIDERS_GOOGLE_GEOCODING_API_KEY = exports.PROVIDERS_TWITTER_APP_SECRET = exports.PROVIDERS_TWITTER_APP_KEY = exports.PROVIDERS_TWITTER_SIGNIN_ENABLED = exports.PROVIDERS_LINKEDIN_APP_SECRET = exports.PROVIDERS_LINKEDIN_APP_KEY = exports.PROVIDERS_LINKEDIN_SIGNIN_ENABLED = exports.PROVIDERS_FACEBOOK_APP_SECRET = exports.PROVIDERS_FACEBOOK_APP_KEY = exports.PROVIDERS_FACEBOOK_SIGNIN_ENABLED = exports.PROVIDERS_APP_URL_ON_GOOGLE_PLAY = exports.PROVIDERS_APP_URL_ON_APP_STORE = exports.CONFIGURATIONS_ONBOARDING_HIDDEN = void 0;
4
+ exports.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED = exports.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED = exports.CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_EVENTS_ENABLED = exports.CONFIGURATIONS_GROUPS_PRIVATE_ENABLED = exports.CONFIGURATIONS_GROUPS_VISIBILITY_ENABLED = exports.CONFIGURATIONS_GROUPS_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_GROUPS_ENABLED = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED = exports.CONFIGURATIONS_GDPR_SIGNUP_ACCEPT_HTML = exports.CONFIGURATIONS_GDPR_COOKIE_CONSENT_EXTERNAL_HTML = exports.CONFIGURATIONS_TAG_MANAGER_CONTAINER_ID = exports.CONFIGURATIONS_USER_METADATA_DEFINITIONS = exports.CONFIGURATIONS_APP_URL = exports.CONFIGURATIONS_URL_TEMPLATE_LIVE_STREAM = exports.CONFIGURATIONS_URL_TEMPLATE_INCUBATOR = exports.CONFIGURATIONS_URL_TEMPLATE_USER_PRIVATE_MESSAGES = exports.CONFIGURATIONS_URL_TEMPLATE_NOTIFICATIONS = exports.CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE_SETTINGS = exports.CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE = exports.CONFIGURATIONS_URL_TEMPLATE_CATEGORIES_LIST = exports.CONFIGURATIONS_URL_TEMPLATE_CATEGORY = exports.CONFIGURATIONS_URL_TEMPLATE_COMMENT = exports.CONFIGURATIONS_URL_TEMPLATE_STATUS = exports.CONFIGURATIONS_URL_TEMPLATE_DISCUSSION = exports.CONFIGURATIONS_URL_TEMPLATE_POST = exports.CONFIGURATIONS_URL_TEMPLATE_VERIFY_EMAIL = exports.CONFIGURATIONS_URL_TEMPLATE_PASSWORD_RECOVER = exports.CONFIGURATIONS_URL_TEMPLATE_EMAIL_UNSUBSCRIBE = exports.CONFIGURATIONS_URL_TEMPLATE_EMAIL_SETTINGS = exports.CONFIGURATIONS_STATUS_TYPE_ENABLED = exports.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED = exports.CONFIGURATIONS_POST_TYPE_ENABLED = exports.CONFIGURATIONS_USERS_APPROVAL_ENABLED = exports.CONFIGURATIONS_CONTENT_AVAILABILITY = exports.CONFIGURATIONS_STREAM_QUALITY = exports.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_PEOPLE_SEARCH_ENABLED = exports.CONFIGURATIONS_MANUAL_CATEGORIES_ORDER_ENABLED = exports.CONFIGURATIONS_HOME_STREAM_ORDER_BY = exports.CONFIGURATIONS_EXPLORE_STREAM_ORDER_BY = exports.CONFIGURATIONS_EXPLORE_STREAM_ENABLED = exports.CONFIGURATIONS_FOLLOW_ENABLED = exports.ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED = exports.ADVERTISING_CUSTOM_ADV_ENABLED = exports.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED = exports.ADDONS_SHARE_POST_ON_TWITTER_ENABLED = void 0;
5
+ exports.DATA_TYPES = exports.getPreference = exports.getPreferenceName = exports.getPreferenceSection = exports.WEBMASTER_META_DESCRIPTION = exports.WEBMASTER_META_TITLE_HOME_NOT_LOGGED = exports.WEBMASTER_META_ROBOTS = exports.PROVIDERS_WEB_PUSH_ENABLED = exports.PROVIDERS_WEB_PUSH_PUBLIC_KEY = exports.PROVIDERS_GOOGLE_APP_SECRET = exports.PROVIDERS_GOOGLE_APP_KEY = exports.PROVIDERS_GOOGLE_SIGNIN_ENABLED = exports.PROVIDERS_GOOGLE_GEOCODING_API_KEY = exports.PROVIDERS_TWITTER_APP_SECRET = exports.PROVIDERS_TWITTER_APP_KEY = exports.PROVIDERS_TWITTER_SIGNIN_ENABLED = exports.PROVIDERS_LINKEDIN_APP_SECRET = exports.PROVIDERS_LINKEDIN_APP_KEY = exports.PROVIDERS_LINKEDIN_SIGNIN_ENABLED = exports.PROVIDERS_FACEBOOK_APP_SECRET = exports.PROVIDERS_FACEBOOK_APP_KEY = exports.PROVIDERS_FACEBOOK_SIGNIN_ENABLED = exports.PROVIDERS_APP_URL_ON_GOOGLE_PLAY = exports.PROVIDERS_APP_URL_ON_APP_STORE = exports.CONFIGURATIONS_SUBSCRIPTION_TIER = exports.CONFIGURATIONS_LIVE_STREAM_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_LIVE_STREAM_ENABLED = exports.CONFIGURATIONS_ONBOARDING_HIDDEN = exports.CONFIGURATIONS_ONBOARDING_ENABLED = exports.CONFIGURATIONS_COURSES_PRIVATE_ENABLED = exports.CONFIGURATIONS_COURSES_VISIBILITY_ENABLED = exports.CONFIGURATIONS_COURSES_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_COURSES_ENABLED = void 0;
6
6
  const types_1 = require("@selfcommunity/types");
7
7
  /**
8
8
  * DEFAULT CONF VALIDATION OPTION
@@ -123,6 +123,7 @@ exports.CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE_SETTINGS = `${types_1.SCPrefere
123
123
  exports.CONFIGURATIONS_URL_TEMPLATE_NOTIFICATIONS = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.URL_TEMPLATE_NOTIFICATIONS}`;
124
124
  exports.CONFIGURATIONS_URL_TEMPLATE_USER_PRIVATE_MESSAGES = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.URL_TEMPLATE_USER_PRIVATE_MESSAGES}`;
125
125
  exports.CONFIGURATIONS_URL_TEMPLATE_INCUBATOR = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.URL_TEMPLATE_INCUBATOR}`;
126
+ exports.CONFIGURATIONS_URL_TEMPLATE_LIVE_STREAM = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.URL_TEMPLATE_LIVE_STREAM}`;
126
127
  exports.CONFIGURATIONS_APP_URL = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.APP_URL}`;
127
128
  exports.CONFIGURATIONS_USER_METADATA_DEFINITIONS = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.USER_METADATA_DEFINITIONS}`;
128
129
  exports.CONFIGURATIONS_TAG_MANAGER_CONTAINER_ID = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.TAG_MANAGER_CONTAINER_ID}`;
@@ -140,8 +141,15 @@ exports.CONFIGURATIONS_EVENTS_ENABLED = `${types_1.SCPreferenceSection.CONFIGURA
140
141
  exports.CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.EVENTS_ONLY_STAFF_ENABLED}`;
141
142
  exports.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.EVENTS_VISIBILITY_ENABLED}`;
142
143
  exports.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.EVENTS_PRIVATE_ENABLED}`;
144
+ exports.CONFIGURATIONS_COURSES_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.COURSES_ENABLED}`;
145
+ exports.CONFIGURATIONS_COURSES_ONLY_STAFF_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.COURSES_ONLY_STAFF_ENABLED}`;
146
+ exports.CONFIGURATIONS_COURSES_VISIBILITY_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.COURSES_VISIBILITY_ENABLED}`;
147
+ exports.CONFIGURATIONS_COURSES_PRIVATE_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.COURSES_PRIVATE_ENABLED}`;
143
148
  exports.CONFIGURATIONS_ONBOARDING_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.ONBOARDING_ENABLED}`;
144
149
  exports.CONFIGURATIONS_ONBOARDING_HIDDEN = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.ONBOARDING_HIDDEN}`;
150
+ exports.CONFIGURATIONS_LIVE_STREAM_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.LIVE_STREAM_ENABLED}`;
151
+ exports.CONFIGURATIONS_LIVE_STREAM_ONLY_STAFF_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.LIVE_STREAM_ONLY_STAFF_ENABLED}`;
152
+ exports.CONFIGURATIONS_SUBSCRIPTION_TIER = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.SUBSCRIPTION_TIER}`;
145
153
  /**
146
154
  * PROVIDERS
147
155
  */
@@ -272,6 +280,7 @@ exports.DATA_TYPES = {
272
280
  [exports.CONFIGURATIONS_URL_TEMPLATE_NOTIFICATIONS]: stringType,
273
281
  [exports.CONFIGURATIONS_URL_TEMPLATE_USER_PRIVATE_MESSAGES]: stringType,
274
282
  [exports.CONFIGURATIONS_URL_TEMPLATE_INCUBATOR]: stringType,
283
+ [exports.CONFIGURATIONS_URL_TEMPLATE_LIVE_STREAM]: stringType,
275
284
  [exports.CONFIGURATIONS_APP_URL]: stringType,
276
285
  [exports.CONFIGURATIONS_USER_METADATA_DEFINITIONS]: stringType,
277
286
  [exports.CONFIGURATIONS_TAG_MANAGER_CONTAINER_ID]: stringType,
@@ -289,8 +298,15 @@ exports.DATA_TYPES = {
289
298
  [exports.CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED]: booleanType,
290
299
  [exports.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED]: booleanType,
291
300
  [exports.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED]: booleanType,
301
+ [exports.CONFIGURATIONS_COURSES_ENABLED]: booleanType,
302
+ [exports.CONFIGURATIONS_COURSES_ONLY_STAFF_ENABLED]: booleanType,
303
+ [exports.CONFIGURATIONS_COURSES_VISIBILITY_ENABLED]: booleanType,
304
+ [exports.CONFIGURATIONS_COURSES_PRIVATE_ENABLED]: booleanType,
292
305
  [exports.CONFIGURATIONS_ONBOARDING_ENABLED]: booleanType,
293
306
  [exports.CONFIGURATIONS_ONBOARDING_HIDDEN]: booleanType,
307
+ [exports.CONFIGURATIONS_LIVE_STREAM_ENABLED]: booleanType,
308
+ [exports.CONFIGURATIONS_LIVE_STREAM_ONLY_STAFF_ENABLED]: booleanType,
309
+ [exports.CONFIGURATIONS_SUBSCRIPTION_TIER]: stringType,
294
310
  [exports.PROVIDERS_APP_URL_ON_APP_STORE]: stringType,
295
311
  [exports.PROVIDERS_APP_URL_ON_GOOGLE_PLAY]: stringType,
296
312
  [exports.PROVIDERS_FACEBOOK_SIGNIN_ENABLED]: stringType,
@@ -38,9 +38,17 @@ export declare const GROUPS_ROUTE_NAME = "groups";
38
38
  export declare const GROUPS_SUBSCRIBED_ROUTE_NAME = "groups_subscribed";
39
39
  export declare const EVENT_ROUTE_NAME = "event";
40
40
  export declare const EVENTS_ROUTE_NAME = "events";
41
+ export declare const COURSE_ROUTE_NAME = "course";
42
+ export declare const COURSE_EDIT_ROUTE_NAME = "course_edit";
43
+ export declare const COURSE_DASHBOARD_ROUTE_NAME = "course_dashboard";
44
+ export declare const COURSE_LESSON_ROUTE_NAME = "course_lesson";
45
+ export declare const COURSE_LESSON_COMMENT_ROUTE_NAME = "course_lesson_comment";
46
+ export declare const COURSES_ROUTE_NAME = "courses";
47
+ export declare const COURSES_SUBSCRIBED_ROUTE_NAME = "courses_subscribed";
41
48
  export declare const EVENTS_SUGGESTED_ROUTE_NAME = "events_suggested";
42
49
  export declare const EVENTS_SUBSCRIBED_ROUTE_NAME = "events_subscribed";
43
50
  export declare const EVENTS_HIGHLIGHT_ROUTE_NAME = "events_highlight";
51
+ export declare const LIVESTREAM_ROUTE_NAME = "live";
44
52
  /**
45
53
  * Default Routes
46
54
  * @type {{[p: string]: string, '[POST_ROUTE_NAME]': string, '[INCUBATOR_ROUTE_NAME]': string, '[LOYALTY_ROUTE_NAME]': string, '[USER_NOTIFICATION_ROUTE_NAME]': string, '[USER_PRIVATE_MESSAGES_ROUTE_NAME]': string, '[COMMENT_ROUTE_NAME]': string, '[DISCUSSION_ROUTE_NAME]': string, '[CATEGORIES_ROUTE_NAME]': string, '[USER_PROFILE_ROUTE_NAME]': string, '[CATEGORY_ROUTE_NAME]': string, '[USER_PROFILE_SETTINGS_ROUTE_NAME]': string, '[STATUS_ROUTE_NAME]': string}}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultRoutes = exports.EVENTS_HIGHLIGHT_ROUTE_NAME = exports.EVENTS_SUBSCRIBED_ROUTE_NAME = exports.EVENTS_SUGGESTED_ROUTE_NAME = exports.EVENTS_ROUTE_NAME = exports.EVENT_ROUTE_NAME = exports.GROUPS_SUBSCRIBED_ROUTE_NAME = exports.GROUPS_ROUTE_NAME = exports.GROUP_MESSAGES_ROUTE_NAME = exports.GROUP_MEMBERS_ROUTE_NAME = exports.GROUP_ROUTE_NAME = exports.LEGAL_PAGES_ROUTE_NAME = exports.CUSTOM_PAGES_ROUTE_NAME = exports.RECOVER_ROUTE_NAME = exports.SIGNUP_ROUTE_NAME = exports.SIGNIN_ROUTE_NAME = exports.INCUBATOR_ROUTE_NAME = exports.LOYALTY_ROUTE_NAME = exports.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME = exports.USER_PROFILE_CATEGORIES_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_REQUESTS_SENT_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_REQUESTS_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWERS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWINGS_ROUTE_NAME = exports.USER_PRIVATE_MESSAGES_ROUTE_NAME = exports.USER_NOTIFICATIONS_ROUTE_NAME = exports.USER_PROFILE_SETTINGS_ROUTE_NAME = exports.USER_PROFILE_ROUTE_NAME = exports.CATEGORIES_LIST_ROUTE_NAME = exports.CATEGORY_TRENDING_FEED_ROUTE_NAME = exports.CATEGORY_ROUTE_NAME = exports.COMMENT_ROUTE_NAME = exports.STATUS_ROUTE_NAME = exports.DISCUSSION_ROUTE_NAME = exports.POST_ROUTE_NAME = exports.EXPLORE_ROUTE_NAME = exports.HOME_ROUTE_NAME = exports.ROUTER_OPTION = exports.PORTAL_OPTION = void 0;
3
+ exports.defaultRoutes = exports.LIVESTREAM_ROUTE_NAME = exports.EVENTS_HIGHLIGHT_ROUTE_NAME = exports.EVENTS_SUBSCRIBED_ROUTE_NAME = exports.EVENTS_SUGGESTED_ROUTE_NAME = exports.COURSES_SUBSCRIBED_ROUTE_NAME = exports.COURSES_ROUTE_NAME = exports.COURSE_LESSON_COMMENT_ROUTE_NAME = exports.COURSE_LESSON_ROUTE_NAME = exports.COURSE_DASHBOARD_ROUTE_NAME = exports.COURSE_EDIT_ROUTE_NAME = exports.COURSE_ROUTE_NAME = exports.EVENTS_ROUTE_NAME = exports.EVENT_ROUTE_NAME = exports.GROUPS_SUBSCRIBED_ROUTE_NAME = exports.GROUPS_ROUTE_NAME = exports.GROUP_MESSAGES_ROUTE_NAME = exports.GROUP_MEMBERS_ROUTE_NAME = exports.GROUP_ROUTE_NAME = exports.LEGAL_PAGES_ROUTE_NAME = exports.CUSTOM_PAGES_ROUTE_NAME = exports.RECOVER_ROUTE_NAME = exports.SIGNUP_ROUTE_NAME = exports.SIGNIN_ROUTE_NAME = exports.INCUBATOR_ROUTE_NAME = exports.LOYALTY_ROUTE_NAME = exports.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME = exports.USER_PROFILE_CATEGORIES_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_REQUESTS_SENT_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_REQUESTS_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWERS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWINGS_ROUTE_NAME = exports.USER_PRIVATE_MESSAGES_ROUTE_NAME = exports.USER_NOTIFICATIONS_ROUTE_NAME = exports.USER_PROFILE_SETTINGS_ROUTE_NAME = exports.USER_PROFILE_ROUTE_NAME = exports.CATEGORIES_LIST_ROUTE_NAME = exports.CATEGORY_TRENDING_FEED_ROUTE_NAME = exports.CATEGORY_ROUTE_NAME = exports.COMMENT_ROUTE_NAME = exports.STATUS_ROUTE_NAME = exports.DISCUSSION_ROUTE_NAME = exports.POST_ROUTE_NAME = exports.EXPLORE_ROUTE_NAME = exports.HOME_ROUTE_NAME = exports.ROUTER_OPTION = exports.PORTAL_OPTION = void 0;
4
4
  exports.PORTAL_OPTION = 'portal';
5
5
  exports.ROUTER_OPTION = 'router';
6
6
  /**
@@ -41,9 +41,17 @@ exports.GROUPS_ROUTE_NAME = 'groups';
41
41
  exports.GROUPS_SUBSCRIBED_ROUTE_NAME = 'groups_subscribed';
42
42
  exports.EVENT_ROUTE_NAME = 'event';
43
43
  exports.EVENTS_ROUTE_NAME = 'events';
44
+ exports.COURSE_ROUTE_NAME = 'course';
45
+ exports.COURSE_EDIT_ROUTE_NAME = 'course_edit';
46
+ exports.COURSE_DASHBOARD_ROUTE_NAME = 'course_dashboard';
47
+ exports.COURSE_LESSON_ROUTE_NAME = 'course_lesson';
48
+ exports.COURSE_LESSON_COMMENT_ROUTE_NAME = 'course_lesson_comment';
49
+ exports.COURSES_ROUTE_NAME = 'courses';
50
+ exports.COURSES_SUBSCRIBED_ROUTE_NAME = 'courses_subscribed';
44
51
  exports.EVENTS_SUGGESTED_ROUTE_NAME = 'events_suggested';
45
52
  exports.EVENTS_SUBSCRIBED_ROUTE_NAME = 'events_subscribed';
46
53
  exports.EVENTS_HIGHLIGHT_ROUTE_NAME = 'events_highlight';
54
+ exports.LIVESTREAM_ROUTE_NAME = 'live';
47
55
  /**
48
56
  * Default Routes
49
57
  * @type {{[p: string]: string, '[POST_ROUTE_NAME]': string, '[INCUBATOR_ROUTE_NAME]': string, '[LOYALTY_ROUTE_NAME]': string, '[USER_NOTIFICATION_ROUTE_NAME]': string, '[USER_PRIVATE_MESSAGES_ROUTE_NAME]': string, '[COMMENT_ROUTE_NAME]': string, '[DISCUSSION_ROUTE_NAME]': string, '[CATEGORIES_ROUTE_NAME]': string, '[USER_PROFILE_ROUTE_NAME]': string, '[CATEGORY_ROUTE_NAME]': string, '[USER_PROFILE_SETTINGS_ROUTE_NAME]': string, '[STATUS_ROUTE_NAME]': string}}
@@ -87,4 +95,12 @@ exports.defaultRoutes = {
87
95
  [exports.EVENT_ROUTE_NAME]: '/event/:id/:slug/',
88
96
  [exports.EVENTS_SUBSCRIBED_ROUTE_NAME]: '/events/subscribed/',
89
97
  [exports.EVENTS_HIGHLIGHT_ROUTE_NAME]: '/events/highlight/',
98
+ [exports.COURSE_ROUTE_NAME]: '/course/:id/:slug/',
99
+ [exports.COURSES_ROUTE_NAME]: '/courses/',
100
+ [exports.COURSE_EDIT_ROUTE_NAME]: '/course/:id/:slug/edit',
101
+ [exports.COURSE_DASHBOARD_ROUTE_NAME]: '/course/:id/:slug/dashboard',
102
+ [exports.COURSE_LESSON_ROUTE_NAME]: '/course/:id/:slug/section/:section_id/lesson/:lesson_id/',
103
+ [exports.COURSE_LESSON_COMMENT_ROUTE_NAME]: '/course/:id/:slug/section/:section_id/lesson/:lesson_id/comment/:comment_id',
104
+ [exports.COURSES_SUBSCRIBED_ROUTE_NAME]: '/courses/subscribed/',
105
+ [exports.LIVESTREAM_ROUTE_NAME]: '/live/:slug/',
90
106
  };
@@ -0,0 +1,23 @@
1
+ import { CourseInfoParams } from '@selfcommunity/api-services';
2
+ import { SCCourseType } from '@selfcommunity/types';
3
+ import { CacheStrategies } from '@selfcommunity/utils';
4
+ /**
5
+ :::info
6
+ This custom hook is used to fetch an course object.
7
+ :::
8
+ * @param object
9
+ * @param object.id
10
+ * @param object.course
11
+ * @param object.cacheStrategy
12
+ * @param object.params
13
+ */
14
+ export default function useSCFetchCourse({ id, course, cacheStrategy, params, }: {
15
+ id?: number | string;
16
+ course?: SCCourseType;
17
+ cacheStrategy?: CacheStrategies;
18
+ params?: CourseInfoParams;
19
+ }): {
20
+ scCourse: SCCourseType;
21
+ setSCCourse: (c: SCCourseType) => void;
22
+ error: string;
23
+ };
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const api_services_1 = require("@selfcommunity/api-services");
4
+ const utils_1 = require("@selfcommunity/utils");
5
+ const react_1 = require("react");
6
+ const use_deep_compare_effect_1 = require("use-deep-compare-effect");
7
+ const SCUserProvider_1 = require("../components/provider/SCUserProvider");
8
+ const Cache_1 = require("../constants/Cache");
9
+ const Errors_1 = require("../constants/Errors");
10
+ /**
11
+ :::info
12
+ This custom hook is used to fetch an course object.
13
+ :::
14
+ * @param object
15
+ * @param object.id
16
+ * @param object.course
17
+ * @param object.cacheStrategy
18
+ * @param object.params
19
+ */
20
+ function useSCFetchCourse({ id = null, course = null, cacheStrategy = utils_1.CacheStrategies.CACHE_FIRST, params = null, }) {
21
+ const __courseId = (0, react_1.useMemo)(() => (course === null || course === void 0 ? void 0 : course.id) || id, [course, id]);
22
+ // CONTEXT
23
+ const scUserContext = (0, SCUserProvider_1.useSCUser)();
24
+ const authUserId = (0, react_1.useMemo)(() => { var _a; return ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) || null; }, [scUserContext.user]);
25
+ // CACHE
26
+ const __courseCacheKey = (0, react_1.useMemo)(() => (0, Cache_1.getCourseObjectCacheKey)(__courseId), [__courseId]);
27
+ const __course = (0, react_1.useMemo)(() => (authUserId ? course : (0, utils_1.objectWithoutProperties)(course, ['join_status'])), [authUserId, course]);
28
+ const [scCourse, setScCourse] = (0, react_1.useState)(cacheStrategy !== utils_1.CacheStrategies.NETWORK_ONLY ? utils_1.LRUCache.get(__courseCacheKey, __course) : null);
29
+ const [error, setError] = (0, react_1.useState)(null);
30
+ const setSCCourse = (0, react_1.useCallback)((c) => {
31
+ setScCourse(c);
32
+ utils_1.LRUCache.set(__courseCacheKey, c);
33
+ }, [setScCourse, __courseCacheKey]);
34
+ /**
35
+ * Memoized fetchTag
36
+ */
37
+ const fetchCourse = (0, react_1.useMemo)(() => (id) => {
38
+ return api_services_1.http
39
+ .request({
40
+ url: api_services_1.Endpoints.GetCourseInfo.url({ id }),
41
+ method: api_services_1.Endpoints.GetCourseInfo.method,
42
+ params: params !== null && params !== void 0 ? params : {},
43
+ })
44
+ .then((res) => {
45
+ if (res.status >= 300) {
46
+ return Promise.reject(res);
47
+ }
48
+ return Promise.resolve(res.data);
49
+ });
50
+ }, []);
51
+ /**
52
+ * If id attempt to get the course by id
53
+ */
54
+ (0, react_1.useEffect)(() => {
55
+ if (id !== null && id !== undefined && !course) {
56
+ fetchCourse(id)
57
+ .then((e) => {
58
+ setSCCourse(e);
59
+ })
60
+ .catch((err) => {
61
+ utils_1.LRUCache.delete(__courseCacheKey);
62
+ if (err.status === 403) {
63
+ setError('You do not have permission to perform this action.');
64
+ utils_1.Logger.error(Errors_1.SCOPE_SC_CORE, 'You do not have permission to perform this action.');
65
+ }
66
+ else {
67
+ setError(`Course with id ${id} not found`);
68
+ utils_1.Logger.error(Errors_1.SCOPE_SC_CORE, `Course with id ${id} not found`);
69
+ }
70
+ utils_1.Logger.error(Errors_1.SCOPE_SC_CORE, err.message);
71
+ });
72
+ }
73
+ }, [id, course, authUserId]);
74
+ (0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
75
+ if (course) {
76
+ setSCCourse(course);
77
+ }
78
+ }, [course, authUserId]);
79
+ return { scCourse, setSCCourse, error };
80
+ }
81
+ exports.default = useSCFetchCourse;
@@ -0,0 +1,22 @@
1
+ import { SCCourseType } from '@selfcommunity/types';
2
+ import { CacheStrategies } from '@selfcommunity/utils';
3
+ /**
4
+ :::info
5
+ This custom hook is used to fetch courses.
6
+ @param object.cacheStrategy
7
+
8
+ :::tip Context can be consumed in this way:
9
+
10
+ ```jsx
11
+ const {courses, isLoading} = useSCFetchCourses();
12
+ ```
13
+ :::
14
+ * @param props
15
+ */
16
+ declare const useSCFetchCourses: (props?: {
17
+ cacheStrategy?: CacheStrategies;
18
+ }) => {
19
+ courses: SCCourseType[];
20
+ isLoading: boolean;
21
+ };
22
+ export default useSCFetchCourses;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = require("react");
5
+ const Errors_1 = require("../constants/Errors");
6
+ const api_services_1 = require("@selfcommunity/api-services");
7
+ const utils_1 = require("@selfcommunity/utils");
8
+ const Cache_1 = require("../constants/Cache");
9
+ const init = { courses: [], isLoading: true };
10
+ // HYDRATE the cache
11
+ const hydrate = (ids) => {
12
+ if (!ids) {
13
+ return null;
14
+ }
15
+ const courses = ids.map((id) => {
16
+ const __courseCacheKey = (0, Cache_1.getCourseObjectCacheKey)(id);
17
+ return utils_1.LRUCache.get(__courseCacheKey);
18
+ });
19
+ if (courses.filter((c) => !c).length > 0) {
20
+ // REVALIDATE CACHE
21
+ return null;
22
+ }
23
+ return courses;
24
+ };
25
+ /**
26
+ :::info
27
+ This custom hook is used to fetch courses.
28
+ @param object.cacheStrategy
29
+
30
+ :::tip Context can be consumed in this way:
31
+
32
+ ```jsx
33
+ const {courses, isLoading} = useSCFetchCourses();
34
+ ```
35
+ :::
36
+ * @param props
37
+ */
38
+ const useSCFetchCourses = (props) => {
39
+ // PROPS
40
+ const { cacheStrategy = utils_1.CacheStrategies.CACHE_FIRST } = props || {};
41
+ // CACHE
42
+ const __coursesCacheKey = (0, Cache_1.getCoursesObjectCacheKey)();
43
+ // STATE
44
+ const courses = cacheStrategy !== utils_1.CacheStrategies.NETWORK_ONLY ? hydrate(utils_1.LRUCache.get(__coursesCacheKey, null)) : null;
45
+ const [data, setData] = (0, react_1.useState)(courses !== null ? { courses, isLoading: false } : init);
46
+ /**
47
+ * Fetch courses
48
+ */
49
+ const fetchCourses = (next = api_services_1.Endpoints.GetJoinedCourses.url()) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
50
+ const response = yield api_services_1.http.request({
51
+ url: next,
52
+ method: api_services_1.Endpoints.GetJoinedCourses.method,
53
+ });
54
+ const data = response.data;
55
+ if (data.next) {
56
+ return data.results.concat(yield fetchCourses(data.next));
57
+ }
58
+ return data.results;
59
+ });
60
+ /**
61
+ * Get courses
62
+ */
63
+ (0, react_1.useEffect)(() => {
64
+ if (cacheStrategy === utils_1.CacheStrategies.CACHE_FIRST && courses) {
65
+ return;
66
+ }
67
+ fetchCourses()
68
+ .then((data) => {
69
+ setData({ courses: data, isLoading: false });
70
+ utils_1.LRUCache.set(__coursesCacheKey, data.map((course) => {
71
+ const __courseCacheKey = (0, Cache_1.getCourseObjectCacheKey)(course.id);
72
+ utils_1.LRUCache.set(__courseCacheKey, course);
73
+ return course.id;
74
+ }));
75
+ })
76
+ .catch((error) => {
77
+ console.log(error);
78
+ utils_1.Logger.error(Errors_1.SCOPE_SC_CORE, 'Unable to retrieve courses');
79
+ });
80
+ }, []);
81
+ return data;
82
+ };
83
+ exports.default = useSCFetchCourses;
@@ -0,0 +1,22 @@
1
+ import { SCCourseLessonType } from '@selfcommunity/types';
2
+ import { CacheStrategies } from '@selfcommunity/utils';
3
+ /**
4
+ :::info
5
+ This custom hook is used to fetch a lesson object.
6
+ :::
7
+ * @param object
8
+ * @param object.id
9
+ * @param object.lesson
10
+ * @param object.cacheStrategy
11
+ */
12
+ export default function useSCFetchLesson({ id, lesson, courseId, sectionId, cacheStrategy, }: {
13
+ id?: number | string;
14
+ lesson?: SCCourseLessonType;
15
+ courseId: number | string;
16
+ sectionId: number | string;
17
+ cacheStrategy?: CacheStrategies;
18
+ }): {
19
+ scLesson: SCCourseLessonType;
20
+ setSCLesson: (lesson: SCCourseLessonType) => void;
21
+ error: string;
22
+ };