@selfcommunity/react-core 0.4.9-alpha.43 → 0.4.9-alpha.45
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/SCContextProvider/index.d.ts +2 -3
- package/lib/cjs/components/provider/SCContextProvider/index.js +2 -3
- package/lib/cjs/hooks/useSCFetchAddressingTagList.d.ts +1 -2
- package/lib/cjs/hooks/useSCFetchAddressingTagList.js +1 -2
- package/lib/cjs/hooks/useSCFetchBroadcastMessages.d.ts +1 -2
- package/lib/cjs/hooks/useSCFetchBroadcastMessages.js +1 -2
- package/lib/cjs/hooks/useSCFetchCommentObject.d.ts +1 -1
- package/lib/cjs/hooks/useSCFetchCommentObject.js +1 -1
- package/lib/cjs/hooks/useSCFetchCommentObjects.d.ts +1 -7
- package/lib/cjs/hooks/useSCFetchCommentObjects.js +1 -8
- package/lib/cjs/hooks/useSCFetchContributors.d.ts +1 -5
- package/lib/cjs/hooks/useSCFetchContributors.js +1 -5
- package/lib/cjs/hooks/useSCFetchCustomAdv.d.ts +3 -2
- package/lib/cjs/hooks/useSCFetchCustomAdv.js +3 -2
- package/lib/cjs/hooks/useSCFetchFeed.d.ts +1 -5
- package/lib/cjs/hooks/useSCFetchFeed.js +1 -5
- package/lib/cjs/hooks/useSCFetchUserBlockedBy.d.ts +4 -2
- package/lib/cjs/hooks/useSCFetchUserBlockedBy.js +4 -2
- package/lib/cjs/hooks/useSCFetchUserProviders.d.ts +2 -2
- package/lib/cjs/hooks/useSCFetchUserProviders.js +2 -2
- package/lib/cjs/hooks/useSCFetchVote.d.ts +6 -0
- package/lib/cjs/hooks/useSCFetchVote.js +6 -0
- package/lib/esm/components/provider/SCContextProvider/index.d.ts +2 -3
- package/lib/esm/components/provider/SCContextProvider/index.js +2 -3
- package/lib/esm/hooks/useSCFetchAddressingTagList.d.ts +1 -2
- package/lib/esm/hooks/useSCFetchAddressingTagList.js +1 -2
- package/lib/esm/hooks/useSCFetchBroadcastMessages.d.ts +1 -2
- package/lib/esm/hooks/useSCFetchBroadcastMessages.js +1 -2
- package/lib/esm/hooks/useSCFetchCommentObject.d.ts +1 -1
- package/lib/esm/hooks/useSCFetchCommentObject.js +1 -1
- package/lib/esm/hooks/useSCFetchCommentObjects.d.ts +1 -7
- package/lib/esm/hooks/useSCFetchCommentObjects.js +1 -8
- package/lib/esm/hooks/useSCFetchContributors.d.ts +1 -5
- package/lib/esm/hooks/useSCFetchContributors.js +1 -5
- package/lib/esm/hooks/useSCFetchCustomAdv.d.ts +3 -2
- package/lib/esm/hooks/useSCFetchCustomAdv.js +3 -2
- package/lib/esm/hooks/useSCFetchFeed.d.ts +1 -5
- package/lib/esm/hooks/useSCFetchFeed.js +1 -5
- package/lib/esm/hooks/useSCFetchUserBlockedBy.d.ts +4 -2
- package/lib/esm/hooks/useSCFetchUserBlockedBy.js +4 -2
- package/lib/esm/hooks/useSCFetchUserProviders.d.ts +2 -2
- package/lib/esm/hooks/useSCFetchUserProviders.js +2 -2
- package/lib/esm/hooks/useSCFetchVote.d.ts +6 -0
- package/lib/esm/hooks/useSCFetchVote.js +6 -0
- package/lib/umd/react-core.js +1 -1
- package/package.json +3 -3
|
@@ -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
|
|
22
|
-
* @param
|
|
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
|
|
29
|
-
* @param
|
|
30
|
-
* @param object.children
|
|
28
|
+
* @param conf
|
|
29
|
+
* @param children
|
|
31
30
|
* @return
|
|
32
31
|
* ```jsx
|
|
33
32
|
* <SCContext.Provider value={{settings}}>
|
|
@@ -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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
@@ -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
|
|
7
|
-
* @param
|
|
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
|
|
13
|
-
* @param
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
@@ -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
|
|
22
|
-
* @param
|
|
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
|
|
25
|
-
* @param
|
|
26
|
-
* @param object.children
|
|
24
|
+
* @param conf
|
|
25
|
+
* @param children
|
|
27
26
|
* @return
|
|
28
27
|
* ```jsx
|
|
29
28
|
* <SCContext.Provider value={{settings}}>
|
|
@@ -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
|
-
*
|
|
7
|
-
* @param object.fetch
|
|
6
|
+
* @param fetch
|
|
8
7
|
*/
|
|
9
8
|
export default function useSCFetchAddressingTagList({ fetch }: {
|
|
10
9
|
fetch?: boolean;
|
|
@@ -7,8 +7,7 @@ import { useSCUser } from '../components/provider/SCUserProvider';
|
|
|
7
7
|
:::info
|
|
8
8
|
This custom hook is used to fetch the addressing tag list for the session user
|
|
9
9
|
:::
|
|
10
|
-
*
|
|
11
|
-
* @param object.fetch
|
|
10
|
+
* @param fetch
|
|
12
11
|
*/
|
|
13
12
|
export default function useSCFetchAddressingTagList({ fetch = false }) {
|
|
14
13
|
const [scAddressingTags, setSCAddressingTags] = 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;
|
|
@@ -19,8 +19,6 @@ const initialData = { results: [], next: broadcastMessagesRefreshUrl, previous:
|
|
|
19
19
|
/**
|
|
20
20
|
:::info
|
|
21
21
|
This custom hook is used to fetch broadcast messages.
|
|
22
|
-
@param object
|
|
23
|
-
@param object.cacheStrategy
|
|
24
22
|
|
|
25
23
|
:::tip Context can be consumed in this way:
|
|
26
24
|
|
|
@@ -28,6 +26,7 @@ const initialData = { results: [], next: broadcastMessagesRefreshUrl, previous:
|
|
|
28
26
|
const {messages, isLoading} = useSCFetchBroadcastMessages();
|
|
29
27
|
```
|
|
30
28
|
:::
|
|
29
|
+
* @param props
|
|
31
30
|
*/
|
|
32
31
|
const useSCFetchBroadcastMessages = (props) => {
|
|
33
32
|
// PROPS
|
|
@@ -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;
|
|
@@ -11,7 +11,7 @@ import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect';
|
|
|
11
11
|
* @param object
|
|
12
12
|
* @param object.id
|
|
13
13
|
* @param object.commentObject
|
|
14
|
-
* @param cacheStrategy
|
|
14
|
+
* @param object.cacheStrategy
|
|
15
15
|
*/
|
|
16
16
|
export default function useSCFetchCommentObject({ id = null, commentObject = null, cacheStrategy = CacheStrategies.CACHE_FIRST, }) {
|
|
17
17
|
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
|
|
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;
|
|
@@ -94,20 +94,13 @@ function stateInitializer(data) {
|
|
|
94
94
|
:::info
|
|
95
95
|
This custom hooks is used to fetch paginated comments.
|
|
96
96
|
:::
|
|
97
|
-
* @param
|
|
98
|
-
* @param feedObject
|
|
99
|
-
* @param feedObjectType
|
|
100
|
-
* @param offset
|
|
101
|
-
* @param pageSize
|
|
102
|
-
* @param orderBy
|
|
103
|
-
* @param parent
|
|
97
|
+
* @param props
|
|
104
98
|
*/
|
|
105
99
|
export default function useSCFetchCommentObjects(props) {
|
|
106
100
|
// PROPS
|
|
107
101
|
const { id, feedObject, feedObjectType, offset = 0, pageSize = 5, orderBy = SCCommentsOrderBy.ADDED_AT_DESC, parent, onChangePage, cacheStrategy = CacheStrategies.NETWORK_ONLY, } = props;
|
|
108
102
|
// FeedObject
|
|
109
103
|
const { obj, setObj } = useSCFetchFeedObject({ id, feedObject, feedObjectType, cacheStrategy });
|
|
110
|
-
const objId = obj ? obj.id : null;
|
|
111
104
|
/**
|
|
112
105
|
* Get next url
|
|
113
106
|
*/
|
|
@@ -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
|
|
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;
|
|
@@ -72,11 +72,7 @@ function stateInitializer(data) {
|
|
|
72
72
|
:::info
|
|
73
73
|
This custom hooks is used to fetch paginated contributors.
|
|
74
74
|
:::
|
|
75
|
-
* @param
|
|
76
|
-
* @param feedObject
|
|
77
|
-
* @param feedObjectType
|
|
78
|
-
* @param offset
|
|
79
|
-
* @param pageSize
|
|
75
|
+
* @param props
|
|
80
76
|
*/
|
|
81
77
|
export default function useSCFetchContributors(props) {
|
|
82
78
|
// 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.
|
|
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;
|
|
@@ -9,9 +9,10 @@ import { getAdvObjectCacheKey } from '../constants/Cache';
|
|
|
9
9
|
This custom hook is used to fetch a custom adv object.
|
|
10
10
|
:::
|
|
11
11
|
* @param object
|
|
12
|
+
* @param object.id
|
|
12
13
|
* @param object.position
|
|
13
|
-
* @param object.
|
|
14
|
-
* @param cacheStrategy
|
|
14
|
+
* @param object.categoriesId
|
|
15
|
+
* @param object.cacheStrategy
|
|
15
16
|
*/
|
|
16
17
|
export default function useSCFetchCustomAdv({ id = null, position = null, categoriesId = null, cacheStrategy = CacheStrategies.CACHE_FIRST, }) {
|
|
17
18
|
const [scCustomAdv, setSCCustomAdv] = useState(id !== null && cacheStrategy === CacheStrategies.CACHE_FIRST && LRUCache.get(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
|
|
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;
|
|
@@ -86,11 +86,7 @@ function stateInitializer(data) {
|
|
|
86
86
|
:::info
|
|
87
87
|
This custom hooks is used to fetch paginated Data.
|
|
88
88
|
:::
|
|
89
|
-
* @param
|
|
90
|
-
* @param offset
|
|
91
|
-
* @param pageSize
|
|
92
|
-
* @param onChangePage
|
|
93
|
-
* @param cacheStrategy
|
|
89
|
+
* @param props
|
|
94
90
|
*/
|
|
95
91
|
export default function useSCFetchFeed(props) {
|
|
96
92
|
// PROPS
|
|
@@ -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
|
|
7
|
-
* @param
|
|
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;
|
|
@@ -7,8 +7,10 @@ import { useSCUser } from '../components/provider/SCUserProvider';
|
|
|
7
7
|
:::info
|
|
8
8
|
This custom hook is used to fetch if a user is blocked by another user.
|
|
9
9
|
:::
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
10
|
+
* @param object
|
|
11
|
+
* @param object.user
|
|
12
|
+
* @param object.blockedByUser
|
|
13
|
+
* @param object.sync
|
|
12
14
|
*/
|
|
13
15
|
export default function useSCFetchUserBlockedBy({ user = null, blockedByUser = null, sync = true, }) {
|
|
14
16
|
const [blockedBy, setBlockedBy] = 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
|
|
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.
|
|
9
|
+
* @param object.providers
|
|
10
10
|
*/
|
|
11
11
|
export default function useSCFetchUserProviders({ id, providers }: {
|
|
12
12
|
id: number | string;
|
|
@@ -4,11 +4,11 @@ import { UserService } from '@selfcommunity/api-services';
|
|
|
4
4
|
import { Logger } from '@selfcommunity/utils';
|
|
5
5
|
/**
|
|
6
6
|
:::info
|
|
7
|
-
This custom hook is used to fetch the
|
|
7
|
+
This custom hook is used to fetch the list of user providers.
|
|
8
8
|
:::
|
|
9
9
|
* @param object
|
|
10
10
|
* @param object.id
|
|
11
|
-
* @param object.
|
|
11
|
+
* @param object.providers
|
|
12
12
|
*/
|
|
13
13
|
export default function useSCFetchUserProviders({ id, providers = null }) {
|
|
14
14
|
const [scUserProviders, setSCUserProviders] = 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;
|
|
@@ -11,6 +11,12 @@ import { useSCVote } from '../components/provider/SCVoteProvider';
|
|
|
11
11
|
:::info
|
|
12
12
|
This custom hook is used to fetch a contribution vote.
|
|
13
13
|
:::
|
|
14
|
+
* @param object
|
|
15
|
+
* @param object.id
|
|
16
|
+
* @param object.contribution
|
|
17
|
+
* @param object.contributionType
|
|
18
|
+
* @param object.onVote
|
|
19
|
+
* @param object.cacheStrategy
|
|
14
20
|
*/
|
|
15
21
|
export default function useSCFetchVote({ id, contribution = null, contributionType, onVote = null, cacheStrategy = CacheStrategies.CACHE_FIRST, }) {
|
|
16
22
|
// MEMO
|