@selfcommunity/react-core 0.4.9-alpha.8 → 0.4.9

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 (72) hide show
  1. package/lib/cjs/components/provider/SCContextProvider/index.d.ts +2 -3
  2. package/lib/cjs/components/provider/SCContextProvider/index.js +2 -3
  3. package/lib/cjs/components/provider/SCPreferencesProvider/index.js +1 -1
  4. package/lib/cjs/constants/Cache.d.ts +1 -0
  5. package/lib/cjs/constants/Cache.js +2 -1
  6. package/lib/cjs/constants/Notification.d.ts +4 -0
  7. package/lib/cjs/constants/Notification.js +4 -0
  8. package/lib/cjs/constants/Routes.d.ts +1 -0
  9. package/lib/cjs/constants/Routes.js +3 -1
  10. package/lib/cjs/hooks/useSCFetchAddressingTagList.d.ts +1 -2
  11. package/lib/cjs/hooks/useSCFetchAddressingTagList.js +1 -2
  12. package/lib/cjs/hooks/useSCFetchBroadcastMessages.d.ts +1 -2
  13. package/lib/cjs/hooks/useSCFetchBroadcastMessages.js +1 -2
  14. package/lib/cjs/hooks/useSCFetchCategories.d.ts +1 -2
  15. package/lib/cjs/hooks/useSCFetchCategories.js +3 -11
  16. package/lib/cjs/hooks/useSCFetchCommentObject.d.ts +1 -1
  17. package/lib/cjs/hooks/useSCFetchCommentObject.js +1 -1
  18. package/lib/cjs/hooks/useSCFetchCommentObjects.d.ts +1 -7
  19. package/lib/cjs/hooks/useSCFetchCommentObjects.js +1 -8
  20. package/lib/cjs/hooks/useSCFetchContributors.d.ts +1 -5
  21. package/lib/cjs/hooks/useSCFetchContributors.js +1 -5
  22. package/lib/cjs/hooks/useSCFetchCustomAdv.d.ts +3 -2
  23. package/lib/cjs/hooks/useSCFetchCustomAdv.js +3 -2
  24. package/lib/cjs/hooks/useSCFetchFeed.d.ts +1 -5
  25. package/lib/cjs/hooks/useSCFetchFeed.js +1 -5
  26. package/lib/cjs/hooks/useSCFetchGroup.d.ts +1 -2
  27. package/lib/cjs/hooks/useSCFetchGroup.js +8 -7
  28. package/lib/cjs/hooks/useSCFetchGroups.js +2 -2
  29. package/lib/cjs/hooks/useSCFetchUserBlockedBy.d.ts +4 -2
  30. package/lib/cjs/hooks/useSCFetchUserBlockedBy.js +4 -2
  31. package/lib/cjs/hooks/useSCFetchUserProviders.d.ts +2 -2
  32. package/lib/cjs/hooks/useSCFetchUserProviders.js +2 -2
  33. package/lib/cjs/hooks/useSCFetchVote.d.ts +6 -0
  34. package/lib/cjs/hooks/useSCFetchVote.js +6 -0
  35. package/lib/cjs/hooks/useSCSubscribedGroupsManager.js +10 -5
  36. package/lib/esm/components/provider/SCContextProvider/index.d.ts +2 -3
  37. package/lib/esm/components/provider/SCContextProvider/index.js +2 -3
  38. package/lib/esm/components/provider/SCPreferencesProvider/index.js +1 -1
  39. package/lib/esm/constants/Cache.d.ts +1 -0
  40. package/lib/esm/constants/Cache.js +1 -0
  41. package/lib/esm/constants/Notification.d.ts +4 -0
  42. package/lib/esm/constants/Notification.js +4 -0
  43. package/lib/esm/constants/Routes.d.ts +1 -0
  44. package/lib/esm/constants/Routes.js +2 -0
  45. package/lib/esm/hooks/useSCFetchAddressingTagList.d.ts +1 -2
  46. package/lib/esm/hooks/useSCFetchAddressingTagList.js +1 -2
  47. package/lib/esm/hooks/useSCFetchBroadcastMessages.d.ts +1 -2
  48. package/lib/esm/hooks/useSCFetchBroadcastMessages.js +1 -2
  49. package/lib/esm/hooks/useSCFetchCategories.d.ts +1 -2
  50. package/lib/esm/hooks/useSCFetchCategories.js +4 -12
  51. package/lib/esm/hooks/useSCFetchCommentObject.d.ts +1 -1
  52. package/lib/esm/hooks/useSCFetchCommentObject.js +1 -1
  53. package/lib/esm/hooks/useSCFetchCommentObjects.d.ts +1 -7
  54. package/lib/esm/hooks/useSCFetchCommentObjects.js +1 -8
  55. package/lib/esm/hooks/useSCFetchContributors.d.ts +1 -5
  56. package/lib/esm/hooks/useSCFetchContributors.js +1 -5
  57. package/lib/esm/hooks/useSCFetchCustomAdv.d.ts +3 -2
  58. package/lib/esm/hooks/useSCFetchCustomAdv.js +3 -2
  59. package/lib/esm/hooks/useSCFetchFeed.d.ts +1 -5
  60. package/lib/esm/hooks/useSCFetchFeed.js +1 -5
  61. package/lib/esm/hooks/useSCFetchGroup.d.ts +1 -2
  62. package/lib/esm/hooks/useSCFetchGroup.js +8 -7
  63. package/lib/esm/hooks/useSCFetchGroups.js +2 -2
  64. package/lib/esm/hooks/useSCFetchUserBlockedBy.d.ts +4 -2
  65. package/lib/esm/hooks/useSCFetchUserBlockedBy.js +4 -2
  66. package/lib/esm/hooks/useSCFetchUserProviders.d.ts +2 -2
  67. package/lib/esm/hooks/useSCFetchUserProviders.js +2 -2
  68. package/lib/esm/hooks/useSCFetchVote.d.ts +6 -0
  69. package/lib/esm/hooks/useSCFetchVote.js +6 -0
  70. package/lib/esm/hooks/useSCSubscribedGroupsManager.js +11 -6
  71. package/lib/umd/react-core.js +1 -1
  72. package/package.json +6 -6
@@ -18,9 +18,8 @@ import { SCContextProviderType, SCContextType } from '../../../types';
18
18
  export declare const SCContext: React.Context<SCContextType>;
19
19
  /**
20
20
  * This component imports all providers
21
- * @param object
22
- * @param object.conf
23
- * @param object.children
21
+ * @param conf
22
+ * @param children
24
23
  * @return
25
24
  * ```jsx
26
25
  * <SCContext.Provider value={{settings}}>
@@ -25,9 +25,8 @@ const useIsComponentMountedRef_1 = tslib_1.__importDefault(require("../../../uti
25
25
  exports.SCContext = (0, react_1.createContext)({});
26
26
  /**
27
27
  * This component imports all providers
28
- * @param object
29
- * @param object.conf
30
- * @param object.children
28
+ * @param conf
29
+ * @param children
31
30
  * @return
32
31
  * ```jsx
33
32
  * <SCContext.Provider value={{settings}}>
@@ -48,7 +48,7 @@ function SCPreferencesProvider({ children = null }) {
48
48
  Promise.all([api_services_1.PreferenceService.getAllPreferences(), api_services_1.FeatureService.getAllFeatures()])
49
49
  .then(function ([preferences, features]) {
50
50
  setPreferences(preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {}));
51
- setFeatures(features['results'].map((f) => f.name));
51
+ setFeatures(features['results'].filter((f) => f.enabled).map((f) => f.name));
52
52
  setLoading(false);
53
53
  })
54
54
  .catch((_error) => {
@@ -71,4 +71,5 @@ export declare const POLL_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = "_pSugWidget
71
71
  export declare const GROUP_MEMBERS_TOOLS_STATE_CACHE_PREFIX_KEY = "_gMemWidget_";
72
72
  export declare const GROUP_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = "_gReqWidget_";
73
73
  export declare const GROUPS_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = "_glIST_";
74
+ export declare const GROUPS_SUBSCRIBED_TOOLS_STATE_CACHE_PREFIX_KEY = "_gSubWidget_";
74
75
  export declare const getWidgetStateCacheKey: (p: any, id?: any) => string;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  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.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.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_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 = 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 = 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}`;
@@ -98,5 +98,6 @@ exports.POLL_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = '_pSugWidget_';
98
98
  exports.GROUP_MEMBERS_TOOLS_STATE_CACHE_PREFIX_KEY = '_gMemWidget_';
99
99
  exports.GROUP_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = '_gReqWidget_';
100
100
  exports.GROUPS_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = '_glIST_';
101
+ exports.GROUPS_SUBSCRIBED_TOOLS_STATE_CACHE_PREFIX_KEY = '_gSubWidget_';
101
102
  const getWidgetStateCacheKey = (p, id = undefined) => `${p}${id !== undefined ? id : ''}`;
102
103
  exports.getWidgetStateCacheKey = getWidgetStateCacheKey;
@@ -44,6 +44,10 @@ export declare const SCNotificationMapping: {
44
44
  83: SCNotificationTypologyType;
45
45
  96: SCNotificationTypologyType;
46
46
  99: SCNotificationTypologyType;
47
+ 31: SCNotificationTypologyType;
48
+ 32: SCNotificationTypologyType;
49
+ 33: SCNotificationTypologyType;
50
+ 34: SCNotificationTypologyType;
47
51
  };
48
52
  /**
49
53
  * Silent Snippet Notifications
@@ -47,6 +47,10 @@ exports.SCNotificationMapping = {
47
47
  83: types_1.SCNotificationTypologyType.UNBLOCKED_USER,
48
48
  96: types_1.SCNotificationTypologyType.INCUBATOR_APPROVED,
49
49
  99: types_1.SCNotificationTypologyType.CUSTOM_NOTIFICATION,
50
+ 31: types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_GROUP,
51
+ 32: types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP,
52
+ 33: types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP,
53
+ 34: types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP
50
54
  };
51
55
  /**
52
56
  * Silent Snippet Notifications
@@ -35,6 +35,7 @@ export declare const GROUP_ROUTE_NAME = "group";
35
35
  export declare const GROUP_MEMBERS_ROUTE_NAME = "group_members";
36
36
  export declare const GROUP_MESSAGES_ROUTE_NAME = "group_messages";
37
37
  export declare const GROUPS_ROUTE_NAME = "groups";
38
+ export declare const GROUPS_SUBSCRIBED_ROUTE_NAME = "groups_subscribed";
38
39
  /**
39
40
  * Default Routes
40
41
  * @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.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.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
  /**
@@ -38,6 +38,7 @@ exports.GROUP_ROUTE_NAME = 'group';
38
38
  exports.GROUP_MEMBERS_ROUTE_NAME = 'group_members';
39
39
  exports.GROUP_MESSAGES_ROUTE_NAME = 'group_messages';
40
40
  exports.GROUPS_ROUTE_NAME = 'groups';
41
+ exports.GROUPS_SUBSCRIBED_ROUTE_NAME = 'groups_subscribed';
41
42
  /**
42
43
  * Default Routes
43
44
  * @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}}
@@ -75,4 +76,5 @@ exports.defaultRoutes = {
75
76
  [exports.GROUP_MEMBERS_ROUTE_NAME]: '/group/:id/:slug/members/',
76
77
  [exports.GROUP_MESSAGES_ROUTE_NAME]: '/group/:id/:slug/messages/',
77
78
  [exports.GROUPS_ROUTE_NAME]: '/groups/',
79
+ [exports.GROUPS_SUBSCRIBED_ROUTE_NAME]: '/groups/subscribed/',
78
80
  };
@@ -3,8 +3,7 @@ import { SCTagType } from '@selfcommunity/types';
3
3
  :::info
4
4
  This custom hook is used to fetch the addressing tag list for the session user
5
5
  :::
6
- * @param object
7
- * @param object.fetch
6
+ * @param fetch
8
7
  */
9
8
  export default function useSCFetchAddressingTagList({ fetch }: {
10
9
  fetch?: boolean;
@@ -9,8 +9,7 @@ const SCUserProvider_1 = require("../components/provider/SCUserProvider");
9
9
  :::info
10
10
  This custom hook is used to fetch the addressing tag list for the session user
11
11
  :::
12
- * @param object
13
- * @param object.fetch
12
+ * @param fetch
14
13
  */
15
14
  function useSCFetchAddressingTagList({ fetch = false }) {
16
15
  const [scAddressingTags, setSCAddressingTags] = (0, react_1.useState)([]);
@@ -4,8 +4,6 @@ import { CacheStrategies } from '@selfcommunity/utils';
4
4
  /**
5
5
  :::info
6
6
  This custom hook is used to fetch broadcast messages.
7
- @param object
8
- @param object.cacheStrategy
9
7
 
10
8
  :::tip Context can be consumed in this way:
11
9
 
@@ -13,6 +11,7 @@ import { CacheStrategies } from '@selfcommunity/utils';
13
11
  const {messages, isLoading} = useSCFetchBroadcastMessages();
14
12
  ```
15
13
  :::
14
+ * @param props
16
15
  */
17
16
  declare const useSCFetchBroadcastMessages: (props?: {
18
17
  cacheStrategy?: CacheStrategies;
@@ -21,8 +21,6 @@ const initialData = { results: [], next: broadcastMessagesRefreshUrl, previous:
21
21
  /**
22
22
  :::info
23
23
  This custom hook is used to fetch broadcast messages.
24
- @param object
25
- @param object.cacheStrategy
26
24
 
27
25
  :::tip Context can be consumed in this way:
28
26
 
@@ -30,6 +28,7 @@ const initialData = { results: [], next: broadcastMessagesRefreshUrl, previous:
30
28
  const {messages, isLoading} = useSCFetchBroadcastMessages();
31
29
  ```
32
30
  :::
31
+ * @param props
33
32
  */
34
33
  const useSCFetchBroadcastMessages = (props) => {
35
34
  // PROPS
@@ -3,8 +3,6 @@ import { CacheStrategies } from '@selfcommunity/utils';
3
3
  /**
4
4
  :::info
5
5
  This custom hook is used to fetch categories.
6
- @param object
7
- @param object.cacheStrategy
8
6
 
9
7
  :::tip Context can be consumed in this way:
10
8
 
@@ -12,6 +10,7 @@ import { CacheStrategies } from '@selfcommunity/utils';
12
10
  const {categories, isLoading} = useSCFetchCategories();
13
11
  ```
14
12
  :::
13
+ * @param props
15
14
  */
16
15
  declare const useSCFetchCategories: (props?: {
17
16
  cacheStrategy?: CacheStrategies;
@@ -25,8 +25,6 @@ const hydrate = (ids) => {
25
25
  /**
26
26
  :::info
27
27
  This custom hook is used to fetch categories.
28
- @param object
29
- @param object.cacheStrategy
30
28
 
31
29
  :::tip Context can be consumed in this way:
32
30
 
@@ -34,6 +32,7 @@ const hydrate = (ids) => {
34
32
  const {categories, isLoading} = useSCFetchCategories();
35
33
  ```
36
34
  :::
35
+ * @param props
37
36
  */
38
37
  const useSCFetchCategories = (props) => {
39
38
  // PROPS
@@ -47,15 +46,8 @@ const useSCFetchCategories = (props) => {
47
46
  * Fetch categories
48
47
  */
49
48
  const fetchCategories = (next = api_services_1.Endpoints.CategoryList.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.CategoryList.method,
53
- });
54
- const data = response.data;
55
- if (data.next) {
56
- return data.results.concat(yield fetchCategories(data.next));
57
- }
58
- return data.results;
49
+ const data = yield api_services_1.CategoryService.getAllCategories({ active: true }, { url: next });
50
+ return data.next ? data.results.concat(yield fetchCategories(data.next)) : data.results;
59
51
  });
60
52
  /**
61
53
  * Get categories
@@ -8,7 +8,7 @@ import { CacheStrategies } from '@selfcommunity/utils';
8
8
  * @param object
9
9
  * @param object.id
10
10
  * @param object.commentObject
11
- * @param cacheStrategy
11
+ * @param object.cacheStrategy
12
12
  */
13
13
  export default function useSCFetchCommentObject({ id, commentObject, cacheStrategy, }: {
14
14
  id?: number;
@@ -13,7 +13,7 @@ const use_deep_compare_effect_1 = require("use-deep-compare-effect");
13
13
  * @param object
14
14
  * @param object.id
15
15
  * @param object.commentObject
16
- * @param cacheStrategy
16
+ * @param object.cacheStrategy
17
17
  */
18
18
  function useSCFetchCommentObject({ id = null, commentObject = null, cacheStrategy = utils_1.CacheStrategies.CACHE_FIRST, }) {
19
19
  const __commentObjectId = commentObject ? commentObject.id : id;
@@ -34,13 +34,7 @@ export declare const commentsObjectActionTypes: {
34
34
  :::info
35
35
  This custom hooks is used to fetch paginated comments.
36
36
  :::
37
- * @param id
38
- * @param feedObject
39
- * @param feedObjectType
40
- * @param offset
41
- * @param pageSize
42
- * @param orderBy
43
- * @param parent
37
+ * @param props
44
38
  */
45
39
  export default function useSCFetchCommentObjects(props: {
46
40
  id?: number;
@@ -98,20 +98,13 @@ function stateInitializer(data) {
98
98
  :::info
99
99
  This custom hooks is used to fetch paginated comments.
100
100
  :::
101
- * @param id
102
- * @param feedObject
103
- * @param feedObjectType
104
- * @param offset
105
- * @param pageSize
106
- * @param orderBy
107
- * @param parent
101
+ * @param props
108
102
  */
109
103
  function useSCFetchCommentObjects(props) {
110
104
  // PROPS
111
105
  const { id, feedObject, feedObjectType, offset = 0, pageSize = 5, orderBy = types_1.SCCommentsOrderBy.ADDED_AT_DESC, parent, onChangePage, cacheStrategy = utils_1.CacheStrategies.NETWORK_ONLY, } = props;
112
106
  // FeedObject
113
107
  const { obj, setObj } = (0, useSCFetchFeedObject_1.default)({ id, feedObject, feedObjectType, cacheStrategy });
114
- const objId = obj ? obj.id : null;
115
108
  /**
116
109
  * Get next url
117
110
  */
@@ -33,11 +33,7 @@ export declare const contributorsObjectActionTypes: {
33
33
  :::info
34
34
  This custom hooks is used to fetch paginated contributors.
35
35
  :::
36
- * @param id
37
- * @param feedObject
38
- * @param feedObjectType
39
- * @param offset
40
- * @param pageSize
36
+ * @param props
41
37
  */
42
38
  export default function useSCFetchContributors(props: {
43
39
  id?: number;
@@ -76,11 +76,7 @@ function stateInitializer(data) {
76
76
  :::info
77
77
  This custom hooks is used to fetch paginated contributors.
78
78
  :::
79
- * @param id
80
- * @param feedObject
81
- * @param feedObjectType
82
- * @param offset
83
- * @param pageSize
79
+ * @param props
84
80
  */
85
81
  function useSCFetchContributors(props) {
86
82
  // PROPS
@@ -6,9 +6,10 @@ import { SCCustomAdvPosition, SCCustomAdvType } from '@selfcommunity/types';
6
6
  This custom hook is used to fetch a custom adv object.
7
7
  :::
8
8
  * @param object
9
+ * @param object.id
9
10
  * @param object.position
10
- * @param object.categoryId
11
- * @param cacheStrategy
11
+ * @param object.categoriesId
12
+ * @param object.cacheStrategy
12
13
  */
13
14
  export default function useSCFetchCustomAdv({ id, position, categoriesId, cacheStrategy, }: {
14
15
  id?: number;
@@ -12,9 +12,10 @@ const Cache_1 = require("../constants/Cache");
12
12
  This custom hook is used to fetch a custom adv object.
13
13
  :::
14
14
  * @param object
15
+ * @param object.id
15
16
  * @param object.position
16
- * @param object.categoryId
17
- * @param cacheStrategy
17
+ * @param object.categoriesId
18
+ * @param object.cacheStrategy
18
19
  */
19
20
  function useSCFetchCustomAdv({ id = null, position = null, categoriesId = null, cacheStrategy = utils_1.CacheStrategies.CACHE_FIRST, }) {
20
21
  const [scCustomAdv, setSCCustomAdv] = (0, react_1.useState)(id !== null && cacheStrategy === utils_1.CacheStrategies.CACHE_FIRST && utils_1.LRUCache.get((0, Cache_1.getAdvObjectCacheKey)(id))
@@ -38,11 +38,7 @@ export declare const feedDataActionTypes: {
38
38
  :::info
39
39
  This custom hooks is used to fetch paginated Data.
40
40
  :::
41
- * @param endpoint
42
- * @param offset
43
- * @param pageSize
44
- * @param onChangePage
45
- * @param cacheStrategy
41
+ * @param props
46
42
  */
47
43
  export default function useSCFetchFeed(props: {
48
44
  id: string;
@@ -90,11 +90,7 @@ function stateInitializer(data) {
90
90
  :::info
91
91
  This custom hooks is used to fetch paginated Data.
92
92
  :::
93
- * @param endpoint
94
- * @param offset
95
- * @param pageSize
96
- * @param onChangePage
97
- * @param cacheStrategy
93
+ * @param props
98
94
  */
99
95
  function useSCFetchFeed(props) {
100
96
  // PROPS
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SCGroupType } from '@selfcommunity/types';
3
2
  import { CacheStrategies } from '@selfcommunity/utils';
4
3
  /**
@@ -16,6 +15,6 @@ export default function useSCFetchGroup({ id, group, cacheStrategy, }: {
16
15
  cacheStrategy?: CacheStrategies;
17
16
  }): {
18
17
  scGroup: SCGroupType;
19
- setSCGroup: import("react").Dispatch<import("react").SetStateAction<SCGroupType>>;
18
+ setSCGroup: (group: SCGroupType) => void;
20
19
  error: string;
21
20
  };
@@ -24,8 +24,13 @@ function useSCFetchGroup({ id = null, group = null, cacheStrategy = utils_1.Cach
24
24
  // CACHE
25
25
  const __groupCacheKey = (0, Cache_1.getGroupObjectCacheKey)(__groupId);
26
26
  const __group = authUserId ? group : (0, utils_1.objectWithoutProperties)(group, ['subscription_status']);
27
- const [scGroup, setSCGroup] = (0, react_1.useState)(cacheStrategy !== utils_1.CacheStrategies.NETWORK_ONLY ? utils_1.LRUCache.get(__groupCacheKey, __group) : null);
27
+ const [scGroup, setScGroup] = (0, react_1.useState)(cacheStrategy !== utils_1.CacheStrategies.NETWORK_ONLY ? utils_1.LRUCache.get(__groupCacheKey, __group) : null);
28
28
  const [error, setError] = (0, react_1.useState)(null);
29
+ const setSCGroup = (group) => {
30
+ const _c = authUserId ? group : (0, utils_1.objectWithoutProperties)(group, ['subscription_status']);
31
+ setScGroup(_c);
32
+ utils_1.LRUCache.set(__groupCacheKey, _c);
33
+ };
29
34
  /**
30
35
  * Memoized fetchTag
31
36
  */
@@ -49,9 +54,7 @@ function useSCFetchGroup({ id = null, group = null, cacheStrategy = utils_1.Cach
49
54
  if (__groupId && (!scGroup || (scGroup && __groupId !== scGroup.id))) {
50
55
  fetchGroup()
51
56
  .then((obj) => {
52
- const _c = authUserId ? obj : (0, utils_1.objectWithoutProperties)(obj, ['subscription_status']);
53
- setSCGroup(_c);
54
- utils_1.LRUCache.set(__groupCacheKey, _c);
57
+ setSCGroup(obj);
55
58
  })
56
59
  .catch((err) => {
57
60
  utils_1.LRUCache.delete(__groupCacheKey);
@@ -63,9 +66,7 @@ function useSCFetchGroup({ id = null, group = null, cacheStrategy = utils_1.Cach
63
66
  }, [__groupId, authUserId]);
64
67
  (0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
65
68
  if (group) {
66
- const _c = authUserId ? group : (0, utils_1.objectWithoutProperties)(group, ['subscription_status']);
67
- setSCGroup(_c);
68
- utils_1.LRUCache.set(__groupCacheKey, _c);
69
+ setSCGroup(group);
69
70
  }
70
71
  }, [group, authUserId]);
71
72
  return { scGroup, setSCGroup, error };
@@ -46,10 +46,10 @@ const useSCFetchGroups = (props) => {
46
46
  /**
47
47
  * Fetch groups
48
48
  */
49
- const fetchGroups = (next = api_services_1.Endpoints.SearchGroups.url()) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
49
+ const fetchGroups = (next = api_services_1.Endpoints.GetUserGroups.url()) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
50
50
  const response = yield api_services_1.http.request({
51
51
  url: next,
52
- method: api_services_1.Endpoints.SearchGroups.method,
52
+ method: api_services_1.Endpoints.GetUserGroups.method,
53
53
  });
54
54
  const data = response.data;
55
55
  if (data.next) {
@@ -3,8 +3,10 @@ import { SCUserType } from '@selfcommunity/types';
3
3
  :::info
4
4
  This custom hook is used to fetch if a user is blocked by another user.
5
5
  :::
6
- * @param user
7
- * @param blockedByUser
6
+ * @param object
7
+ * @param object.user
8
+ * @param object.blockedByUser
9
+ * @param object.sync
8
10
  */
9
11
  export default function useSCFetchUserBlockedBy({ user, blockedByUser, sync, }: {
10
12
  user: SCUserType;
@@ -9,8 +9,10 @@ const SCUserProvider_1 = require("../components/provider/SCUserProvider");
9
9
  :::info
10
10
  This custom hook is used to fetch if a user is blocked by another user.
11
11
  :::
12
- * @param user
13
- * @param blockedByUser
12
+ * @param object
13
+ * @param object.user
14
+ * @param object.blockedByUser
15
+ * @param object.sync
14
16
  */
15
17
  function useSCFetchUserBlockedBy({ user = null, blockedByUser = null, sync = true, }) {
16
18
  const [blockedBy, setBlockedBy] = (0, react_1.useState)(null);
@@ -2,11 +2,11 @@
2
2
  import { SCUserProviderAssociationType } from '@selfcommunity/types';
3
3
  /**
4
4
  :::info
5
- This custom hook is used to fetch the listo of user providers.
5
+ This custom hook is used to fetch the list of user providers.
6
6
  :::
7
7
  * @param object
8
8
  * @param object.id
9
- * @param object.user
9
+ * @param object.providers
10
10
  */
11
11
  export default function useSCFetchUserProviders({ id, providers }: {
12
12
  id: number | string;
@@ -6,11 +6,11 @@ const api_services_1 = require("@selfcommunity/api-services");
6
6
  const utils_1 = require("@selfcommunity/utils");
7
7
  /**
8
8
  :::info
9
- This custom hook is used to fetch the listo of user providers.
9
+ This custom hook is used to fetch the list of user providers.
10
10
  :::
11
11
  * @param object
12
12
  * @param object.id
13
- * @param object.user
13
+ * @param object.providers
14
14
  */
15
15
  function useSCFetchUserProviders({ id, providers = null }) {
16
16
  const [scUserProviders, setSCUserProviders] = (0, react_1.useState)(providers || []);
@@ -31,6 +31,12 @@ interface FetchVoteProps {
31
31
  :::info
32
32
  This custom hook is used to fetch a contribution vote.
33
33
  :::
34
+ * @param object
35
+ * @param object.id
36
+ * @param object.contribution
37
+ * @param object.contributionType
38
+ * @param object.onVote
39
+ * @param object.cacheStrategy
34
40
  */
35
41
  export default function useSCFetchVote({ id, contribution, contributionType, onVote, cacheStrategy, }: FetchVoteProps): {
36
42
  isLoading: boolean;
@@ -13,6 +13,12 @@ const SCVoteProvider_1 = require("../components/provider/SCVoteProvider");
13
13
  :::info
14
14
  This custom hook is used to fetch a contribution vote.
15
15
  :::
16
+ * @param object
17
+ * @param object.id
18
+ * @param object.contribution
19
+ * @param object.contributionType
20
+ * @param object.onVote
21
+ * @param object.cacheStrategy
16
22
  */
17
23
  function useSCFetchVote({ id, contribution = null, contributionType, onVote = null, cacheStrategy = utils_1.CacheStrategies.CACHE_FIRST, }) {
18
24
  // MEMO
@@ -7,6 +7,7 @@ const types_1 = require("@selfcommunity/types");
7
7
  const useSCCachingManager_1 = tslib_1.__importDefault(require("./useSCCachingManager"));
8
8
  const Errors_1 = require("../constants/Errors");
9
9
  const utils_1 = require("@selfcommunity/utils");
10
+ const SCPreferencesProvider_1 = require("../components/provider/SCPreferencesProvider");
10
11
  /**
11
12
  :::info
12
13
  This custom hook is used to manage the groups followed.
@@ -23,7 +24,9 @@ const utils_1 = require("@selfcommunity/utils");
23
24
  */
24
25
  function useSCSubscribedGroupsManager(user) {
25
26
  const { cache, updateCache, emptyCache, data, setData, loading, setLoading, setUnLoading, isLoading } = (0, useSCCachingManager_1.default)();
27
+ const scPreferencesContext = (0, SCPreferencesProvider_1.useSCPreferences)();
26
28
  const authUserId = user ? user.id : null;
29
+ const groupsDisabled = scPreferencesContext.features && !scPreferencesContext.features.includes(types_1.SCFeatureName.GROUPING);
27
30
  /**
28
31
  * Memoized refresh all groups
29
32
  * It makes a single request to the server and retrieves
@@ -43,9 +46,9 @@ function useSCSubscribedGroupsManager(user) {
43
46
  if (res.status >= 300) {
44
47
  return Promise.reject(res);
45
48
  }
46
- const groupsIds = res.data.map((g) => g.id);
49
+ const groupsIds = res.data.results.map((g) => g.id);
47
50
  updateCache(groupsIds);
48
- setData(groupsIds);
51
+ setData(res.data.results.map((g) => ({ [g.id]: g.subscription_status })));
49
52
  return Promise.resolve(res.data);
50
53
  })
51
54
  .catch((e) => {
@@ -88,7 +91,9 @@ function useSCSubscribedGroupsManager(user) {
88
91
  return Promise.reject(res);
89
92
  }
90
93
  updateCache([group.id]);
91
- setData((prev) => getDataUpdated(prev, group.id, group.privacy === types_1.SCGroupPrivacyType.PRIVATE ? types_1.SCGroupSubscriptionStatusType.REQUESTED : types_1.SCGroupSubscriptionStatusType.SUBSCRIBED));
94
+ setData((prev) => getDataUpdated(prev, group.id, group.privacy === types_1.SCGroupPrivacyType.PRIVATE && group.subscription_status !== types_1.SCGroupSubscriptionStatusType.INVITED
95
+ ? types_1.SCGroupSubscriptionStatusType.REQUESTED
96
+ : types_1.SCGroupSubscriptionStatusType.SUBSCRIBED));
92
97
  setUnLoading(group.id);
93
98
  return Promise.resolve(res.data);
94
99
  });
@@ -201,7 +206,7 @@ function useSCSubscribedGroupsManager(user) {
201
206
  }
202
207
  }
203
208
  return null;
204
- }, [data, loading, cache, authUserId]);
209
+ }, [loading, cache, authUserId]);
205
210
  /**
206
211
  * Empty cache on logout
207
212
  */
@@ -210,7 +215,7 @@ function useSCSubscribedGroupsManager(user) {
210
215
  emptyCache();
211
216
  }
212
217
  }, [authUserId]);
213
- if (!user) {
218
+ if (groupsDisabled || !user) {
214
219
  return { groups: data, loading, isLoading };
215
220
  }
216
221
  return { groups: data, loading, isLoading, subscribe, unsubscribe, subscriptionStatus, refresh, emptyCache };
@@ -18,9 +18,8 @@ import { SCContextProviderType, SCContextType } from '../../../types';
18
18
  export declare const SCContext: React.Context<SCContextType>;
19
19
  /**
20
20
  * This component imports all providers
21
- * @param object
22
- * @param object.conf
23
- * @param object.children
21
+ * @param conf
22
+ * @param children
24
23
  * @return
25
24
  * ```jsx
26
25
  * <SCContext.Provider value={{settings}}>
@@ -21,9 +21,8 @@ import useIsComponentMountedRef from '../../../utils/hooks/useIsComponentMounted
21
21
  export const SCContext = createContext({});
22
22
  /**
23
23
  * This component imports all providers
24
- * @param object
25
- * @param object.conf
26
- * @param object.children
24
+ * @param conf
25
+ * @param children
27
26
  * @return
28
27
  * ```jsx
29
28
  * <SCContext.Provider value={{settings}}>
@@ -44,7 +44,7 @@ export default function SCPreferencesProvider({ children = null }) {
44
44
  Promise.all([PreferenceService.getAllPreferences(), FeatureService.getAllFeatures()])
45
45
  .then(function ([preferences, features]) {
46
46
  setPreferences(preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {}));
47
- setFeatures(features['results'].map((f) => f.name));
47
+ setFeatures(features['results'].filter((f) => f.enabled).map((f) => f.name));
48
48
  setLoading(false);
49
49
  })
50
50
  .catch((_error) => {
@@ -71,4 +71,5 @@ export declare const POLL_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = "_pSugWidget
71
71
  export declare const GROUP_MEMBERS_TOOLS_STATE_CACHE_PREFIX_KEY = "_gMemWidget_";
72
72
  export declare const GROUP_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = "_gReqWidget_";
73
73
  export declare const GROUPS_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = "_glIST_";
74
+ export declare const GROUPS_SUBSCRIBED_TOOLS_STATE_CACHE_PREFIX_KEY = "_gSubWidget_";
74
75
  export declare const getWidgetStateCacheKey: (p: any, id?: any) => string;
@@ -75,4 +75,5 @@ export const POLL_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = '_pSugWidget_';
75
75
  export const GROUP_MEMBERS_TOOLS_STATE_CACHE_PREFIX_KEY = '_gMemWidget_';
76
76
  export const GROUP_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = '_gReqWidget_';
77
77
  export const GROUPS_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = '_glIST_';
78
+ export const GROUPS_SUBSCRIBED_TOOLS_STATE_CACHE_PREFIX_KEY = '_gSubWidget_';
78
79
  export const getWidgetStateCacheKey = (p, id = undefined) => `${p}${id !== undefined ? id : ''}`;